01

A physics engine, hands on

Gazebo's whole job is to fake physics well enough to be believable: gravity, friction, acceleration. Drag the sliders, drop a few objects, and watch it happen.

Gravity and friction sandbox

Interactive
Gravity 10
Bounciness 55%
Ground friction 6%
02

The trick: same topic, same message

A real IMU publishes acceleration and orientation on a topic. Gazebo publishes the exact same kind of message, on the exact same topic. Flip the switch below and watch the display on the right. It never changes, only the label on the left does.

Real hardware vs. Gazebo, feeding the same node

Interactive
REAL HARDWARE
accel: 0.00 m/s^2, tilt: 0 deg
subscribed node
rviz2 (imu display)
Reading from /imu/data
both sources publish to the same topic: /imu/data
03

Recreate any environment

Gazebo can also build the world around the robot. Paint walls and obstacles, spawn a differential-drive robot, then drive it by hand or drop a series of goal flags and let it plan and navigate to each in turn, watching its 360° laser scanner, the map it builds from that scan, and the ROS 2 messages it publishes along the way.

Build a tiny world

Interactive
Max wheel speed 4
Motor inertia 40%
Wheel base 0.50
Ground friction 6%
Lidar noise 2
Lidar beams 120
Click or drag to paint. Up/Down drive both wheels, Left/Right create a wheel speed difference (arrows or WASD, or the floating arrow pad at the bottom-right while the developer is in this section). Touching a key in Autonomous mode takes manual control. Each Add goal click drops a numbered waypoint: the robot plans with A* and tracks each path with pure pursuit, visiting the goals in order (turn Loop on to repeat).

Its simulated laser scanner (robot frame, forward is up)

/scan
Place a robot in the world above to see its scan.

The map it builds as it drives (occupancy grid)

/map
Place a robot and drive to start mapping.

Live topic inspector

ros2 topic echo
Spawn a robot to see its topics.
Differential drive in one line

Two powered wheels, no steering. Forward speed is v = (vL + vR) / 2 and turn rate is ω = (vR − vL) / wheel_base. A ROS 2 diff_drive plugin turns the /cmd_vel (v, ω) into wheel speeds, and this demo's autonomous mode does exactly that conversion.

Occupancy grid in one line

Every lidar beam says "free" for each cell it passes through and "occupied" for the cell it hits. Stack up many scans and the developer gets a nav_msgs/OccupancyGrid on /map, with 0 for free, 100 for occupied and -1 for unknown. Switch the pose source to odometry and drive into a few walls: the map smears, because the pose it is built from has drifted. That is the problem SLAM and localisation exist to solve.

04

Test in sim, deploy on the real robot

The node the developer writes does not know or care which one it is talking to. Swap the robot underneath it and the node stays exactly the same.

Same node, swap the robot

Interactive
my_navigation_node.py
unchanged
→
/scan, /odom
unchanged
→
gazebo simulation
✓ node code
✓ topic names
✓ message types
Why this matters

Build and test a node against the simulated robot with no hardware in sight. When the real robot is ready, point that same node at it. Nothing in the code changes, because the topics and message types never changed either.