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

How to launch rviz2 using urdf like urdf_tutorial of ROS1.

asked 2019-07-14 08:17:44 -0500

sumi gravatar image

Hello. I want to make my robot arm with to use urdf on ROS2. However, I can't find lanch file like urdf_tutorial of ROS1 and use rviz from command line with urdf. I know that ROS2's launch file is writen by python but urdf_tutorial of ROS1 is written by XML file. In addition, I know ROS2'launch is beta vertion. How do I do ?

edit retag flag offensive close merge delete

4 Answers

Sort by ยป oldest newest most voted

answered 2019-07-15 17:19:24 -0500

johnconn gravatar image

updated 2023-04-06 13:45:56 -0500

130s gravatar image

The urdf tutorial of ros1 gives you a node that let's you view your urdf file, yes?

I was able to view my urdf file by running rviz2:

ros2 run rviz2 rviz2

and then adding a RobotModel plugin, and setting the Description File variable to the path to my urdf file.

Then I saved off this .rviz file and launched rviz with it in the future with the command:

ros2 run rviz2 rviz2 -d *path/to/rviz_config_file*
edit flag offensive delete link more


Just a note to the last command; it should be: ros2 run rviz2 rviz2 -d path/to/rviz_config_file ... not urdf_file.

rasmusan001 gravatar image rasmusan001  ( 2020-02-04 08:37:32 -0500 )edit

thanks for the catch, I will edit.

johnconn gravatar image johnconn  ( 2020-02-04 11:22:53 -0500 )edit

answered 2020-08-06 13:50:56 -0500

remlog gravatar image

I know that this an old question, but I make a project with a launch to run a robot arm so I put here.

This project implements a 3D planar robot in urdf. It also contain a launch with a robot_state_publisher and a joint_state_publisher_gui. It also configure the rviz with tf and robotModel plugin to view the robot.

edit flag offensive delete link more

answered 2020-08-11 03:55:17 -0500

lukicdarkoo gravatar image

The answer by @johnconn is valid, but it is missing joint_state_publisher_gui and joint_state_publisher which you may need.

Unfortunately, urdf_tutorial is not available as a Debian package, but you can install it from ros2 branch:

# Source ROS2 environment
git clone -b ros2 src/urdf_tutorial
colcon build --packages-select urdf_tutorial

# You may need to install `joint-state-publisher`
sudo apt install ros-foxy-joint-state-publisher-gui os-foxy-joint-state-publisher

And use it as:

ros2 launch urdf_tutorial model:=/path/to/your/urdf

You can also copy the launch file in your package:

edit flag offensive delete link more


I also needed to install ros-foxy-xacro package: sudo apt install ros-foxy-xacro

peterb gravatar image peterb  ( 2021-04-30 12:44:12 -0500 )edit

answered 2021-02-11 02:56:19 -0500

rodrigo55 gravatar image

Hi, you need to clone the lesson_urdfrepository into your ros2_ws and install the joint-state-publisher-gui and joint_state_publisher packages with sudo apt-get install. Also make sure you compile your environment with colcon build and source it with source ros2_ws/install/local_setup.bash. If you need a step by step instruction, I've made this video that can help:

edit flag offensive delete link more

Question Tools

1 follower


Asked: 2019-07-14 08:17:44 -0500

Seen: 6,956 times

Last updated: Apr 06