Skip to content
Snippets Groups Projects
Commit 2123bd5a authored by Ale's avatar Ale
Browse files

add file saving management

parent 7efab56a
No related branches found
No related tags found
No related merge requests found
...@@ -2,6 +2,7 @@ import threading ...@@ -2,6 +2,7 @@ import threading
import time import time
from pathlib import Path from pathlib import Path
import numpy as np import numpy as np
import git
import quadruped_reactive_walking as qrw import quadruped_reactive_walking as qrw
from .Controller import Controller from .Controller import Controller
...@@ -15,6 +16,9 @@ pd = ProblemDataFull(params) ...@@ -15,6 +16,9 @@ pd = ProblemDataFull(params)
target = Target(pd) target = Target(pd)
target.update(0) target.update(0)
repo = git.Repo(search_parent_directories=True)
sha = repo.head.object.hexsha
if params.SIMULATION: if params.SIMULATION:
from .tools.PyBulletSimulator import PyBulletSimulator from .tools.PyBulletSimulator import PyBulletSimulator
else: else:
...@@ -222,13 +226,14 @@ def control_loop(): ...@@ -222,13 +226,14 @@ def control_loop():
if device.is_timeout: if device.is_timeout:
print("Masterboard timeout detected.") print("Masterboard timeout detected.")
#if params.LOGGING: if params.LOGGING:
# log_path = Path("/tmp") / "logs" log_path = Path("/home/aassirelli/devel/experimental_stuff/experiments/solo-reduced-model") / sha / "log"
# log_path.mkdir(parents=True) try:
# loggerControl.save(str(log_path / "data")) log_path.mkdir(parents=True)
except:
print("The directory already exists, delete it before running")
if params.PLOTTING: loggerControl.save(str(log_path / "data"))
loggerControl.plot()
if params.SIMULATION and params.enable_pyb_GUI: if params.SIMULATION and params.enable_pyb_GUI:
device.Stop() device.Stop()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment