Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions i2rt/motor_drivers/dm_driver.py
Original file line number Diff line number Diff line change
Expand Up @@ -532,8 +532,8 @@ def start_thread(self) -> None:
if self.start_thread_flag:
return
logging.info("starting separate thread for control loop")
thread = threading.Thread(target=self._set_torques_and_update_state)
thread.start()
self._control_thread = threading.Thread(target=self._set_torques_and_update_state)
self._control_thread.start()
self.start_thread_flag = True
time.sleep(0.1)
while self.state is None:
Expand Down Expand Up @@ -748,6 +748,8 @@ def get_same_bus_device_states(self) -> Any:

def close(self) -> None:
self.running = False
if hasattr(self, "_control_thread") and self._control_thread.is_alive():
self._control_thread.join(timeout=2.0)
self.motor_interface.close()


Expand Down