Loading the lesson...
In the print dialog, choose "Save as PDF" as the destination.
Building and bridging a warehouse robot in simulation
Gazebo Classic vs Gazebo Jetty (gz-sim) differencesgz-sim plugins for control and sensorsros_gzCritical
| Feature | Classic | Jetty (New) |
|---|---|---|
| Command | gazebo | gz sim |
| Package | gazebo_ros_pkgs | ros_gz |
| Plugins | libgazebo_ros_*.so | gz-sim-*-system |
| Model path | GAZEBO_MODEL_PATH | GZ_SIM_RESOURCE_PATH |
| DiffDrive | libgazebo_ros_diff_drive.so | gz-sim-diff-drive-system |
sudo apt-get install gz-jetty
sudo apt install ros-jazzy-ros-gz # bridge + sim + image packages
# Verify
ros2 doctor
gz sim --versiongz sim shapes.sdf # GUI
gz sim -s # server only (headless)
gz sim -g # GUI only
gz sim -v 4 # verboseEntity Tree, 3D View, World Control, Transform ControlPhysics and SceneBroadcaster system plugin~/.gz/models/mobile_warehouse_robot/, not ~/.gazebo/modelsmodel.config declares name, version, and points to model.sdfmodel.sdf defines links (base, left/right wheel, caster, lidar) with inertial, visual, and collision blocks<link name="base_link">
<inertial><mass>15.0</mass>...</inertial>
<visual name="base_visual">...</visual>
<collision name="base_collision">...</collision>
</link>base_link
main body
left_wheel
revolute joint
right_wheel
revolute joint
caster
ball joint
lidar_link
fixed joint
lidar_link<sensor name="gpu_lidar" type="gpu_lidar">
<topic>lidar</topic>
<update_rate>10</update_rate>
<lidar>
<scan><horizontal><samples>640</samples>
<min_angle>-1.57</min_angle><max_angle>1.57</max_angle>
</horizontal></scan>
<range><min>0.08</min><max>10.0</max></range>
</lidar>
</sensor>base_link; the DiffDrive plugin drives them together<plugin filename="gz-sim-diff-drive-system"
name="gz::sim::systems::DiffDrive">
<left_joint>left_wheel_joint</left_joint>
<right_joint>right_wheel_joint</right_joint>
<wheel_separation>0.5</wheel_separation>
<wheel_radius>0.08</wheel_radius>
<topic>/model/warehouse_robot/cmd_vel</topic>
<odom_topic>/model/warehouse_robot/odometry</odom_topic>
</plugin>small_warehouse model plus a top-level warehouse.sdf world filePhysics, UserCommands, SceneBroadcaster, Sensors), GUI panels, lighting, ground planemodel:// URIs and placed via <include><pose>...<include>
<name>warehouse_robot</name>
<pose>-4 -4 0.1 0 0 0</pose>
<uri>model://mobile_warehouse_robot</uri>
</include>gz.msgs.*) and ROS 2 message types, defined declaratively in a bridge.yaml.ROS 2
geometry_msgs, nav_msgs...
ros_gz_bridge
bridge.yaml
Gazebo Transport
gz.msgs.*
- ros_topic_name: "/cmd_vel"
gz_topic_name: "/model/warehouse_robot/cmd_vel"
ros_type_name: "geometry_msgs/msg/Twist"
gz_type_name: "gz.msgs.Twist"
direction: ROS_TO_GZ
- ros_topic_name: "/odom"
gz_type_name: "gz.msgs.Odometry"
direction: GZ_TO_ROS/cmd_vel in, and /odom, /scan, /tf outament_python gotcha
warehouse_simulation/
├── package.xml
├── setup.py
├── launch/warehouse_simulation.launch.py
└── config/bridge.yamlsetup.py must glob() these into data_files so colcon installs themgz_sim = IncludeLaunchDescription(
PythonLaunchDescriptionSource(
os.path.join(pkg_ros_gz_sim, 'launch', 'gz_sim.launch.py')),
launch_arguments={'gz_args': f'-r {world_file}'}.items())
bridge = Node(
package='ros_gz_bridge',
executable='parameter_bridge',
arguments=['--ros-args', '-p', f'config_file:={bridge_config}'])Build
colcon build
Source
install/setup.bash
Launch
ros2 launch
Verify
ros2 topic list
colcon build --packages-select warehouse_simulation
source install/setup.bash
ros2 launch warehouse_simulation warehouse_simulation.launch.pyros2 topic list
# /cmd_vel /odom /scan /tf ...gz sim + ros_gz + gz-sim-*-system plugins) replaces Gazebo Classic entirely, do not mix tutorialsros_gz_bridge plus a YAML config is the standard way to connect Gazebo topics to ROS 2 topicsament_python packages need launch/ and config/ at the package root, wired into setup.py's data_filesMahmoud Abas|Lab: Simulating a Robot Using Gazebo Jetty and ROS 2 Jazzy