Skip to content

Commit

Permalink
Throw exception if already running (#70)
Browse files Browse the repository at this point in the history
* Throw exception if already running

* Exception formatting
  • Loading branch information
lukeschmitt-tr authored May 23, 2024
1 parent acd367f commit e058170
Showing 1 changed file with 2 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,8 @@ def logfatal(self, message: str, **kwargs):
def __start(node: InterbotixRobotNode, daemon: bool = True) -> None:
"""Start a background thread that spins the rclpy global executor."""
global __interbotix_is_up
if interbotix_is_up():
raise InterbotixException('Startup has already been requested.')
__interbotix_is_up = True
global __interbotix_execution_thread
__interbotix_execution_thread = Thread(target=rclpy.spin, args=(node,), daemon=daemon)
Expand Down

0 comments on commit e058170

Please sign in to comment.