Commit 678578a5 authored by Dominique Piche's avatar Dominique Piche

fix data folder bug

parent 1730bbd2
......@@ -130,7 +130,7 @@ class MecaRobot:
while string_received != '':
string_received = self._receive_str()
def wait_for(self, answer: str, error_message: str, timeout: float=10) -> str:
def wait_for(self, answer: str, error_message: str='Did not receive the expected robot answer.', timeout: float=10) -> str:
# Waits for a specific answer from the robot before continuing the program. Returns the command.
if self.enable_log:
......@@ -180,6 +180,13 @@ class MecaRobot:
is written in a file.
"""
self.is_tracking = True
current_path = os.getcwd()
try:
os.mkdir(os.path.join(current_path, 'Data'))
except FileExistsError:
pass
self.data = open(os.path.join(current_path, 'Data/tracking_data.txt'), 'w+')
self.data.write('Time [s], TRF position [mm]')
self.data.write('\n')
......@@ -192,7 +199,7 @@ class MecaRobot:
def _track_data(self):
current_time = str(time.time()-self.start_time)
position = str(self.get_TRF_pose()[0:3])
self.data.write(current_time + position + '\n')
self.data.write(current_time + ', ' + position + '\n')
def get_TRF_pose(self) -> np.ndarray:
"""
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment