splintered-reality / py_trees_ros_tutorials

Tutorials for py_trees on ros
Other
10 stars 10 forks source link

[launch] cannot use launch_ros.get_default_launch_description #6

Closed stonier closed 5 years ago

stonier commented 5 years ago
[ERROR] [launch.LaunchService]: Caught exception in launch (see debug for traceback): Failed to init: rcl_init called on an already initialized context, at /tmp/binarydeb/ros-crystal-rcl-0.6.4/src/rcl/init.c:66

Workaround is to add everything to a normal launch description except ROSSpecificLaunchStartup().

stonier commented 5 years ago

Non-issue. If using ros2launch to launch the script, it already includes launch_ros.get_default_launch_description, so by doing the same here, it is generating it twice (and subsequently calling rclpy.init() on the global context twice.

Solution: just fire up a normal launch.LaunchDescription() if using ros2 launch, or do like the examples in launch_ros - create standalone scripts that can be run directly and include launch_ros.get_default_launch_description yourself.