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

3 Answers

Sort by ยป oldest newest most voted

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 2019-07-15 17:19:24 -0500

johnconn gravatar image

updated 2020-02-04 11:22:57 -0500

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-11 03:55:17 -0500

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

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


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

Seen: 1,239 times

Last updated: Aug 11