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

How to launch rviz2 using urdf like urdf_tutorial of ROS1.

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

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
1

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

johnconn gravatar image

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

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

Comments

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 -0600 )edit

thanks for the catch, I will edit.

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

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

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.

https://github.com/olmerg/lesson_urdf

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
2

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

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:
https://github.com/ros/urdf_tutorial/...

# Source ROS2 environment
git clone -b ros2 https://github.com/ros/urdf_tutorial.git 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 display.launch.py model:=/path/to/your/urdf

You can also copy the launch file in your package:
https://github.com/ros/urdf_tutorial/...

edit flag offensive delete link more

Comments

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 -0600 )edit
0

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

rodrigo55 gravatar image

Hi, you need to clone the lesson_urdfrepository https://github.com/olmerg/lesson_urdf 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:

https://www.youtube.com/watch?v=IfpzN...

edit flag offensive delete link more

Question Tools

1 follower

Stats

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

Seen: 8,625 times

Last updated: Apr 06 '23