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

improve documentation of rai tool-calling or simplify internal ros communication #313

Open
boczekbartek opened this issue Nov 22, 2024 · 0 comments
Labels
documentation Improvements or additions to documentation enhancement New feature or request ros issue related to ros2

Comments

@boczekbartek
Copy link
Member

boczekbartek commented Nov 22, 2024

Is your feature request related to a problem? Please describe.
rai currently has multiple levels of tools.

  1. Generic tools that call ros2 topics/services/actions
  2. Specialized tools (like nav2 tools or open-set detection tools) that implement their own node
  3. Different types of tools attached to RaiNode are handled differently due to dedicated node spinning (rclpy.spin) implementation and to avoid deadlock. Tools that connect to topics are handled using different node to tools that call services and actions.

Describe the solution you'd like
Such dedicated implementations should be documented so that developer knows on which level a new tool should be implemented.

Describe alternatives you've considered

Additional context

Pseudo-code with high-level overview of the issue
# Node for topic subscription
class TopicSubNode(rclpy.node.Node):
    def __init__(self):
        self.subscriber = self.create_subscription(..., callback=self.callback)
    
    def callback(self,msg):
        # handle msg

def run_node_with_subscription():
    rclpy.init()

    node = TopicSubNode()
    rclpy.spin(node)

# Node for service calling 
class SrvClientNode(rclpy.node.Node):
    def __init__(self):
        ... 
        self.client = self.create_client("/some_service")

    def call_service(self):
        future = self.client.call_async(...)
        rclpy.spin_until_future_complete(self, future)

def run_srv_node():
    rclpy.init()
    node = SrvClientNode()
    # cannot spin here
    node.call_service()


# If 1 node handles service and topic - spin and spin_until_future_complete can deadlock / unexpected behavior
@boczekbartek boczekbartek added documentation Improvements or additions to documentation enhancement New feature or request labels Nov 22, 2024
@boczekbartek boczekbartek changed the title improve documentation of rai tool-calling improve documentation of rai tool-calling / simplify ros communication Dec 11, 2024
@boczekbartek boczekbartek changed the title improve documentation of rai tool-calling / simplify ros communication improve documentation of rai tool-calling / simplify internal ros communication Dec 11, 2024
@boczekbartek boczekbartek changed the title improve documentation of rai tool-calling / simplify internal ros communication improve documentation of rai tool-calling or simplify internal ros communication Dec 11, 2024
@boczekbartek boczekbartek added the ros issue related to ros2 label Dec 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation enhancement New feature or request ros issue related to ros2
Projects
None yet
Development

No branches or pull requests

1 participant