def generate_launch_description():
    # Path
    nb2_launch_dir = os.path.join(
        get_package_share_directory('neuronbot2_bringup'), 'launch')
    nb2nav_launch_dir = os.path.join(
        get_package_share_directory('neuronbot2_slam'), 'launch')

    # Parameters
    open_rviz = LaunchConfiguration('open_rviz', default='True')

    neuron_app_bringup = GroupAction([
        IncludeLaunchDescription(
            PythonLaunchDescriptionSource(
                os.path.join(nb2_launch_dir, 'bringup_launch.py'))),
        IncludeLaunchDescription(PythonLaunchDescriptionSource(
            os.path.join(nb2nav_launch_dir, 'gmapping_launch.py')),
                                 launch_arguments={'open_rviz':
                                                   open_rviz}.items()),
    ])

    # Run mouse teleop
    mouse_teleop = Node(package='mouse_teleop',
                        executable='mouse_teleop',
                        remappings=[('mouse_vel', 'cmd_vel')],
                        output='screen')

    ld = LaunchDescription()
    ld.add_action(neuron_app_bringup)
    ld.add_action(mouse_teleop)
    return ld
Exemplo n.º 2
0
def test_launch_node_with_name_without_namespace():
    node = Node(
        package='demo_nodes_py',
        node_executable='listener_qos',
        node_name=TEST_NODE_NAME,
        output='screen',
    )
    ld = LaunchDescription([node])
    context = _launch(ld)
    assert get_node_name_count(context, f'{TEST_NODE_NAMESPACE}/{TEST_NODE_NAME}') == 0
    assert get_node_name_count(context, f'/{TEST_NODE_NAME}') == 1
Exemplo n.º 3
0
def test_launch_node_without_name():
    node = Node(
        package='demo_nodes_py',
        node_executable='listener_qos',
        node_namespace=TEST_NODE_NAMESPACE,
        output='screen',
    )
    ld = LaunchDescription([node])
    context = _launch(ld)
    # For Nodes, when node_name is omitted, launch_ros is unable to track it
    assert get_node_name_count(context, f'{TEST_NODE_NAMESPACE}/{TEST_NODE_NAME}') == 0
    assert get_node_name_count(context, f'/{TEST_NODE_NAME}') == 0
Exemplo n.º 4
0
def generate_launch_description():
    return LaunchDescription([
        Node(package='nav2_map_server',
             executable='map_saver_cli',
             name='map_saver_cli',
             output='screen',
             arguments=['-f',
                        str(Path.home()) + '/maps/vmegarover_samplemap'],
             parameters=[{
                 'save_map_timeout': 10000
             }]),
    ])
def generate_launch_description():

    map_saver_cli = Node(
        package='nav2_map_server',
        executable='map_saver_cli',
        parameters=[{'save_map_timeout': 10000}],
        arguments=['-f', str(Path.home())+'/neuron_app_slam/yourmap'],
        output='screen'
    )

    ld = LaunchDescription()
    ld.add_action(map_saver_cli)
    return ld
def generate_launch_description():
    # Path
    nb2_launch_dir = os.path.join(
        get_package_share_directory('neuronbot2_bringup'), 'launch')
    nb2nav_launch_dir = os.path.join(
        get_package_share_directory('neuronbot2_nav'), 'launch')
    your_map_path = str(Path.home()) + '/neuron_app_slam/yourmap.yaml'

    if not os.path.isfile(your_map_path):
        raise RuntimeError(
            '\x1b[0;37;41m' +
            'Please run Neuron APP SLAM to create your own map first.' +
            '\x1b[0m')

    # Parameters
    open_rviz = LaunchConfiguration('open_rviz', default='True')
    map_path = LaunchConfiguration('map', default=your_map_path)
    use_camera = LaunchConfiguration('use_camera', default='top')

    neuron_app_bringup = GroupAction([
        IncludeLaunchDescription(PythonLaunchDescriptionSource(
            os.path.join(nb2_launch_dir, 'bringup_launch.py')),
                                 launch_arguments={'use_camera':
                                                   use_camera}.items()),
        IncludeLaunchDescription(PythonLaunchDescriptionSource(
            os.path.join(nb2nav_launch_dir, 'bringup_launch.py')),
                                 launch_arguments={
                                     'open_rviz': open_rviz,
                                     'map': map_path
                                 }.items()),
    ])

    image_saver = Node(package='image_view',
                       executable='image_saver',
                       remappings=[('image', 'color/image_raw')],
                       parameters=[{
                           'save_all_image':
                           False,
                           'filename_format':
                           str(Path.home()) +
                           "/neuron_app_inspection/your_photo%04d.%s"
                       }],
                       output='screen')

    ld = LaunchDescription()
    ld.add_action(neuron_app_bringup)
    ld.add_action(image_saver)
    return ld
Exemplo n.º 7
0
def generate_launch_description():
    # Path
    bt_xml_dir = os.path.join(get_package_share_directory('bt_ros2'), 'bt_xml')

    # Parameters
    bt_xml = LaunchConfiguration('bt_xml',
                                 default=bt_xml_dir + '/bt_nav_mememan.xml')

    behavior_tree = Node(package='bt_ros2',
                         executable='bt_ros2',
                         parameters=[{
                             'bt_xml': bt_xml
                         }],
                         output='screen')

    ld = LaunchDescription()
    ld.add_action(behavior_tree)
    return ld
Exemplo n.º 8
0
def test_launch_nodes_with_same_names(pytestconfig):
    node1 = Node(
        package='demo_nodes_py',
        node_executable='listener_qos',
        node_name=TEST_NODE_NAME,
        node_namespace=TEST_NODE_NAMESPACE,
        output='screen',
    )

    node2 = LifecycleNode(
        package='lifecycle',
        node_executable='lifecycle_listener',
        node_name=TEST_NODE_NAME,
        node_namespace=TEST_NODE_NAMESPACE,
        output='screen',
    )

    node3 = ComposableNodeContainer(
        package='rclcpp_components',
        node_executable='component_container',
        node_name=TEST_NODE_NAME,
        node_namespace=TEST_NODE_NAMESPACE,
        composable_node_descriptions=[
            ComposableNode(
                package='composition',
                node_plugin='composition::Listener',
                node_name=TEST_NODE_NAME
            )
        ],
        output='screen'
    )

    ld = LaunchDescription([node1, node2, node3])
    context = _launch(ld)
    captured = pytestconfig.pluginmanager.getplugin('capturemanager').read_global_capture()
    assert get_node_name_count(context, f'{TEST_NODE_NAMESPACE}/{TEST_NODE_NAME}') == 3
    expected_line = f'there are now at least 3 nodes with the name {TEST_NODE_NAMESPACE}' \
        f'/{TEST_NODE_NAME} created within this launch context'
    assert expected_line in captured.out
    assert get_node_name_count(context, f'/{TEST_NODE_NAME}') == 1
Exemplo n.º 9
0
def test_launch_nodes_with_different_names():
    node1 = Node(
        package='demo_nodes_py',
        executable='listener_qos',
        node_name=f'{TEST_NODE_NAME}_1',
        node_namespace=TEST_NODE_NAMESPACE,
        output='screen',
    )

    node2 = LifecycleNode(
        package='lifecycle',
        executable='lifecycle_listener',
        node_name=f'{TEST_NODE_NAME}_2',
        node_namespace=TEST_NODE_NAMESPACE,
        output='screen',
    )

    node3 = ComposableNodeContainer(
        package='rclcpp_components',
        executable='component_container',
        node_name=f'{TEST_NODE_NAME}_3',
        node_namespace=TEST_NODE_NAMESPACE,
        composable_node_descriptions=[
            ComposableNode(
                package='composition',
                node_plugin='composition::Listener',
                node_name=f'{TEST_NODE_NAME}_4',
            )
        ],
        output='screen')

    ld = LaunchDescription([node1, node2, node3])
    context = _launch(ld)
    assert get_node_name_count(
        context, f'{TEST_NODE_NAMESPACE}/{TEST_NODE_NAME}_1') == 1
    assert get_node_name_count(
        context, f'{TEST_NODE_NAMESPACE}/{TEST_NODE_NAME}_2') == 1
    assert get_node_name_count(
        context, f'{TEST_NODE_NAMESPACE}/{TEST_NODE_NAME}_3') == 1
    assert get_node_name_count(context, f'/{TEST_NODE_NAME}_4') == 1
Exemplo n.º 10
0
def generate_launch_description():
    # Path
    gazebo_launch_dir = os.path.join(
        get_package_share_directory('neuronbot2_gazebo'), 'launch')
    nb2slam_launch_dir = os.path.join(
        get_package_share_directory('neuronbot2_slam'), 'launch')

    # Parameters
    use_sim_time = LaunchConfiguration('use_sim_time', default='True')
    open_rviz = LaunchConfiguration('open_rviz', default='True')
    ## mememan_world.model / phenix_world.model
    world_model = LaunchConfiguration('world_model',
                                      default='mememan_world.model')

    neuron_app_bringup = GroupAction([
        IncludeLaunchDescription(PythonLaunchDescriptionSource(
            os.path.join(gazebo_launch_dir, 'neuronbot2_world.launch.py')),
                                 launch_arguments={
                                     'use_sim_time': use_sim_time,
                                     'world_model': world_model
                                 }.items()),
        IncludeLaunchDescription(PythonLaunchDescriptionSource(
            os.path.join(nb2slam_launch_dir, 'gmapping_launch.py')),
                                 launch_arguments={
                                     'use_sim_time': use_sim_time,
                                     'open_rviz': open_rviz
                                 }.items()),
    ])

    # Run mouse teleop
    mouse_teleop = Node(package='mouse_teleop',
                        executable='mouse_teleop',
                        remappings=[('mouse_vel', 'cmd_vel')],
                        output='screen')

    ld = LaunchDescription()
    ld.add_action(neuron_app_bringup)
    ld.add_action(mouse_teleop)
    return ld
Exemplo n.º 11
0
def generate_launch_description():
    # Path
    gazebo_launch_dir = os.path.join(
        get_package_share_directory('neuronbot2_gazebo'), 'launch')
    nb2nav_launch_dir = os.path.join(
        get_package_share_directory('neuronbot2_nav'), 'launch')
    nb2nav_map_dir = os.path.join(
        get_package_share_directory('neuronbot2_nav'), 'map')

    # Parameters
    use_sim_time = LaunchConfiguration('use_sim_time', default='True')
    open_rviz = LaunchConfiguration('open_rviz', default='True')
    ## mememan_world.model / phenix_world.model
    world_model = LaunchConfiguration('world_model',
                                      default='mememan_world.model')
    ## mememan.yaml / phenix.yaml
    map_path = LaunchConfiguration('map',
                                   default=nb2nav_map_dir + '/mememan.yaml')
    use_camera = LaunchConfiguration('use_camera', default='top')

    gazebo_world_launch = IncludeLaunchDescription(
        PythonLaunchDescriptionSource(
            os.path.join(gazebo_launch_dir, 'neuronbot2_world.launch.py')),
        launch_arguments={
            'use_sim_time': use_sim_time,
            'world_model': world_model,
            'use_camera': use_camera
        }.items())

    navigation_launch = IncludeLaunchDescription(PythonLaunchDescriptionSource(
        os.path.join(nb2nav_launch_dir, 'bringup_launch.py')),
                                                 launch_arguments={
                                                     'use_sim_time':
                                                     use_sim_time,
                                                     'open_rviz': open_rviz,
                                                     'map': map_path
                                                 }.items())

    delayed_launch = TimerAction(
        actions=[navigation_launch],
        period=8.0  # delay 8 sec to make sure gazebo is ready
    )

    image_saver = Node(package='image_view',
                       executable='image_saver',
                       remappings=[('image', 'camera_color_frame/image_raw')],
                       parameters=[{
                           'use_sim_time':
                           True,
                           'save_all_image':
                           False,
                           'filename_format':
                           str(Path.home()) +
                           "/neuron_app_inspection/your_photo%04d.%s"
                       }],
                       output='screen')

    ld = LaunchDescription()
    ld.add_action(gazebo_world_launch)
    ld.add_action(delayed_launch)
    ld.add_action(image_saver)
    return ld