Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make Interbotix executor multithreaded #73

Merged
merged 1 commit into from
Jun 26, 2024
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
from interbotix_common_modules.common_robot.exceptions import InterbotixException
import rclpy
from rclpy.duration import Duration
from rclpy.executors import MultiThreadedExecutor
from rclpy.node import Node
from rclpy.task import Future

Expand Down Expand Up @@ -96,7 +97,13 @@ def __start(node: InterbotixRobotNode, daemon: bool = True) -> None:
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)
global __interbotix_executor
__interbotix_executor = MultiThreadedExecutor()
def spin(node: InterbotixRobotNode) -> None:
while rclpy.ok():
__interbotix_executor.add_node(node=node)
__interbotix_executor.spin()
__interbotix_execution_thread = Thread(target=spin, args=(node,), daemon=daemon)
__interbotix_execution_thread.start()


Expand Down
Loading