def generate_launch_description(): container_1 = ComposableNodeContainer( node_name='container_1', node_namespace='', package='rclcpp_components', node_executable='component_container', composable_node_descriptions=[ ComposableNode(package='hello_world_cpp', node_plugin='hello_world_cpp::Talker', node_name='talker') ], output='screen', ) container_2 = ComposableNodeContainer( node_name='container_2', node_namespace='', package='rclcpp_components', node_executable='component_container', composable_node_descriptions=[ ComposableNode(package='hello_world_cpp', node_plugin='hello_world_cpp::Listener', node_name='listener') ], output='screen', ) return launch.LaunchDescription([container_1, container_2])
def generate_launch_description(): return LaunchDescription([ # We can't include this file in a <group> tag if it declares arguments # Related issue: https://github.com/ros2/launch_ros/issues/114 # DeclareLaunchArgument( # name='approximate_sync', default_value='True', # description='Whether to use approximate synchronization of topics. Set to true if ' # 'the left and right cameras do not produce exactly synced timestamps.' # ), ComposableNodeContainer( package='rclcpp_components', node_executable='component_container', name='stereo_image_proc_container', namespace='', output='screen', composable_node_descriptions=[ ComposableNode( package='stereo_image_proc', plugin='stereo_image_proc::DisparityNode', namespace='/mycamera', parameters=[{'approximate_sync': True, 'use_sim_time': True}], remappings=[ ('right/image_rect', 'right/image_filtered'), ('left/image_rect', 'left/image_filtered'), ('left/image_rect_color', 'left/image_filtered') ] ), ComposableNode( package='stereo_image_proc', plugin='stereo_image_proc::PointCloudNode', namespace='/mycamera', parameters=[{'approximate_sync': True, 'use_sim_time': True}], remappings=[('left/image_rect_color', 'left/image_filtered')] ), ], ), ])
def generate_launch_description(): """Generate launch description with multiple components.""" container = ComposableNodeContainer( name='my_container', namespace='maila', package='rclcpp_components', executable='component_container', composable_node_descriptions=[ ComposableNode(package='i2c_server', plugin='i2c_server::I2CServer', name='custom_i2c_server'), ComposableNode(package='encoders', plugin='encoders::EncodersComponent', name='custom_encoders', parameters=[ os.path.join( get_package_share_directory('encoders'), "config", "defaults.yaml") ]) ], output='screen', emulate_tty=True, ) return launch.LaunchDescription([container])
def generate_launch_description(): default_yaml = os.path.join(get_package_share_directory('dynamic_vino_sample'), 'param', 'pipeline_composite_object_topic.yaml') container = ComposableNodeContainer( node_name='vision_pipeline', node_namespace='', package='rclcpp_components', node_executable='component_container', composable_node_descriptions=[ ComposableNode( package='realsense_ros', node_plugin='realsense::RealSenseNodeFactory', node_name='realsense', parameters=[get_package_share_directory('realsense_examples')+'/config/d435i.yaml'], extra_arguments=[{'use_intra_process_comms':'true'}]), ComposableNode( package='dynamic_vino_sample', node_plugin='ComposablePipeline', node_name='composable_pipeline', parameters=[{"config":default_yaml}], remappings=[ ('/openvino_toolkit/object/detected_objects', '/ros2_openvino_toolkit/detected_objects'), ('/openvino_toolkit/object/images', '/ros2_openvino_toolkit/image_rviz')], extra_arguments=[{'use_intra_process_comms':'true'}] ) ], output='screen', ) return launch.LaunchDescription([container])
def generate_launch_description(): """Generate launch description with multiple components.""" container = ComposableNodeContainer( node_name='my_container', node_namespace='my_namespace', package='rclcpp_components', node_executable='component_container', composable_node_descriptions=[ ComposableNode(package='demo_nodes_cpp', node_plugin='demo_nodes_cpp::Talker', node_name='talker'), ComposableNode(package='sw_watchdog', node_plugin='sw_watchdog::SimpleHeartbeat', node_name='heartbeat', parameters=[{ 'period': 200 }], extra_arguments=[{ 'use_intra_process_comms': True }]), ], output='screen') # When Shutdown is requested (launch), clean up all child processes shutdown_handler = RegisterEventHandler( OnShutdown( on_shutdown=[ # Log LogInfo(msg="heartbeat_composition was asked to shutdown."), # Clean up OpaqueFunction(function=group_stop), ], )) return launch.LaunchDescription([container, shutdown_handler])
def generate_launch_description(): """Generate launch description with multiple components.""" container = ComposableNodeContainer( name='my_container', namespace='maila', package='rclcpp_components', executable='component_container', composable_node_descriptions=[ ComposableNode( package='i2c_server', plugin='i2c_server::I2CServer', name='custom_i2c_server'), ComposableNode( package='joystick_command', plugin='motor::JoystickCommand', name='custom_joystick_command', parameters = [os.path.join(get_package_share_directory('joystick_command'),"config","defaults.yaml")]), ComposableNode( package='motors_interface', plugin='motor::MotorComponent', name='custom_motors_interface', parameters = [os.path.join(get_package_share_directory('motors_interface'),"config","defaults.yaml")]) #parameters=[{'topics.in_mode':"cucu"}]) ], output='screen', emulate_tty=True, ) return launch.LaunchDescription([container])
def generate_launch_description(): ld = LaunchDescription() component_one = ComposableNode(name='component_one', namespace='/triton', package='triton_example', plugin='triton_example::ComponentOne') component_two = ComposableNode(name='component_two', namespace='/triton', package='triton_example', plugin='triton_example::ComponentTwo') example_container = ComposableNodeContainer( name='example_container', namespace='/triton', package='rclcpp_components', executable='component_container', composable_node_descriptions=[component_one, component_two], output='screen') ld.add_action(example_container) return ld
def generate_launch_description(): producer = ComposableNode( package="intra_process", plugin="ProducerComponent", name="producer", extra_arguments=[{"use_intra_process_comms": True}], ) consumer = ComposableNode( package="intra_process", plugin="ConsumerComponent", name="consumer", extra_arguments=[{"use_intra_process_comms": True}], ) container = ComposableNodeContainer( package="rclcpp_components", namespace="/", executable='component_container_mt', name="intra_process_container", composable_node_descriptions=[producer, consumer], ) return launch.LaunchDescription([container])
def generate_launch_description(): movie = 'test.mov' camera_info_path = 'info.ini' container = ComposableNodeContainer( node_name='my_container', node_namespace='', package='rclcpp_components', node_executable='component_container', composable_node_descriptions=[ ComposableNode(package='opencv_cam', node_plugin='opencv_cam::OpencvCamNode', node_name='image_publisher', parameters=[{ 'file': False, 'filename': movie, 'camera_info_path': camera_info_path, }]), ComposableNode( package='opencv_cam', node_plugin='opencv_cam::ImageSubscriberNode', node_name='image_subscriber', ), ], output='screen', ) return launch.LaunchDescription([container])
def generate_launch_description(): """Generate launch description with multiple components.""" container = ComposableNodeContainer( package='rclcpp_components', node_name='ComponentManager', node_namespace=None, node_executable='component_container', composable_node_descriptions=[ ComposableNode( package='jetson_camera', node_plugin='jetson_camera::JetsonCameraNode', remappings=[('/image_raw', '/apriltag/image'), ('/camera_info', '/apriltag/camera_info')], ), ComposableNode( package='apriltag_ros', node_plugin='AprilTagNode', parameters=[ '../config/apriltag.yaml', ] ), ], #output='screen', ) return launch.LaunchDescription([container])
def generate_launch_description(): urdf = os.path.join(get_package_share_directory('confbot_description'), 'urdf', 'confbot.urdf') return LaunchDescription([ Node(package='robot_state_publisher', node_executable='robot_state_publisher', output='screen', arguments=[urdf]), Node(package='confbot_sensors', node_executable='confbot_laser', output='screen'), Node(package='confbot_tools', node_executable='safe_zone_publisher', output='screen'), ComposableNodeContainer( node_name='confbot_driver_container', node_namespace='', package='rclcpp_components', node_executable='component_container', composable_node_descriptions=[ ComposableNode( package='confbot_driver', node_plugin='confbot_driver::nodes::ConfbotDriver', node_name='confbot_driver'), ComposableNode( package='confbot_driver', node_plugin='confbot_driver::nodes::TwistPublisher', node_name='twist_publisher') ], output='screen', ) ])
def generate_launch_description(): """Generate launch description with multiple components.""" container = ComposableNodeContainer( name='object_tracking_container', namespace='', package='rclcpp_components', executable='component_container_mt', composable_node_descriptions=[ ComposableNode(package='raspimouse_ros2_examples', plugin='object_tracking::Tracker', name='tracker'), ComposableNode(package='raspimouse', plugin='raspimouse::Raspimouse', name='raspimouse', parameters=[{ 'use_light_sensors': False }]), ], output='screen', ) manager = Node(name='manager', package='raspimouse_ros2_examples', executable='lifecycle_node_manager', output='screen', parameters=[{ 'components': ['raspimouse', 'tracker'] }]) return launch.LaunchDescription([container, manager])
def generate_launch_description(): ld = launch.LaunchDescription() imu_driver = ComposableNode(name='driver', namespace='/tr/drivers/imu', package='phidgets_spatial', plugin='phidgets::SpatialRosI') imu_filter = ComposableNode(name='filter', namespace='/tr/drivers/imu', package='imu_filter_madgwick', plugin='ImuFilterMadgwickRos') imu_container = ComposableNodeContainer( name='imu_container', namespace='/tr/drivers/imu', package='rclcpp_components', executable='component_container', composable_node_descriptions=[imu_driver, imu_filter], output='screen') ld.add_action(imu_container) return ld
def generate_launch_description(): """Generate launch description with multiple components.""" container = ComposableNodeContainer( node_name='phidget_container', node_namespace='', package='rclcpp_components', node_executable='component_container', composable_node_descriptions=[ ComposableNode( package='phidgets_digital_inputs', node_plugin='phidgets::DigitalInputsRosI', node_name='phidgets_digital_inputs1', parameters=[{'serial':-1,'hub_port':1,'is_hub_port_device':True,'publish_rate':0}], ), ComposableNode( package='phidgets_digital_inputs', node_plugin='phidgets::DigitalInputsRosI', node_name='phidgets_digital_inputs3', parameters=[{'serial':-1,'hub_port':3,'is_hub_port_device':True,'publish_rate':0}], ), # ComposableNode( # package='phidgets_motors', # node_plugin='phidgets::MotorsRosI', # node_name='phidgets_motors', # parameters=[{'serial':-1,'hub_port':0,'braking_strength':0.0,'data_interval_ms':250,'publish_rate':0}], # ), ], output='screen', ) return launch.LaunchDescription([container])
def generate_launch_description(): composable_nodes = [ ComposableNode( package='image_proc', plugin='image_proc::DebayerNode', name='debayer_node', ), ComposableNode( package='image_proc', plugin='image_proc::RectifyNode', name='rectify_mono_node', # Remap subscribers and publishers remappings=[('image', 'image_mono'), ('camera_info', 'camera_info'), ('image_rect', 'image_rect')], ), ComposableNode( package='image_proc', plugin='image_proc::RectifyNode', name='rectify_color_node', # Remap subscribers and publishers remappings=[('image', 'image_color'), ('image_rect', 'image_rect_color')], ) ] arg_container = DeclareLaunchArgument( name='container', default_value='', description=( 'Name of an existing node container to load launched nodes into. ' 'If unset, a new container will be created.')) # If an existing container is not provided, start a container and load nodes into it image_processing_container = ComposableNodeContainer( condition=LaunchConfigurationEquals('container', ''), name='image_proc_container', namespace='', package='rclcpp_components', executable='component_container', composable_node_descriptions=composable_nodes, output='screen') # If an existing container name is provided, load composable nodes into it # This will block until a container with the provided name is available and nodes are loaded load_composable_nodes = LoadComposableNodes( condition=LaunchConfigurationNotEquals('container', ''), composable_node_descriptions=composable_nodes, target_container=LaunchConfiguration('container'), ) return LaunchDescription([ arg_container, image_processing_container, load_composable_nodes, ])
def generate_launch_description(): driver_share_dir = ament_index_python.packages.get_package_share_directory( 'velodyne_driver') driver_params_file = os.path.join( driver_share_dir, 'config', 'VLP32C-velodyne_driver_node-params.yaml') with open(driver_params_file, 'r') as f: driver_params = yaml.safe_load( f)['velodyne_driver_node']['ros__parameters'] convert_share_dir = ament_index_python.packages.get_package_share_directory( 'velodyne_pointcloud') convert_params_file = os.path.join( convert_share_dir, 'config', 'VLP32C-velodyne_convert_node-params.yaml') with open(convert_params_file, 'r') as f: convert_params = yaml.safe_load( f)['velodyne_convert_node']['ros__parameters'] convert_params['calibration'] = os.path.join(convert_share_dir, 'params', 'VeloView-VLP-32C.yaml') laserscan_share_dir = ament_index_python.packages.get_package_share_directory( 'velodyne_laserscan') laserscan_params_file = os.path.join( laserscan_share_dir, 'config', 'default-velodyne_laserscan_node-params.yaml') with open(laserscan_params_file, 'r') as f: laserscan_params = yaml.safe_load( f)['velodyne_laserscan_node']['ros__parameters'] container = ComposableNodeContainer( node_name='velodyne_container', node_namespace='', package='rclcpp_components', node_executable='component_container', composable_node_descriptions=[ ComposableNode(package='velodyne_driver', node_plugin='velodyne_driver::VelodyneDriver', node_name='velodyne_driver_node', parameters=[driver_params]), ComposableNode(package='velodyne_pointcloud', node_plugin='velodyne_pointcloud::Convert', node_name='velodyne_convert_node', parameters=[convert_params]), ComposableNode(package='velodyne_laserscan', node_plugin='velodyne_laserscan::VelodyneLaserScan', node_name='velodyne_laserscan_node', parameters=[laserscan_params]), ], output='both', ) return LaunchDescription([container])
def generate_launch_description(): log_level = 'info' camera_config = PathJoinSubstitution([ FindPackageShare("rocket_kaya_vision"), "config", "vision_pipeline_d435i.yaml", ]) depth2laser_config = PathJoinSubstitution([ FindPackageShare("rocket_kaya_vision"), "config", "vision_pipeline_depth2laser.yaml", ]) rocket_kaya_camera = ComposableNode( package="realsense2_camera", plugin='realsense2_camera::RealSenseNodeFactory', name="camera", namespace="vision", parameters=[camera_config], ) depth2laser = ComposableNode( package="depthimage_to_laserscan", plugin='depthimage_to_laserscan::DepthImageToLaserScanROS', name="depth2laser", namespace="vision", parameters=[depth2laser_config], remappings=[("/vision/depth", "/vision/aligned_depth_to_color/image_raw"), ("/vision/depth_camera_info", "/vision/aligned_depth_to_color/camera_info")], ) """Generate launch description with multiple components.""" vision_pipeline = ComposableNodeContainer( name='vision_pipeline', namespace='vision', package='rclcpp_components', executable='component_container', composable_node_descriptions=[ rocket_kaya_camera, depth2laser, ], output="both", arguments=['--ros-args', '--log-level', log_level], emulate_tty=True, ) return launch.LaunchDescription([vision_pipeline])
def getCostmapCalculatorComponent(): component = ComposableNode( package='robotx_costmap_calculator', plugin='robotx_costmap_calculator::CostmapCalculatorComponent', namespace='perception', name='costmap_calculator_node') return component
def node(self, package, executable=None, plugin=None, **node_args): ''' Add a node to the launch tree. * package -- name of the package * executable (classical node) -- name of the node within the package * plugin (inside a composition group) -- name of the composed node plugin within the package * node_args -- any other args passed to the node constructor ''' if executable is None and not self.composed: raise Exception( 'Indicate the executable name when adding a classical node') if plugin is None and self.composed: raise Exception( 'Indicate the plugin name when adding a composable node') if 'arguments' in node_args and type(node_args['arguments']) != list: if type(node_args['arguments']) == str: node_args['arguments'] = node_args['arguments'].split() else: node_args['arguments'] = [node_args['arguments']] if 'parameters' in node_args and type(node_args['parameters']) == dict: node_args['parameters'] = [node_args['parameters']] if not self.composed: self.entity( Node(package=package, executable=executable, **node_args)) else: # check plugin name - add package if needed if '::' not in plugin: plugin = '{}::{}'.format(package, plugin) self.entity( ComposableNode(package=package, plugin=plugin, **node_args))
def generate_launch_description(): ld = LaunchDescription() ################################ # Drivers ################################ usb_camera = launch_ros.actions.ComposableNodeContainer( node_name="usb_camera_driver_container", package='rclcpp_components', node_namespace=NAMESPACE, node_executable='component_container', composable_node_descriptions=[ ComposableNode(package='usb_camera_driver', node_plugin='usb_camera_driver::CameraDriver', node_name='usb_camera_driver_node', parameters=[{ "camera_calibration_file": "file:///<file-path>" }]) ], output='screen') ld.add_action(usb_camera) return ld
def generate_launch_description(): """create exposure control node.""" container = ComposableNodeContainer( name='exposure_control_container', namespace='', package='rclcpp_components', executable='component_container', composable_node_descriptions=[ ComposableNode( package='exposure_control_ros2', plugin='exposure_control_ros2::ExposureControl', name=LaunchConfig('node_name'), parameters=[{'cam_name': LaunchConfig('camera_name'), 'max_gain': 10.0, 'gain_priority': False, 'brightness_target': 100, 'max_exposure_time': 9000.0, 'min_exposure_time': 3000.0 }], remappings=[('~/meta', ['/', LaunchConfig('camera_name'),'/meta']),], extra_arguments=[{'use_intra_process_comms': True}], ), ], output='screen', ) name_arg = LaunchArg('node_name', default_value=['exposure_control'], description='name of node') cam_arg = LaunchArg('camera_name', default_value=['cam_0'], description='name of camera') return launch.LaunchDescription([name_arg, cam_arg, container])
def generate_launch_description(): """Generate launch description with multiple components.""" ros2_serial_example_directory = os.path.join( get_package_share_directory('ros2_serial_example'), 'config') param_config = os.path.join(ros2_serial_example_directory, 'default_ros2_to_serial_bridge_params.yaml') with open(param_config, 'r') as f: params = yaml.safe_load( f)['iris_0/ros2_to_serial_bridge']['ros__parameters'] print(params) container = ComposableNodeContainer( node_name='componsable_drone_node', node_namespace='/iris_0', package='rclcpp_components', node_executable='component_container', composable_node_descriptions=[ ComposableNode( node_name='ros2_to_serial_bridge', node_namespace='/iris_0', package='ros2_serial_example', node_plugin='ros2_to_serial_bridge::ROS2ToSerialBridge', parameters=[params]), ], output='screen', ) return launch.LaunchDescription([container])
def generate_launch_description(): ld = launch.LaunchDescription() pkg_name = "ros2_examples" pkg_share_path = get_package_share_directory(pkg_name) namespace = 'nmspc1' ld.add_action( ComposableNodeContainer( namespace='', name=namespace + '_publisher_example', package='rclcpp_components', executable= 'component_container_mt', # this struggles to maintain timer rates!!!!!!!!!! # executable='component_container', # this maintains the rates fine composable_node_descriptions=[ ComposableNode( package=pkg_name, plugin='ros2_examples::PublisherExample', namespace=namespace, name='publisher_example', parameters=[ pkg_share_path + '/config/publisher_example.yaml', ], remappings=[ # topics ("~/topic_out", "~/topic"), ], ), ], output='screen', )) return ld
def generate_launch_description(): localization_config = load_yaml('crs_application', 'config/localization.yaml') general_params = {'general': localization_config['general']} icp_params = {'icp': localization_config['icp']} crop_boxes_params = {'crop_boxes': localization_config['crop_boxes']} # ComposableNodeContainer not used because it fails to load parameters, using node instead container = ComposableNodeContainer( node_name='perception', node_namespace= GLOBAL_NS, #launch.substitutions.LaunchConfiguration('global_ns'), package='rclcpp_components', node_executable='component_container', composable_node_descriptions=[ ComposableNode( package='crs_perception', node_plugin='crs_perception::LocalizeToPart', node_name='part_localization', node_namespace= GLOBAL_NS, #launch.substitutions.LaunchConfiguration('global_ns')), parameters=[icp_params, crop_boxes_params]) ], output='screen') part_localization_node = Node( node_executable='localize_to_part', package='crs_perception', node_name='part_localization', node_namespace=GLOBAL_NS, output='screen', parameters=[general_params, icp_params, crop_boxes_params]) return launch.LaunchDescription([part_localization_node])
def generate_launch_description(): ld = launch.LaunchDescription() pkg_name = "ros2_examples" pkg_share_path = get_package_share_directory(pkg_name) namespace = 'nmspc1' ld.add_action( ComposableNodeContainer( namespace='', name=namespace + '_subscriber_example', package='rclcpp_components', executable='component_container_mt', composable_node_descriptions=[ ComposableNode( package=pkg_name, plugin='ros2_examples::SubscriberExample', namespace=namespace, name='subscriber_example', parameters=[ pkg_share_path + '/config/subscriber_example.yaml', ], remappings=[ # topics ("~/topic_in", "/nmspc1/publisher_example/topic"), ], ) ], output='screen', )) return ld
def generate_launch_description(): share_dir = ament_index_python.packages.get_package_share_directory( 'kobuki_safety_controller') # Passing parameters to a composed node must be done via a dictionary of # key -> value pairs. Here we read in the data from the configuration file # and create a dictionary of it that the ComposableNode will accept. params_file = os.path.join(share_dir, 'config', 'safety_controller_params.yaml') with open(params_file, 'r') as f: params = yaml.safe_load( f)['kobuki_safety_controller_node']['ros__parameters'] container = ComposableNodeContainer( node_name='safety_controller_container', node_namespace='', package='rclcpp_components', node_executable='component_container', composable_node_descriptions=[ ComposableNode( package='kobuki_safety_controller', node_plugin='kobuki_safety_controller::SafetyController', node_name='safety_controller_node', parameters=[params]), ], output='both', ) return LaunchDescription([container])
def generate_launch_description(): param_config = os.path.join( get_package_share_directory('imu_filter_madgwick'), 'config', 'imu_filter.yaml') # https://github.com/ros2/rclcpp/issues/715#issuecomment-490425249 # Composable Nodes use different yaml parsing than a standalone node. # This code will load the parameters from the yaml (removing the namespace/nodename/ros__parameters heading) so # that the parameters are parsed and named properly for the composable node. with open(param_config, 'r') as f: params = yaml.safe_load(f)['imu_filter']['ros__parameters'] container = ComposableNodeContainer( node_name='imu_filter_container', node_namespace='', package='rclcpp_components', node_executable='component_container', composable_node_descriptions=[ ComposableNode(package='imu_filter_madgwick', node_plugin='ImuFilterMadgwickRos', node_name='imu_filter', parameters=[params]) ], output='screen') return launch.LaunchDescription([container])
def generate_launch_description(): ld = launch.LaunchDescription() config = os.path.join( get_package_share_directory('triton_object_recognition'), 'config', 'tiny_yolov3.yaml') object_recognizer = ComposableNode( name='object_recognizer', namespace='/triton', package='triton_object_recognition', parameters=[config], plugin='triton_object_recognition::ObjectRecognizer') object_recognizer_container = ComposableNodeContainer( name='object_recognizer_container', namespace='/tritonimage_underwater', package='rclcpp_components', executable='component_container', composable_node_descriptions=[object_recognizer], output='screen') ld.add_action(object_recognizer_container) return ld
def generate_launch_description(): ld = launch.LaunchDescription() pkg_name = "ros2_examples" pkg_share_path = get_package_share_directory(pkg_name) namespace = 'nmspc1' ld.add_action( ComposableNodeContainer( namespace='', name=namespace + '_tf2_broadcaster_example', package='rclcpp_components', executable= 'component_container_mt', # this struggles to maintain timer rates!!!!!!!!!! # executable='component_container', # this maintains the rates fine composable_node_descriptions=[ ComposableNode( package=pkg_name, plugin='ros2_examples::Tf2BroadcasterExample', namespace=namespace, name='tf2_broadcaster_example', ), ], output='screen', )) return ld
def generate_launch_description(): ld = launch.LaunchDescription() pkg_name = "ros2_examples" pkg_share_path = get_package_share_directory(pkg_name) namespace='nmspc1' ld.add_action(ComposableNodeContainer( namespace='', name=namespace+'_service_client_example', package='rclcpp_components', executable='component_container_mt', composable_node_descriptions=[ ComposableNode( package=pkg_name, plugin='ros2_examples::ServiceClientExample', namespace=namespace, name='service_client_example', parameters=[ pkg_share_path + '/config/service_client_example.yaml', ], remappings=[ # services ("~/set_bool_out", "/nmspc1/service_server_example/set_bool"), ], ) ], output='screen', )) return ld