URDF to RViZ - VTAstrobotics/Documentation GitHub Wiki
Remember that everyone owns this documentation and if you find any errors or out of date information you should fix it.
You'll need to have followed the Software Setup instructions because this page assumes that you are in the developer container!
You also need to have the output of sw2urdf
, a SolidWorks extension that converts the computer drawing of our robot into a ROS package. Likely, you'll need someone on the mechanical team to follow the instructions on the Creating an URDF Wiki. This requires a mostly complete CAD for it to be of any practical use, which usually means around October. Use a previous year's in the meantime.
As of now, there is no sw2urdf
for ROS2. Instead, we are given a ROS1 package. Luckily, there is a tool that converts it into a ROS2 package. Therefore, we begin by taking our ROS1 package and converting it to ROS2. You could also write the ROS2 package by hand if you prefer—it's not hard, but I think this is easier.
If it isn't already in the repository, clone it.
git clone https://github.com/xiaoming-sun6/sw2urdf_ros2.git
Install dependencies:
cd sw2urdf_ros2; pip3 install -r requirements.txt; cd ..
Add your ROS1 package to the container. You can drag and drop on Windows or use docker cp
on Linux.
Create the ros2 package in your src
dir:
ros2 pkg create --build-type ament_python reaper_description
In the container, in the sw2urdf_ros2
folder, run
python3 conversion_urdf_ros_2_ros2.py
to start the UI.
Once that finishes, delete sw2urdf_ros2
. If you do not do this, you will have build issues!
rm -rf sw2urdf_ros2
Assuming you have built and sourced (i.e. colcon build && source install/setup.bash
or source build_scripts/build.sh
), you'll need to launch it, using ros2 launch <pkg_name> <launchfile_name>
. For me, it's
ros2 launch reaper_description launch.py
This should open RViZ2. If you are having issues, make sure your X server is running. Refer back to the steps in Software Setup.
"Where's my robot?"
First, under Global Options->Fixed Frame
select your base_link
. On REAPER, it is named Chassis
.
Next, add your Robot Model
by selecting Add->Robot Model->OK
. Finally, tell your Robot Model
to read from your topic (Robot Model->Description Topic
and available topics should pop up. If yours doesn't check ). You should now see your URDF in RViZ!