ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Revision history [back]

I rencently try to do this and actually is quite easy but you have differents steps in differents files if you are in python you need to first add your urdf files to the share directory in the data files of your setup.py

        (os.path.join('share', package_name), glob('urdf/*')),

and then you need to get the path of this file in your launch file

urdf_file_name = 'robot.urdf.xml'

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

once that done you can launch the node with this file as argument

Node(
        package='robot_state_publisher',
        node_executable='robot_state_publisher',
        name='robot_state_publisher',
        output='screen',
        arguments=[urdf])

finally you can add the topic description in you rviz file in the RobotModel plugin

    Description File: ""
    Description Source: Topic
    Description Topic: 
    Depth: 5
    Durability Policy: Volatile
    History Policy: Keep Last
    Reliability Policy: Reliable
    Value: "/robot_description"