liminfo

Gazebo Reference

Free reference guide: Gazebo Reference

26 results

About Gazebo Reference

The Gazebo Reference is a quick-lookup guide for Gazebo (formerly Ignition Gazebo), the open-source 3D robotics simulator used for testing robot algorithms, designing robots, and performing hardware-in-the-loop simulations. It covers the gz command-line interface (gz sim, gz model, gz topic, gz service, gz log) for controlling simulation execution, spawning models, inspecting message topics, calling services, and recording/playing back simulation logs.

The reference documents SDF (Simulation Description Format) modeling in detail, covering the complete XML element hierarchy: <sdf> root element, <world> for environment definition, <model> for robot/entity descriptions, <link> for rigid bodies with <inertial> (mass, inertia tensor), <collision> (physics geometry with friction), and <visual> (rendering geometry). Joint definitions (<joint>) cover revolute, prismatic, and fixed types with axis limits. Sensor definitions (<sensor>) include GPU LiDAR configuration with scan parameters, range limits, and update rates.

The reference also covers essential Gazebo plugins (DiffDrive for differential drive control, JointController with PID gains, Sensors for data generation, Physics for DART/Bullet engine configuration, UserCommands, SceneBroadcaster), world settings (gravity, lighting, scene configuration, external model inclusion from Fuel), and ROS 2 integration using ros_gz_bridge for topic bridging, ros_gz_sim for launching simulations and spawning entities, and ros_gz_image for camera image bridging.

Key Features

  • Documents all gz CLI commands: gz sim (start/pause/run), gz model (list/spawn/delete), gz topic (list/echo/info), gz service (list/call), and gz log (record/playback)
  • Complete SDF modeling reference: <model>, <link>, <joint> (revolute/prismatic/fixed with axis limits), <sensor> (GPU LiDAR with scan/range parameters), <collision>, <visual>, <inertial>
  • Plugin configuration syntax for DiffDrive (wheel separation, radius, odom frequency), JointController (PID gains, force commands), and Sensors (render engine selection)
  • Physics engine setup with DART/Bullet selection, max step size, and real-time factor configuration
  • World environment settings: gravity vectors (Earth, Mars, zero-g), directional/point/spot lighting, scene ambient configuration, and Fuel model inclusion via URI
  • ROS 2 integration: ros_gz_bridge parameter_bridge with bidirectional topic mapping syntax (geometry_msgs/Twist to gz.msgs.Twist)
  • Model spawning from ROS 2 using ros_gz_sim create with position/orientation parameters and SDF file specification
  • Camera image bridging from Gazebo to ROS with ros_gz_image for sensor_msgs/Image topic publishing

Frequently Asked Questions

What Gazebo features does this reference cover?

This reference covers five main areas: Basic Commands (gz CLI for simulation control, model management, topic inspection, service calls, log recording), SDF Modeling (complete XML hierarchy for models, links, joints, sensors, collision/visual geometry, inertial properties), Plugins (DiffDrive, JointController, Sensors, Physics, UserCommands, SceneBroadcaster), World Settings (gravity, lighting, scene, external model inclusion), and ROS 2 Integration (ros_gz_bridge, ros_gz_sim, ros_gz_image).

How do I define a robot model in SDF for Gazebo?

A robot model is defined using the <model> element containing <link> elements for rigid bodies and <joint> elements for connections. Each link includes <inertial> for mass and inertia tensor, <collision> for physics geometry (box, cylinder, mesh) with surface friction properties, and <visual> for rendering geometry. Joints specify parent/child links, type (revolute, prismatic, fixed), axis direction, and position/effort limits.

What is the DiffDrive plugin and how do I configure it?

The DiffDrive plugin (gz::sim::systems::DiffDrive) controls a two-wheeled differential drive robot. Configure it by specifying left_joint and right_joint names, wheel_separation (distance between wheels), wheel_radius, and odom_publish_frequency. The plugin subscribes to Twist messages for velocity commands and publishes odometry data. It is added as a <plugin> element inside the <model> definition.

How do I set up sensors like LiDAR in Gazebo?

Add a <sensor> element with type="gpu_lidar" inside a <link>. Configure the scan parameters including horizontal samples (e.g., 640), min/max angles (e.g., -1.57 to 1.57 radians for 180 degrees), range min/max (e.g., 0.1 to 30 meters), and update_rate (e.g., 10 Hz). The Sensors system plugin must be loaded at the world level with the ogre2 render engine to enable sensor data generation.

How do I bridge Gazebo topics to ROS 2?

Use ros_gz_bridge parameter_bridge with the topic mapping syntax: /topic_name@ros_msg_type@gz_msg_type for bidirectional bridging, or [gz_msg_type for Gazebo-to-ROS only. For example, /cmd_vel@geometry_msgs/msg/Twist@gz.msgs.Twist bridges velocity commands bidirectionally, and /scan@sensor_msgs/msg/LaserScan[gz.msgs.LaserScan bridges LiDAR data from Gazebo to ROS.

What physics engines does Gazebo support?

Gazebo supports DART and Bullet physics engines, configured via the <physics> element with type="dart" or type="bullet". Key parameters include max_step_size (simulation time step, typically 0.001 seconds for 1kHz) and real_time_factor (1.0 for real-time, higher for faster-than-real-time). The Physics system plugin (gz::sim::systems::Physics) must be loaded for physics simulation to run.

How do I include external models from Gazebo Fuel?

Use the <include> element with a <uri> pointing to the Fuel model URL, such as https://fuel.gazebosim.org/1.0/OpenRobotics/models/ground_plane. You can also include local models with model:// URI scheme. Add a <pose> element within <include> to set the spawn position and orientation (x y z roll pitch yaw).

How do I spawn a robot from ROS 2 into a running Gazebo simulation?

Use ros2 run ros_gz_sim create with the -name flag for the model name, -file for the SDF file path, and -x/-y/-z for spawn position coordinates. For example: ros2 run ros_gz_sim create -name my_robot -file robot.sdf -x 1.0 -y 2.0 -z 0.5. You can also launch the entire simulation from ROS 2 using ros2 launch ros_gz_sim gz_sim.launch.py with gz_args for the world SDF file.

What are the essential system plugins needed for a basic Gazebo world?

A minimal functional world requires: Physics (gz::sim::systems::Physics) for physics simulation, UserCommands (gz::sim::systems::UserCommands) for GUI model manipulation, SceneBroadcaster (gz::sim::systems::SceneBroadcaster) for GUI visualization, and Sensors (gz::sim::systems::Sensors with ogre2 render engine) if using cameras or LiDAR. These are added as <plugin> elements inside the <world> definition.