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

Fix the launching of Servo as a node component #2194

Merged
merged 6 commits into from
Jun 2, 2023

Conversation

AndyZe
Copy link
Member

@AndyZe AndyZe commented May 21, 2023

Description

Now that this seems to work reliably, make it the default way. It should decrease latency.

I tested with the tutorial, like normal:

https://moveit.picknik.ai/main/doc/examples/realtime_servo/realtime_servo_tutorial.html

@AndyZe AndyZe requested a review from sea-bass May 21, 2023 23:40
@AndyZe
Copy link
Member Author

AndyZe commented May 21, 2023

@ibrahiminfinite

@codecov
Copy link

codecov bot commented May 22, 2023

Codecov Report

Patch coverage has no change and project coverage change: +0.02 🎉

Comparison is base (9782d9a) 50.52% compared to head (7329b97) 50.53%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2194      +/-   ##
==========================================
+ Coverage   50.52%   50.53%   +0.02%     
==========================================
  Files         386      386              
  Lines       31736    31736              
==========================================
+ Hits        16032    16036       +4     
+ Misses      15704    15700       -4     

see 5 files with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

Copy link
Contributor

@sea-bass sea-bass left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of commenting things in/out, could we maybe introduce an actual launch parameter + some IfCondition / UnlessCondition logic that toggles this more cleanly?

moveit_ros/moveit_servo/launch/servo_example.launch.py Outdated Show resolved Hide resolved
@AndyZe AndyZe requested a review from sea-bass May 22, 2023 18:05
AndyZe and others added 3 commits May 23, 2023 09:43
Co-authored-by: Sebastian Castro <4603398+sea-bass@users.noreply.github.com>
@AndyZe AndyZe requested a review from sjahr June 1, 2023 13:04
Copy link
Member

@henningkayser henningkayser left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. When are we ready to use component nodes by default? ;)

@sea-bass
Copy link
Contributor

sea-bass commented Jun 2, 2023

Looks good. When are we ready to use component nodes by default? ;)

If it works, I'd be totally fine with the default param being true. @AndyZe up to you if you wanna tweak that before merging.

@AndyZe
Copy link
Member Author

AndyZe commented Jun 2, 2023

I believe it is the default with this PR:

    launch_as_standalone_node = LaunchConfiguration(
        "launch_as_standalone_node", default="false"
    )

@AndyZe AndyZe merged commit ebe7241 into moveit:main Jun 2, 2023
8 checks passed
@AndyZe AndyZe deleted the andyz/intraprocess_servo branch June 2, 2023 15:45
@sea-bass
Copy link
Contributor

sea-bass commented Jun 2, 2023

Woops, I got my logicals mixed up. Yes, you're right :)

@sea-bass
Copy link
Contributor

Unfortunately this change actually has a bug, my apologies for not actually testing it. Turns out a component node doesn't have the ability to accept a launch condition parameter... fun

From a user on Discord,

I was following this tutorial (https://moveit.picknik.ai/main/doc/examples/realtime_servo/realtime_servo_tutorial.html#launching-a-servo-node) and after running the command:
ros2 launch moveit_servo servo_example.launch.py

I got an error:

[INFO] [launch]: Default logging verbosity is set to INFO
[ERROR] [launch]: Caught exception in launch (see debug for traceback): Caught exception when trying to load file of format [py]: ComposableNode.__init__() got an unexpected keyword argument 'condition'

Commenting out the condition argument in launch file at ~/ws_moveit/src/moveit2/moveit_ros/moveit_servo/launch/servo_example.launch.py solved my problem :

    container = launch_ros.actions.ComposableNodeContainer(
        name="moveit_servo_demo_container",
        namespace="/",
        package="rclcpp_components",
        executable="component_container_mt",
        composable_node_descriptions=[
            # Example of launching Servo as a node component
            # Launching as a node component makes ROS 2 intraprocess communication more efficient.
            launch_ros.descriptions.ComposableNode(
                package="moveit_servo",
                plugin="moveit_servo::ServoNode",
                name="servo_node",
                parameters=[
                    servo_params,
                    moveit_config.robot_description,
                    moveit_config.robot_description_semantic,
                ],
                # condition=UnlessCondition(launch_as_standalone_node), <------- Commented out(Line 98)
            ),

@sea-bass
Copy link
Contributor

Update: This actually works on Rolling, but not Humble, so I think we shouldn't do much.

See ros2/launch_ros#294 for more details.

@AndyZe
Copy link
Member Author

AndyZe commented Jun 10, 2023

Ok. I thought I had tested it before pushing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants