![]() |
urdf_sim_tutorial package from urdf_sim_tutorial repourdf_sim_tutorial |
Package Summary
Tags | No category tags. |
Version | 1.0.1 |
License | BSD |
Build type | AMENT_CMAKE |
Use | RECOMMENDED |
Repository Summary
Checkout URI | https://github.com/ros/urdf_sim_tutorial.git |
VCS Type | git |
VCS Version | ros2 |
Last Updated | 2023-10-04 |
Dev Status | DEVELOPED |
CI status | No Continuous Integration |
Released | RELEASED |
Tags | No category tags. |
Contributing |
Help Wanted (0)
Good First Issues (0) Pull Requests to Review (0) |
Package Description
Additional Links
Maintainers
- David V. Lu!!
Authors
- David V. Lu!!
- Paul Bovbel
urdf_sim_tutorial
See the tutorials over at http://wiki.ros.org/urdf_tutorial
Please download the URDF simulation tutorial from github or using a package manager
sudo apt install ros-$ROS_DISTRO-urdf-sim-tutorial
Nonfunctional Gazebo Interface
We can spawn the model we already created into Gazebo using gazebo.launch.py
ros2 launch urdf_sim_tutorial gazebo.launch.py
This launch file
- Loads the urdf from the macro tutorial and publishes it as a topic (
/robot_description
) - Launches an empty Gazebo world
- Runs the script to read the urdf from the topic and spawn it in Gazebo.
- By default, the Gazebo GUI will also be displayed, and look like this:
However, it doesn’t do anything, and is missing lots of key information that ROS would need to use this robot. Previously we had been using joint_state_publisher to specify the pose of each joint. However, the robot itself should provide that information in the real world or in Gazebo. Yet without specifying that, Gazebo doesn’t know to publish that information.
To get the robot to be interactive (with you and ROS), we need to specify two things: Plugins and Transmissions.
Side note: Configuring Meshes
If you are following along at home with your own robot, or something else is amiss, the meshes may be missing from your model in the Gazebo GUI (i.e. the gripper meshes are not there). This may also cause Gazebo to take several seconds to start up after the splash screen appears because it is checking the internet for missing models.
This is because your URDF package needs to explicitly tell Gazebo where to load the meshes from. We do this by modifying the package.xml
of the package where our URDF meshes live to include a new export.
<export>
<build_type>ament_cmake</build_type>
<gazebo_ros gazebo_model_path="${prefix}/.."/>
</export>
The reasoning behind the exact value of the gazebo_model_path
attribute is a separate issue, but suffice to say, setting it to this value will work assuming
- Your mesh filenames are specified in the URDF using the
package://package_name/possible_folder/filename.ext
syntax. - The meshes are installed (via CMake) into the proper share folder.
Gazebo Plugin
To get ROS 2 to interact with Gazebo, we have to dynamically link to the ROS library that will tell Gazebo what to do. Theoretically, this allows for other Robot Operating Systems to interact with Gazebo in a generic way. In practice, its just ROS.
Specifically, Gazebo / ROS 2 interaction all happens by linking to a ROS 2 Control library, with new URDF tags.
We specify the following in the URDF, right before the closing </robot>
tag:
<ros2_control name="GazeboSystem" type="system">
<hardware>
<plugin>gazebo_ros2_control/GazeboSystem</plugin>
</hardware>
<joint name="head_swivel" />
</ros2_control>
<gazebo>
<plugin filename="libgazebo_ros2_control.so" name="gazebo_ros2_control">
<parameters>$(find urdf_sim_tutorial)/config/09a-minimal.yaml</parameters>
</plugin>
</gazebo>
Notes:
- The
<gazebo>
and<plugin>
tags work the same way they did in ROS 1. - We must specify at least one joint for the minimal example to work, but we’ll add more later.
The minimal configuration file is:
controller_manager:
ros__parameters:
update_rate: 100
You can see this in 09a-minimal.urdf.xacro and by running
ros2 launch urdf_sim_tutorial 09a-minimal.launch.py
This starts up a /controller_manager
node and with the load_controller
service, but doesn’t add any immediately useful interaction with the robot. For that we need to specify more information in the controller yaml.
Spawning Controllers
Now that we’ve linked ROS and Gazebo, we need to specify some bits of ROS code that we want to run within Gazebo, which we generically call controllers. Now we can look at a larger example based on this yaml file that specifies our first controller.
controller_manager:
ros__parameters:
update_rate: 100
use_sim_time: true
joint_state_broadcaster:
type: joint_state_broadcaster/JointStateBroadcaster
This controller is found in the joint_state_broadcaster
package and publishes the state of the robot’s joints into ROS directly from Gazebo.
In 09-joints.launch.py we also add a ros2_control
command via ExecuteProcess
to start this specific controller.
File truncated at 100 lines see the full file
Changelog for package urdf_sim_tutorial
1.0.0 (2023-10-03)
- Convert Tutorial to ROS 2 (#13)
- Contributors: David V. Lu!!
0.5.0 (2020-05-19)
- Bump CMake version to avoid CMP0048 warning #6
- Contributors: David V. Lu!!, ahcorde
0.4.0 (2018-05-09)
- Add README.md.
- 0.3.0
- Remove r2d2.xacro
- Split Control Tutorials
(#31)
- Saved Splits
- Publish Joints
- 10
- Gripper
- Diff drive
- Install Fixes (#30)
- Split Gazebo Features to New Package urdf_tutorial2
(#28)
- Move everything to subfolder
- New Package
- Rename to urdf_sim_tutorial
- Contributors: Chris Lalancette, David V. Lu, David V. Lu!!
Wiki Tutorials
Package Dependencies
Deps | Name |
---|---|
ament_cmake | |
controller_manager | |
diff_drive_controller | |
gazebo_ros | |
position_controllers | |
robot_state_publisher | |
rqt_robot_steering | |
rviz2 | |
urdf_tutorial | |
xacro |
System Dependencies
Dependant Packages
Launch files
Messages
Services
Plugins
Recent questions tagged urdf_sim_tutorial at Robotics Stack Exchange
![]() |
urdf_sim_tutorial package from urdf_sim_tutorial repourdf_sim_tutorial |
Package Summary
Tags | No category tags. |
Version | 1.0.1 |
License | BSD |
Build type | AMENT_CMAKE |
Use | RECOMMENDED |
Repository Summary
Checkout URI | https://github.com/ros/urdf_sim_tutorial.git |
VCS Type | git |
VCS Version | ros2 |
Last Updated | 2023-10-04 |
Dev Status | DEVELOPED |
CI status | No Continuous Integration |
Released | RELEASED |
Tags | No category tags. |
Contributing |
Help Wanted (0)
Good First Issues (0) Pull Requests to Review (0) |
Package Description
Additional Links
Maintainers
- David V. Lu!!
Authors
- David V. Lu!!
- Paul Bovbel
urdf_sim_tutorial
See the tutorials over at http://wiki.ros.org/urdf_tutorial
Please download the URDF simulation tutorial from github or using a package manager
sudo apt install ros-$ROS_DISTRO-urdf-sim-tutorial
Nonfunctional Gazebo Interface
We can spawn the model we already created into Gazebo using gazebo.launch.py
ros2 launch urdf_sim_tutorial gazebo.launch.py
This launch file
- Loads the urdf from the macro tutorial and publishes it as a topic (
/robot_description
) - Launches an empty Gazebo world
- Runs the script to read the urdf from the topic and spawn it in Gazebo.
- By default, the Gazebo GUI will also be displayed, and look like this:
However, it doesn’t do anything, and is missing lots of key information that ROS would need to use this robot. Previously we had been using joint_state_publisher to specify the pose of each joint. However, the robot itself should provide that information in the real world or in Gazebo. Yet without specifying that, Gazebo doesn’t know to publish that information.
To get the robot to be interactive (with you and ROS), we need to specify two things: Plugins and Transmissions.
Side note: Configuring Meshes
If you are following along at home with your own robot, or something else is amiss, the meshes may be missing from your model in the Gazebo GUI (i.e. the gripper meshes are not there). This may also cause Gazebo to take several seconds to start up after the splash screen appears because it is checking the internet for missing models.
This is because your URDF package needs to explicitly tell Gazebo where to load the meshes from. We do this by modifying the package.xml
of the package where our URDF meshes live to include a new export.
<export>
<build_type>ament_cmake</build_type>
<gazebo_ros gazebo_model_path="${prefix}/.."/>
</export>
The reasoning behind the exact value of the gazebo_model_path
attribute is a separate issue, but suffice to say, setting it to this value will work assuming
- Your mesh filenames are specified in the URDF using the
package://package_name/possible_folder/filename.ext
syntax. - The meshes are installed (via CMake) into the proper share folder.
Gazebo Plugin
To get ROS 2 to interact with Gazebo, we have to dynamically link to the ROS library that will tell Gazebo what to do. Theoretically, this allows for other Robot Operating Systems to interact with Gazebo in a generic way. In practice, its just ROS.
Specifically, Gazebo / ROS 2 interaction all happens by linking to a ROS 2 Control library, with new URDF tags.
We specify the following in the URDF, right before the closing </robot>
tag:
<ros2_control name="GazeboSystem" type="system">
<hardware>
<plugin>gazebo_ros2_control/GazeboSystem</plugin>
</hardware>
<joint name="head_swivel" />
</ros2_control>
<gazebo>
<plugin filename="libgazebo_ros2_control.so" name="gazebo_ros2_control">
<parameters>$(find urdf_sim_tutorial)/config/09a-minimal.yaml</parameters>
</plugin>
</gazebo>
Notes:
- The
<gazebo>
and<plugin>
tags work the same way they did in ROS 1. - We must specify at least one joint for the minimal example to work, but we’ll add more later.
The minimal configuration file is:
controller_manager:
ros__parameters:
update_rate: 100
You can see this in 09a-minimal.urdf.xacro and by running
ros2 launch urdf_sim_tutorial 09a-minimal.launch.py
This starts up a /controller_manager
node and with the load_controller
service, but doesn’t add any immediately useful interaction with the robot. For that we need to specify more information in the controller yaml.
Spawning Controllers
Now that we’ve linked ROS and Gazebo, we need to specify some bits of ROS code that we want to run within Gazebo, which we generically call controllers. Now we can look at a larger example based on this yaml file that specifies our first controller.
controller_manager:
ros__parameters:
update_rate: 100
use_sim_time: true
joint_state_broadcaster:
type: joint_state_broadcaster/JointStateBroadcaster
This controller is found in the joint_state_broadcaster
package and publishes the state of the robot’s joints into ROS directly from Gazebo.
In 09-joints.launch.py we also add a ros2_control
command via ExecuteProcess
to start this specific controller.
File truncated at 100 lines see the full file
Changelog for package urdf_sim_tutorial
1.0.0 (2023-10-03)
- Convert Tutorial to ROS 2 (#13)
- Contributors: David V. Lu!!
0.5.0 (2020-05-19)
- Bump CMake version to avoid CMP0048 warning #6
- Contributors: David V. Lu!!, ahcorde
0.4.0 (2018-05-09)
- Add README.md.
- 0.3.0
- Remove r2d2.xacro
- Split Control Tutorials
(#31)
- Saved Splits
- Publish Joints
- 10
- Gripper
- Diff drive
- Install Fixes (#30)
- Split Gazebo Features to New Package urdf_tutorial2
(#28)
- Move everything to subfolder
- New Package
- Rename to urdf_sim_tutorial
- Contributors: Chris Lalancette, David V. Lu, David V. Lu!!
Wiki Tutorials
Package Dependencies
Deps | Name |
---|---|
ament_cmake | |
controller_manager | |
diff_drive_controller | |
gazebo_ros | |
position_controllers | |
robot_state_publisher | |
rqt_robot_steering | |
rviz2 | |
urdf_tutorial | |
xacro |
System Dependencies
Dependant Packages
Launch files
Messages
Services
Plugins
Recent questions tagged urdf_sim_tutorial at Robotics Stack Exchange
![]() |
urdf_sim_tutorial package from urdf_sim_tutorial repourdf_sim_tutorial |
Package Summary
Tags | No category tags. |
Version | 0.6.0 |
License | BSD |
Build type | CATKIN |
Use | RECOMMENDED |
Repository Summary
Checkout URI | https://github.com/ros/urdf_sim_tutorial.git |
VCS Type | git |
VCS Version | ros1 |
Last Updated | 2025-05-14 |
Dev Status | DEVELOPED |
CI status | Continuous Integration : 0 / 0 |
Released | RELEASED |
Tags | No category tags. |
Contributing |
Help Wanted (0)
Good First Issues (0) Pull Requests to Review (0) |
Package Description
Additional Links
Maintainers
- David V. Lu!!
Authors
- David V. Lu!!
- Paul Bovbel
urdf_sim_tutorial
See the tutorials over at http://wiki.ros.org/urdf_tutorial
Changelog for package urdf_sim_tutorial
0.5.0 (2020-05-19)
- Bump CMake version to avoid CMP0048 warning #6
- Contributors: David V. Lu!!, ahcorde
0.4.0 (2018-05-09)
- Add README.md.
- 0.3.0
- Remove r2d2.xacro
- Split Control Tutorials
(#31)
- Saved Splits
- Publish Joints
- 10
- Gripper
- Diff drive
- Install Fixes (#30)
- Split Gazebo Features to New Package urdf_tutorial2
(#28)
- Move everything to subfolder
- New Package
- Rename to urdf_sim_tutorial
- Contributors: Chris Lalancette, David V. Lu, David V. Lu!!
Wiki Tutorials
Package Dependencies
Deps | Name |
---|---|
catkin | |
controller_manager | |
diff_drive_controller | |
gazebo_ros | |
gazebo_ros_control | |
joint_state_controller | |
position_controllers | |
robot_state_publisher | |
rqt_robot_steering | |
rviz | |
urdf_tutorial | |
xacro |
System Dependencies
Dependant Packages
Name | Deps |
---|---|
desktop_full |
Launch files
- launch/09-joints.launch
-
- model [default: $(find urdf_sim_tutorial)/urdf/09-publishjoints.urdf.xacro]
- rvizconfig [default: $(find urdf_tutorial)/rviz/urdf.rviz]
- launch/10-head.launch
-
- model [default: $(find urdf_sim_tutorial)/urdf/10-firsttransmission.urdf.xacro]
- rvizconfig [default: $(find urdf_tutorial)/rviz/urdf.rviz]
- launch/12-gripper.launch
-
- model [default: $(find urdf_sim_tutorial)/urdf/12-gripper.urdf.xacro]
- rvizconfig [default: $(find urdf_tutorial)/rviz/urdf.rviz]
- launch/13-diffdrive.launch
-
- model [default: $(find urdf_sim_tutorial)/urdf/13-diffdrive.urdf.xacro]
- rvizconfig [default: $(find urdf_tutorial)/rviz/urdf.rviz]
- launch/gazebo.launch
-
- paused [default: false]
- use_sim_time [default: true]
- gui [default: true]
- headless [default: false]
- debug [default: false]
- model [default: $(find urdf_tutorial)/urdf/08-macroed.urdf.xacro]
Messages
Services
Plugins
Recent questions tagged urdf_sim_tutorial at Robotics Stack Exchange
![]() |
urdf_sim_tutorial package from urdf_sim_tutorial repourdf_sim_tutorial |
Package Summary
Tags | No category tags. |
Version | 0.6.0 |
License | BSD |
Build type | CATKIN |
Use | RECOMMENDED |
Repository Summary
Checkout URI | https://github.com/ros/urdf_sim_tutorial.git |
VCS Type | git |
VCS Version | ros1 |
Last Updated | 2025-05-14 |
Dev Status | DEVELOPED |
CI status | Continuous Integration : 0 / 0 |
Released | RELEASED |
Tags | No category tags. |
Contributing |
Help Wanted (0)
Good First Issues (0) Pull Requests to Review (0) |
Package Description
Additional Links
Maintainers
- David V. Lu!!
Authors
- David V. Lu!!
- Paul Bovbel
urdf_sim_tutorial
See the tutorials over at http://wiki.ros.org/urdf_tutorial
Changelog for package urdf_sim_tutorial
0.5.0 (2020-05-19)
- Bump CMake version to avoid CMP0048 warning #6
- Contributors: David V. Lu!!, ahcorde
0.4.0 (2018-05-09)
- Add README.md.
- 0.3.0
- Remove r2d2.xacro
- Split Control Tutorials
(#31)
- Saved Splits
- Publish Joints
- 10
- Gripper
- Diff drive
- Install Fixes (#30)
- Split Gazebo Features to New Package urdf_tutorial2
(#28)
- Move everything to subfolder
- New Package
- Rename to urdf_sim_tutorial
- Contributors: Chris Lalancette, David V. Lu, David V. Lu!!
Wiki Tutorials
Package Dependencies
Deps | Name |
---|---|
catkin | |
controller_manager | |
diff_drive_controller | |
gazebo_ros | |
gazebo_ros_control | |
joint_state_controller | |
position_controllers | |
robot_state_publisher | |
rqt_robot_steering | |
rviz | |
urdf_tutorial | |
xacro |
System Dependencies
Dependant Packages
Name | Deps |
---|---|
desktop_full |
Launch files
- launch/09-joints.launch
-
- model [default: $(find urdf_sim_tutorial)/urdf/09-publishjoints.urdf.xacro]
- rvizconfig [default: $(find urdf_tutorial)/rviz/urdf.rviz]
- launch/10-head.launch
-
- model [default: $(find urdf_sim_tutorial)/urdf/10-firsttransmission.urdf.xacro]
- rvizconfig [default: $(find urdf_tutorial)/rviz/urdf.rviz]
- launch/12-gripper.launch
-
- model [default: $(find urdf_sim_tutorial)/urdf/12-gripper.urdf.xacro]
- rvizconfig [default: $(find urdf_tutorial)/rviz/urdf.rviz]
- launch/13-diffdrive.launch
-
- model [default: $(find urdf_sim_tutorial)/urdf/13-diffdrive.urdf.xacro]
- rvizconfig [default: $(find urdf_tutorial)/rviz/urdf.rviz]
- launch/gazebo.launch
-
- paused [default: false]
- use_sim_time [default: true]
- gui [default: true]
- headless [default: false]
- debug [default: false]
- model [default: $(find urdf_tutorial)/urdf/08-macroed.urdf.xacro]