예제 #1
0
def test_missing_command_raises(commands):
    """Test that a command that doesn't exist raises."""
    context = LaunchContext()
    command = Command('ros2_launch_test_command_i_m_not_a_command')
    with pytest.raises(SubstitutionFailure) as ex:
        command.perform(context)
    ex.match('file not found:')
예제 #2
0
def test_failing_command_rises(commands):
    """Test that a failing command raises."""
    context = LaunchContext()
    command = Command(commands['failing'])
    with pytest.raises(SubstitutionFailure) as ex:
        command.perform(context)
    ex.match('executed command failed. Command: .*failing_command')
예제 #3
0
def test_command_with_stderr_raises(commands):
    """Test that a command that produces stderr raises."""
    context = LaunchContext()
    command = Command(commands['with_stderr'])
    with pytest.raises(SubstitutionFailure) as ex:
        command.perform(context)
    ex.match(
        'executed command showed stderr output. Command: .*command_with_stderr'
        r'[\w\W]*asd bsd')
예제 #4
0
def generate_launch_description():

    pkg_share = launch_ros.substitutions.FindPackageShare(
        package="picar_description").find("picar_description")
    default_model_path = os.path.join(pkg_share, "urdf/steer_bot.urdf.xacro")

    viz_share = launch_ros.substitutions.FindPackageShare(
        package="pibot_viz").find("pibot_viz")
    default_rviz_config = os.path.join(viz_share,
                                       "rviz/visualize_pibot_simple.rviz")

    return LaunchDescription([
        DeclareLaunchArgument(
            "model",
            default_value=default_model_path,
            description="The urdf model file name (xacro supported)",
        ),
        Node(
            package="joint_state_publisher",
            executable="joint_state_publisher",
            name="joint_state_publisher",
            parameters=[{
                "robot_description":
                Command([
                    "xacro ",
                    LaunchConfiguration("model", ),
                ]),
            }],
        ),
        Node(
            package="robot_state_publisher",
            executable="robot_state_publisher",
            name="robot_state_publisher",
            output="screen",
            parameters=[{
                "robot_description":
                Command([
                    "xacro ",
                    LaunchConfiguration("model", ),
                ]),
            }],
        ),
        # Rviz2
        Node(
            package="rviz2",
            executable="rviz2",
            name="rviz2",
            output="screen",
            arguments=["--display-config", default_rviz_config],
        ),
    ])
예제 #5
0
def generate_launch_description():
    # Get URDF via xacro
    crane_x7_description_path = os.path.join(
        get_package_share_directory('crane_x7_description'))
    xacro_file = os.path.join(crane_x7_description_path, 'urdf',
                              'crane_x7.urdf.xacro')
    robot_description = {
        'robot_description':
        Command(['xacro ', xacro_file, ' use_gazebo:=false'])
    }

    rviz_config = os.path.join(crane_x7_description_path, 'config',
                               'display.rviz')

    return LaunchDescription([
        Node(package='robot_state_publisher',
             executable='robot_state_publisher',
             output='both',
             parameters=[robot_description]),
        Node(
            package='joint_state_publisher_gui',
            executable='joint_state_publisher_gui',
            output='screen',
        ),
        Node(package='rviz2',
             executable='rviz2',
             name='rviz2',
             output='log',
             arguments=['-d', rviz_config])
    ])
예제 #6
0
def generate_launch_description():
    return LaunchDescription([
        IncludeLaunchDescription(
            PythonLaunchDescriptionSource([
                get_package_share_directory('velodyne_driver'),
                '/launch/velodyne_driver_node-VLP16-launch.py'
            ])),
        IncludeLaunchDescription(
            PythonLaunchDescriptionSource([
                get_package_share_directory('velodyne_pointcloud'),
                '/launch/velodyne_convert_node-VLP16-launch.py'
            ])),
        Node(package='robot_state_publisher',
             executable='robot_state_publisher',
             name='robot_state_publisher',
             parameters=[{
                 'robot_description':
                 Command([
                     'xacro', ' ',
                     get_package_share_directory('AkulaPackage') +
                     '/model/akula.urdf'
                 ])
             }]),
        Node(package='BaslerROS2', executable='BaslerNode', name='Basler'),
        Node(package='akula_package',
             executable='AkulaEncoderNode',
             name='AkulaEncoders'),
        #Node(
        #    package='AkulaPackage',
        #    executable='AkulaImuNode',
        #    name='AkulaIMU'
        #)
    ])
예제 #7
0
def generate_launch_description():
    use_sim_time = LaunchConfiguration('use_sim_time', default='false')
    xacro_dir = os.path.join(
        get_package_share_directory('megarover_samples_ros2'), 'robots')
    xacro_file = os.path.join(xacro_dir, 'vmegarover.urdf.xacro')
    robot_description = {
        'robot_description': Command(['xacro', ' ', xacro_file])
    }

    return LaunchDescription([
        DeclareLaunchArgument(
            'use_sim_time',
            default_value='false',
            description='Use simulation (Gazebo) clock if true'),
        Node(package='robot_state_publisher',
             executable='robot_state_publisher',
             name='robot_state_publisher',
             output='screen',
             parameters=[{
                 'use_sim_time': use_sim_time
             }, robot_description]),
        Node(package='joint_state_publisher',
             executable='joint_state_publisher',
             name='joint_state_publisher',
             output='screen',
             parameters=[{
                 'use_sim_time': use_sim_time
             }]),
    ])
def generate_launch_description():
    share_dir = get_package_share_directory('simple') 

    xacro_file = os.path.join(share_dir, 'simple.xacro')

    rsp_params = {'robot_description': Command(['xacro',' ', xacro_file])}
    rsp = launch_ros.actions.Node(package='robot_state_publisher',
                                  executable='robot_state_publisher',
                                  output='both',
                                  parameters=[rsp_params])

    jsp_gui = launch_ros.actions.Node(
        package='joint_state_publisher_gui',
        executable='joint_state_publisher_gui',
        name='joint_state_publisher_gui')

    sp = launch_ros.actions.Node(package='simple',
                                  executable='state_publisher',
                                  output='both')

    rviz_conf_file = os.path.join(share_dir, 'simple.rviz')
    rviz = launch_ros.actions.Node(
        package='rviz2',
        executable='rviz2',
        name='rviz2',
        arguments=['-d', rviz_conf_file],
        output='screen')

    

    return launch.LaunchDescription([rsp, sp, rviz])
예제 #9
0
def generate_launch_description():
    x = LaunchConfiguration('x', default='0.0')
    y = LaunchConfiguration('y', default='0.0')
    z = LaunchConfiguration('z', default='1.0')
    urdf_file = PathJoinSubstitution(
        [FindPackageShare('rexrov2_description'), 'robots', 'rexrov2_default.xacro'])

    gazebo = ExecuteProcess(
          cmd=['gazebo', '--verbose', '-s', 'libgazebo_ros_factory.so'],
          output='screen')

    rsp = Node(
            package='robot_state_publisher',
            executable='robot_state_publisher',
            name='robot_state_publisher',
            output='screen',
            parameters=[{
                'robot_description':
                Command([
                    ExecutableInPackage(package='xacro', executable='xacro'), ' ', urdf_file
                ])
            }])

    spawn_entity = Node(
            package='gazebo_ros',
            executable='spawn_entity.py',
            arguments=[
                '-entity', 'rexrov2', '-topic', '/robot_description', '-x', x, '-y', y, '-z', z],
            output='screen')

    return LaunchDescription([
        gazebo,
        rsp,
        spawn_entity,
    ])
예제 #10
0
def generate_launch_description():

    xacro_path = os.path.join(
        get_package_share_directory('reachy_description'),
        'urdf/reachy.URDF.xacro',
    )

    rviz_config_path = os.path.join(
        get_package_share_directory('reachy_description'),
        'rviz/reachy.rviz',
    )

    return LaunchDescription([
        Node(
            package='robot_state_publisher',
            executable='robot_state_publisher',
            parameters=[{
                'robot_description': Command(['xacro ', xacro_path])
            }],
        ),
        Node(
            package='rviz2',
            executable='rviz2',
            arguments=['-d' + rviz_config_path],
        ),
    ])
예제 #11
0
def generate_launch_description():
    gazebo = IncludeLaunchDescription(
        PythonLaunchDescriptionSource(
            [FindPackageShare("gazebo_ros"), '/launch/gazebo.launch.py']),
    )

    pkg_share = FindPackageShare('pilsbot_description').find('pilsbot_description')
    urdf_dir = os.path.join(pkg_share, 'urdf')
    xacro_file = os.path.join(urdf_dir, 'pilsbot.urdf.xacro')
    robot_desc = Command('xacro {}'.format(xacro_file))

    params = {'robot_description': robot_desc,
              'use_sim_time': True}

    robot_description = Node(package='robot_state_publisher',
                             executable='robot_state_publisher',
                             output='both',
                             parameters=[params])

    spawn_entity = Node(package='gazebo_ros', executable='spawn_entity.py',
                        arguments=['-topic', '/robot_description', '-entity', 'pilsbot'],
                        output='screen')

    return LaunchDescription([
        gazebo,
        robot_description,
        spawn_entity,
    ])
예제 #12
0
def generate_launch_description():
    return LaunchDescription([
        DeclareLaunchArgument("robot_name", default_value="robot.urdf.xacro"),

        Node(
            package='robot_state_publisher',
            executable='robot_state_publisher',
            name='robot_state_publisher',
            output='screen',
            parameters=[{
                'robot_description':
                    Command([
                        'xacro',
                        ' ',
                        PathJoinSubstitution(
                            [get_package_share_directory('abb_gofa_description'),
                            'urdf',
                            LaunchConfiguration('robot_name')]
                        )
                    ]),
            }]
        ),

        Node(
            package='joint_state_publisher_gui',
            executable='joint_state_publisher_gui',
            name='joint_state_publisher',
            output='screen'
        )

    ])
def generate_launch_description():
    # Define LaunchDescription variable
    ld = LaunchDescription()

    # use:
    #  - 'zed' for "ZED" camera
    #  - 'zedm' for "ZED mini" camera
    #  - 'zed2' for "ZED2" camera
    camera_model = 'zed2'

    # Camera name
    camera_name = 'zed2'

    # URDF/xacro file to be loaded by the Robot State Publisher node
    xacro_path = os.path.join(get_package_share_directory('zed_wrapper'),
                              'urdf', 'zed_descr.urdf.xacro')

    # ZED Configurations to be loaded by ZED Node
    config_common = os.path.join(get_package_share_directory('zed_wrapper'),
                                 'config', 'common.yaml')

    config_camera = os.path.join(get_package_share_directory('zed_wrapper'),
                                 'config', camera_model + '.yaml')

    # Set LOG format
    os.environ[
        'RCUTILS_CONSOLE_OUTPUT_FORMAT'] = '{time} [{name}] [{severity}] {message}'

    # Robot State Publisher node
    rsp_node = Node(package='robot_state_publisher',
                    namespace=camera_name,
                    executable='robot_state_publisher',
                    name='zed_state_publisher',
                    output='screen',
                    parameters=[{
                        'robot_description':
                        Command([
                            'xacro', ' ', xacro_path, ' ', 'camera_name:=',
                            camera_name, ' ', 'camera_model:=', camera_model
                        ])
                    }])

    # ZED node using manual composition
    zed_node = Node(
        package='zed_rgb_convert',
        namespace=camera_name,
        executable='zed_rgb_convert',
        output='screen',
        parameters=[
            config_common,  # Common parameters
            config_camera,  # Camera related parameters
        ],
        remappings=[("zed_image_4ch", "zed_node/rgb/image_rect_color"),
                    ("camera_info", "zed_node/rgb/camera_info")])

    # Add nodes to LaunchDescription
    ld.add_action(rsp_node)
    ld.add_action(zed_node)

    return ld
def generate_launch_description():

    xacro_def_path = os.path.join(
        get_package_share_directory('maila_description'), 'urdf',
        'maila.urdf.xacro')

    use_sim_time = LaunchConfiguration('use_sim_time', default='false')
    xacro_path = LaunchConfiguration('xacro_path', default=xacro_def_path)

    use_sim_time = LaunchConfiguration('use_sim_time', default='false')

    return LaunchDescription([
        DeclareLaunchArgument(
            'use_sim_time',
            default_value='false',
            description='Use simulation (Gazebo) clock if true'),
        DeclareLaunchArgument(
            'xacro_path',
            default_value=xacro_def_path,
            description='path to urdf.xacro file to publish'),
        Node(package='robot_state_publisher',
             executable='robot_state_publisher',
             name='robot_state_publisher',
             output='screen',
             parameters=[{
                 'use_sim_time':
                 use_sim_time,
                 'robot_description':
                 Command(['xacro', ' ', xacro_path])
             }],
             arguments=[]),
        # arguments=[urdf]),
    ])
예제 #15
0
def generate_launch_description():
    # Webots
    webots = WebotsLauncher(
        #world=os.path.join(get_package_share_directory('robotis_mini_description'), 'worlds', 'ros_example.wbt')
        world=os.path.join('./worlds', 'empty.wbt'))

    # Controller node
    # synchronization = launch.substitutions.LaunchConfiguration('synchronization', default=False)
    # controller = ControllerLauncher(
    #    package='head_node',
    #    executable='head_publisher',
    #    parameters=[{'synchronization': synchronization}],
    #    output='screen'
    #)

    # urdf for state publisher
    robot_description_filename = 'robotis_mini.urdf.xacro'
    print("robot_description_filename : {}".format(robot_description_filename))
    xacro = os.path.join(
        get_package_share_directory('robotis_mini_description'), 'urdf',
        robot_description_filename)
    print("xacro : {}".format(xacro))
    use_sim_time = LaunchConfiguration('use_sim_time', default='false')
    xacro_path = LaunchConfiguration('xacro_path', default='{}'.format(xacro))
    print("xacro_path : {}".format(xacro_path))

    gui = LaunchConfiguration('gui', default='true')

    return launch.LaunchDescription([
        webots,
        DeclareLaunchArgument(
            'use_sim_time',
            default_value='false',
            description='Use simulation (Gazebo) clock if true'),
        Node(package='robot_state_publisher',
             executable='robot_state_publisher',
             name='robot_state_publisher',
             output='screen',
             parameters=[{
                 'use_sim_time':
                 use_sim_time,
                 'robot_description':
                 Command(['xacro', ' ', xacro_path])
             }]),
        Node(condition=UnlessCondition(gui),
             package='joint_state_publisher',
             executable='joint_state_publisher',
             name='joint_state_publisher',
             output='screen'),
        Node(condition=IfCondition(gui),
             package='joint_state_publisher_gui',
             executable='joint_state_publisher_gui',
             name='joint_state_publisher_gui'),
        launch.actions.
        RegisterEventHandler(event_handler=launch.event_handlers.OnProcessExit(
            target_action=webots,
            on_exit=[launch.actions.EmitEvent(event=launch.events.Shutdown())],
        )),
    ])
def generate_launch_description():
    #Spawn robot
    pkg_share_2 = FindPackageShare("robot_tennis_description").find(
        "robot_tennis_description")
    xacro_path = os.path.join(pkg_share_2, "urdf", "robot.urdf.xacro")

    robot_state_publisher_node = Node(package='robot_state_publisher',
                                      executable='robot_state_publisher',
                                      parameters=[{
                                          "robot_description":
                                          Command(["xacro", " ", xacro_path])
                                      }])
    spawn_entity = Node(package='gazebo_ros',
                        executable='spawn_entity.py',
                        arguments=[
                            '-entity', 'robot_tennis_description', '-topic',
                            'robot_description', '-x', '0', '-y', '13', '-Y',
                            '1.57'
                        ])
    #Load catcher ctrl
    catcher_ctrl_node = Node(package='catcher_control', executable='ctrl')

    detection_balles_node = Node(package="detection_balles",
                                 executable="detection_balles")
    labelisation_balles_node = Node(package="labelisation_balles",
                                    executable="labelisation")
    #localisation_aruco_node = Node(package="localisation_aruco", executable="viewer")
    localisation_gps_node = Node(package="robot_control",
                                 executable="fake_gps")
    detection_joueurs_node = Node(package="detection_joueurs",
                                  executable="detection_joueurs")
    detection_balles_cage_node = Node(package="detection_balles_cage",
                                      executable="detection_balles_cage")
    yaw_ctrl_node = Node(package="yaw_ctrl", executable="yaw_ctrl")
    fake_imu_node = Node(package="yaw_ctrl", executable="fake_imu")
    potential_field_node = Node(package="field_command",
                                executable="field_command")
    robot_control_node = Node(package="robot_control",
                              executable="rbt_control")

    return LaunchDescription([
        robot_state_publisher_node,
        spawn_entity,
        catcher_ctrl_node,
        detection_balles_node,
        labelisation_balles_node,
        #localisation_aruco_node,
        localisation_gps_node,
        detection_joueurs_node,
        detection_balles_cage_node,
        yaw_ctrl_node,
        fake_imu_node,
        potential_field_node,
        robot_control_node
    ])
예제 #17
0
def generate_launch_description():
    hexapod_path = get_package_share_path('hexapod_desc')
    default_model_path = hexapod_path / 'urdf/hexapod.urdf'
    default_rviz_config_path = hexapod_path / 'rviz/urdf.rviz'

    gui_arg = DeclareLaunchArgument(
        name='gui',
        default_value='true',
        choices=['true', 'false'],
        description='Flag to enable joint_state_publisher_gui')
    model_arg = DeclareLaunchArgument(
        name='model',
        default_value=str(default_model_path),
        description='Absolute path to robot urdf file')
    rviz_arg = DeclareLaunchArgument(
        name='rvizconfig',
        default_value=str(default_rviz_config_path),
        description='Absolute path to rviz config file')

    robot_description = ParameterValue(Command(
        ['xacro ', LaunchConfiguration('model')]),
                                       value_type=str)

    robot_state_publisher_node = Node(package='robot_state_publisher',
                                      executable='robot_state_publisher',
                                      parameters=[{
                                          'robot_description':
                                          robot_description
                                      }])

    # Depending on gui parameter, either launch joint_state_publisher or joint_state_publisher_gui
    joint_state_publisher_node = Node(package='joint_state_publisher',
                                      executable='joint_state_publisher',
                                      condition=UnlessCondition(
                                          LaunchConfiguration('gui')))

    joint_state_publisher_gui_node = Node(
        package='joint_state_publisher_gui',
        executable='joint_state_publisher_gui',
        condition=IfCondition(LaunchConfiguration('gui')))

    rviz_node = Node(
        package='rviz2',
        executable='rviz2',
        name='rviz2',
        output='screen',
        arguments=['-d', LaunchConfiguration('rvizconfig')],
    )

    return LaunchDescription([
        gui_arg, model_arg, rviz_arg, joint_state_publisher_node,
        joint_state_publisher_gui_node, robot_state_publisher_node, rviz_node
    ])
예제 #18
0
def generate_launch_description():

    robot_description_content = Command([
        PathJoinSubstitution([FindExecutable(name='xacro')]),
        " ",
        PathJoinSubstitution([
            FindPackageShare('gazebo_ros2_control_demos'), 'urdf',
            'test_gripper_mimic_joint.xacro.urdf'
        ]),
    ])
    robot_description = {"robot_description": robot_description_content}

    node_robot_state_publisher = Node(package='robot_state_publisher',
                                      executable='robot_state_publisher',
                                      output='screen',
                                      parameters=[robot_description])

    gazebo = IncludeLaunchDescription(
        PythonLaunchDescriptionSource(
            [FindPackageShare("gazebo_ros"), "/launch",
             "/gazebo.launch.py"]), )

    spawn_entity = Node(
        package='gazebo_ros',
        executable='spawn_entity.py',
        arguments=['-topic', 'robot_description', '-entity', 'gripper'],
        output='screen')

    load_joint_state_controller = ExecuteProcess(cmd=[
        'ros2', 'control', 'load_controller', '--set-state', 'start',
        'joint_state_broadcaster'
    ],
                                                 output='screen')

    load_gripper_controller = ExecuteProcess(cmd=[
        'ros2', 'control', 'load_controller', '--set-state', 'start',
        'gripper_controller'
    ],
                                             output='screen')

    return LaunchDescription([
        RegisterEventHandler(event_handler=OnProcessExit(
            target_action=spawn_entity,
            on_exit=[load_joint_state_controller],
        )),
        RegisterEventHandler(event_handler=OnProcessExit(
            target_action=load_joint_state_controller,
            on_exit=[load_gripper_controller],
        )),
        gazebo,
        node_robot_state_publisher,
        spawn_entity,
    ])
def generate_launch_description():
    gazebo = IncludeLaunchDescription(
        PythonLaunchDescriptionSource(
            [PathJoinSubstitution([FindPackageShare("gazebo_ros"), "launch", "gazebo.launch.py"])]
        ),
        launch_arguments={"verbose": "false"}.items(),
    )

    # Get URDF via xacro
    robot_description_content = Command(
        [
            PathJoinSubstitution([FindExecutable(name="xacro")]),
            " ",
            PathJoinSubstitution(
                [
                    FindPackageShare("ar3_description"),
                    "urdf",
                    "ar3_system_position_only.urdf.xacro",
                ]
            ),
            " use_sim:=true",
        ]
    )
    robot_description = {"robot_description": robot_description_content}

    node_robot_state_publisher = Node(
        package="robot_state_publisher",
        executable="robot_state_publisher",
        output="screen",
        parameters=[robot_description],
    )

    spawn_entity = Node(
        package="gazebo_ros",
        executable="spawn_entity.py",
        arguments=["-topic", "robot_description", "-entity", "ar3_system_position"],
        output="screen",
    )
    spawn_controller = Node(
        package="controller_manager",
        executable="spawner",
        arguments=["joint_state_broadcaster"],
        output="screen",
    )

    return LaunchDescription(
        [
            gazebo,
            node_robot_state_publisher,
            spawn_entity,
            spawn_controller,
        ]
    )
예제 #20
0
def generate_launch_description():
    # Initialize launch description
    launch_description = LaunchDescription()

    # Declare arguments
    launch_description.add_action(
        DeclareLaunchArgument(name='xacro_file',
                              description='Target xacro file.'))
    launch_description.add_action(
        DeclareLaunchArgument(name='rviz_config',
                              description='Rviz config file.',
                              default_value=PathJoinSubstitution([
                                  FindPackageShare('xacro_live'),
                                  'rviz/view_robot.rviz'
                              ])))

    # Add nodes
    launch_description.add_action(
        Node(package='xacro_live',
             executable='xacro_live',
             name='xacro_live',
             output='screen',
             parameters=[{
                 'xacro_file': LaunchConfiguration('xacro_file')
             }]))
    launch_description.add_action(
        Node(package='robot_state_publisher',
             executable='robot_state_publisher',
             name='robot_state_publisher',
             output='screen',
             parameters=[{
                 'robot_description':
                 Command([
                     ExecutableInPackage(package='xacro', executable='xacro'),
                     ' ',
                     LaunchConfiguration('xacro_file')
                 ])
             }]))
    launch_description.add_action(
        Node(
            package='joint_state_publisher_gui',
            executable='joint_state_publisher_gui',
            name='joint_state_publisher_gui',
            output='screen',
        ), )
    launch_description.add_action(
        Node(package='rviz2',
             executable='rviz2',
             name='rviz',
             output='screen',
             arguments=['-d', LaunchConfiguration('rviz_config')]), )

    return launch_description
예제 #21
0
def generate_launch_description():
    pkg_share = launch_ros.substitutions.FindPackageShare(
        package='sam_bot_description').find('sam_bot_description')
    default_model_path = os.path.join(
        pkg_share, 'src/description/sam_bot_description.urdf')
    default_rviz_config_path = os.path.join(pkg_share, 'rviz/urdf_config.rviz')

    robot_state_publisher_node = launch_ros.actions.Node(
        package='robot_state_publisher',
        executable='robot_state_publisher',
        parameters=[{
            'robot_description':
            Command(['xacro ', LaunchConfiguration('model')])
        }])
    joint_state_publisher_node = launch_ros.actions.Node(
        package='joint_state_publisher',
        executable='joint_state_publisher',
        name='joint_state_publisher',
        condition=launch.conditions.UnlessCondition(
            LaunchConfiguration('gui')))

    rviz_node = launch_ros.actions.Node(
        package='rviz2',
        executable='rviz2',
        name='rviz2',
        output='screen',
        arguments=['-d', LaunchConfiguration('rvizconfig')],
    )
    spawn_entity = launch_ros.actions.Node(
        package='gazebo_ros',
        executable='spawn_entity.py',
        arguments=['-entity', 'sam_bot', '-topic', 'robot_description'],
        output='screen')

    return launch.LaunchDescription([
        launch.actions.DeclareLaunchArgument(
            name='gui',
            default_value='True',
            description='Flag to enable joint_state_publisher_gui'),
        launch.actions.DeclareLaunchArgument(
            name='model',
            default_value=default_model_path,
            description='Absolute path to robot urdf file'),
        launch.actions.DeclareLaunchArgument(
            name='rvizconfig',
            default_value=default_rviz_config_path,
            description='Absolute path to rviz config file'),
        launch.actions.ExecuteProcess(
            cmd=['gazebo', '--verbose', '-s', 'libgazebo_ros_factory.so'],
            output='screen'), joint_state_publisher_node,
        robot_state_publisher_node, spawn_entity, rviz_node
    ])
def generate_launch_description():

    #robot_description_config = load_file('dsr_description2', 'urdf/' + 'm1013' + '.urdf')
    #robot_description = {'robot_description' : robot_description_config}
    #print(get_package_share_directory('dsr_description2'))

    urdf = os.path.join(get_package_share_directory('dsr_description2'),
                        'urdf')
    xacro_path = os.path.join(get_package_share_directory('dsr_description2'),
                              'xacro')

    # RViz
    rviz_config_file = get_package_share_directory(
        'dsr_description2') + "/rviz/default.rviz"
    rviz_node = Node(package='rviz2',
                     executable='rviz2',
                     name='rviz2',
                     output='log',
                     arguments=['-d', rviz_config_file])

    # Static TF
    static_tf = Node(
        package='tf2_ros',
        executable='static_transform_publisher',
        name='static_transform_publisher',
        output='log',
        arguments=['0.0', '0.0', '0.0', '0.0', '0.0', '0.0', 'base', 'base_0'])

    # Publish TF
    robot_state_publisher = Node(package='robot_state_publisher',
                                 executable='robot_state_publisher',
                                 name='robot_state_publisher',
                                 output='both',
                                 parameters=[{
                                     'robot_description':
                                     Command([
                                         'xacro', ' ', xacro_path, '/',
                                         LaunchConfiguration('model'),
                                         '.urdf.xacro color:=',
                                         LaunchConfiguration('color')
                                     ])
                                 }])

    joint_state_publisher_gui = Node(package='joint_state_publisher_gui',
                                     executable='joint_state_publisher_gui',
                                     name='joint_state_publisher_gui')

    return LaunchDescription(args + [
        static_tf, robot_state_publisher, joint_state_publisher_gui, rviz_node
    ])
예제 #23
0
def generate_launch_description():
    pkg_gazebo_ros = get_package_share_directory("gazebo_ros")
    # "warehouse.world".
    pkg_dir = get_package_share_directory('robot_description')
    os.environ["GAZEBO_MODEL_PATH"] = os.path.join(pkg_dir, "model")
    #os.environ["GAZEBO_MODEL_PATH"] = "/home/kong/dev_ws/src/robot_description/model"
    # world = os.path.join(pkg_dir, 'warehouse.world')
    world = os.path.join(pkg_dir, 'turtlebot3.world')

    gazebo = IncludeLaunchDescription(
        PythonLaunchDescriptionSource(
            os.path.join(pkg_gazebo_ros, 'launch', 'gazebo.launch.py')), )

    use_sim_time = LaunchConfiguration('use_sim_time', default='true')
    # GAZEBO_MODEL_PATH has to be correctly set for Gazebo to be able to find the model
    spawn_entity = Node(
        package='gazebo_ros',
        executable='spawn_entity.py',
        arguments=['-entity', 'demo', "-topic", "robot_description"],
        output='screen')
    #
    robot_pub = Node(
        package='robot_state_publisher',
        executable='robot_state_publisher',
        name='robot_state_publisher',
        output='screen',
        parameters=[{
            'use_sim_time': use_sim_time
        }, {
            'robot_description':
            Command([
                PathJoinSubstitution(
                    [FindPackagePrefix('xacro'), "bin", "xacro"]),
                ' ',
                PathJoinSubstitution([
                    get_package_share_directory('robot_description'),
                    'my_robot.xacro'
                ]),
            ])
        }],
    )
    # gazebo launch
    return LaunchDescription([
        DeclareLaunchArgument("world",
                              default_value=world,
                              description="world description file name"),
        gazebo,
        robot_pub,
        spawn_entity,
    ])
예제 #24
0
def generate_launch_description():
    urdf_dir = get_package_share_directory('simple')
    xacro_file = os.path.join(urdf_dir, 'simple.xacro')

    params = {'robot_description': Command(['xacro', ' ', xacro_file])}
    rsp = launch_ros.actions.Node(package='robot_state_publisher',
                                  executable='robot_state_publisher',
                                  output='both',
                                  parameters=[params])
    jsp_gui = launch_ros.actions.Node(package='joint_state_publisher_gui',
                                      executable='joint_state_publisher_gui',
                                      name='joint_state_publisher_gui')

    return launch.LaunchDescription([rsp, jsp_gui])
예제 #25
0
def generate_launch_description():
    pkg_share = launch_ros.substitutions.FindPackageShare(package='nanosaur_description').find('nanosaur_description')
    default_model_path = os.path.join(pkg_share, 'urdf/nanosaur.urdf.xml')

    robot_state_publisher_node = launch_ros.actions.Node(
        package='robot_state_publisher',
        executable='robot_state_publisher',
        parameters=[{'robot_description': Command(['xacro ', LaunchConfiguration('model')])}]
    )

    return launch.LaunchDescription([
        launch.actions.DeclareLaunchArgument(name='model', default_value=default_model_path,
                                             description='Absolute path to robot urdf file'),
        robot_state_publisher_node,
    ])
예제 #26
0
def generate_launch_description():
    return LaunchDescription([
        Node(package='robot_state_publisher',
             executable='robot_state_publisher',
             name='robot_state_publisher',
             output='screen',
             parameters=[{
                 'robot_description':
                 Command([
                     'xacro', ' ',
                     PathJoinSubstitution([
                         get_package_share_directory('abb_gofa_description'),
                         'urdf', 'robot.urdf.xacro'
                     ])
                 ]),
             }])
    ])
예제 #27
0
def generate_launch_description():

    urdf_path = PathJoinSubstitution([
        FindPackageShare('kobuki_description'), 'urdf',
        'kobuki_standalone.urdf.xacro'
    ])

    rviz_config_path = PathJoinSubstitution(
        [FindPackageShare('kobuki_description'), 'rviz', 'model.rviz'])

    return LaunchDescription([
        DeclareLaunchArgument(name='urdf',
                              default_value=urdf_path,
                              description='URDF path'),
        DeclareLaunchArgument(name='use_sim_time',
                              default_value='false',
                              description='Use simulation time'),
        DeclareLaunchArgument(name='rviz',
                              default_value='false',
                              description='Run rviz'),
        Node(package='robot_state_publisher',
             executable='robot_state_publisher',
             name='robot_state_publisher',
             output='screen',
             parameters=[{
                 'use_sim_time':
                 LaunchConfiguration('use_sim_time'),
                 'robot_description':
                 Command(['xacro ', LaunchConfiguration('urdf')])
             }]),
        Node(package='joint_state_publisher',
             executable='joint_state_publisher',
             name='joint_state_publisher',
             parameters=[{
                 'use_sim_time': LaunchConfiguration('use_sim_time')
             }]),
        Node(package='rviz2',
             executable='rviz2',
             name='rviz2',
             output='screen',
             arguments=['-d', rviz_config_path],
             condition=IfCondition(LaunchConfiguration('rviz')),
             parameters=[{
                 'use_sim_time': LaunchConfiguration('use_sim_time')
             }]),
    ])
예제 #28
0
def generate_launch_description():

    # use_sim_time = LaunchConfiguration('use_sim_time', default='false')
    urdf_file_name = 'rover.urdf'

    print("urdf_file_name : {}".format(urdf_file_name))

    urdf = os.path.join(get_package_share_directory('rover_description'),
                        'urdf', urdf_file_name)

    return LaunchDescription([
        DeclareLaunchArgument(
            'use_sim_time',
            default_value='false',
            description='Use simulation (Gazebo) clock if true'),
        DeclareLaunchArgument(
            name='gui',
            default_value='True',
            description='Flag to enable joint_state_publisher_gui'),
        DeclareLaunchArgument(name='model',
                              default_value=urdf,
                              description='Absolute path to robot urdf file'),

        # Node(
        #     package='robot_state_publisher',
        #     executable='robot_state_publisher',
        #     name='robot_state_publisher',
        #     output='screen',
        #     parameters=[{'use_sim_time': use_sim_time}],
        #     arguments=[urdf]),
        Node(package='robot_state_publisher',
             executable='robot_state_publisher',
             parameters=[{
                 'robot_description':
                 Command(['xacro ', LaunchConfiguration('model')])
             }]),
        Node(package='joint_state_publisher',
             executable='joint_state_publisher',
             name='joint_state_publisher',
             condition=launch.conditions.UnlessCondition(
                 LaunchConfiguration('gui')))
    ])
예제 #29
0
def generate_launch_description():
    pkg_share = launch_ros.substitutions.FindPackageShare(package='qbot_nodes_cpp').find('qbot_nodes_cpp')
    default_model_path = os.path.join(pkg_share, 'urdf/qbot_description.urdf')
    default_rviz_config_path = os.path.join(pkg_share, 'rviz/urdf_config.rviz')

    robot_state_publisher_node = launch_ros.actions.Node(
        package='robot_state_publisher',
        executable='robot_state_publisher',
        parameters=[{'robot_description': Command(['xacro ', LaunchConfiguration('model')])}]
    )
    joint_state_publisher_node = launch_ros.actions.Node(
        package='joint_state_publisher',
        executable='joint_state_publisher',
        name='joint_state_publisher',
        condition=launch.conditions.UnlessCondition(LaunchConfiguration('gui'))
    )
    joint_state_publisher_gui_node = launch_ros.actions.Node(
        package='joint_state_publisher_gui',
        executable='joint_state_publisher_gui',
        name='joint_state_publisher_gui',
        condition=launch.conditions.IfCondition(LaunchConfiguration('gui'))
    )
    rviz_node = launch_ros.actions.Node(
        package='rviz2',
        executable='rviz2',
        name='rviz2',
        output='screen',
        arguments=['-d', LaunchConfiguration('rvizconfig')],
    )

    return launch.LaunchDescription([
        launch.actions.DeclareLaunchArgument(name='gui', default_value='True',
                                            description='Flag to enable joint_state_publisher_gui'),
        launch.actions.DeclareLaunchArgument(name='model', default_value=default_model_path,
                                            description='Absolute path to robot urdf file'),
        launch.actions.DeclareLaunchArgument(name='rvizconfig', default_value=default_rviz_config_path,
                                            description='Absolute path to rviz config file'),
        joint_state_publisher_node,
        joint_state_publisher_gui_node,
        robot_state_publisher_node,
        rviz_node
    ])
def generate_launch_description():

    robot_description_content = Command([
        PathJoinSubstitution([FindExecutable(name="xacro")]),
        " ",
        PathJoinSubstitution([
            FindPackageShare("fusion2urdf_description"),
            "urdf",
            "fusion2urdf.xacro",
        ]),
    ])
    robot_description = {"robot_description": robot_description_content}

    return LaunchDescription([
        Node(package='robot_state_publisher',
             executable='robot_state_publisher',
             name='robot_state_publisher',
             output='screen',
             parameters=[robot_description]),
    ])