Files
RDC_Simulation/docs/gazebo.md
2026-01-01 01:08:30 +00:00

1.9 KiB

Gazebo Simulation

Running the GPS-denied drone simulation with Gazebo (Linux only).

Quick Start (2 Terminals)

Terminal 1 - Start Gazebo:

source activate.sh
gz sim gazebo/worlds/drone_landing.sdf

Terminal 2 - Run Controllers:

source activate.sh
python run_gazebo.py --pattern circular --speed 0.3

Options

python run_gazebo.py --help

Options:
  --pattern       stationary, linear, circular, square, random
  --speed, -s     Rover speed in m/s (default: 0.5)
  --amplitude, -a Movement amplitude (default: 2.0)
  --no-rover      Disable rover controller

Spawning the Drone

If the drone isn't in the world, spawn it:

gz service -s /world/drone_landing_world/create \
  --reqtype gz.msgs.EntityFactory \
  --reptype gz.msgs.Boolean \
  --req 'sdf_filename: "gazebo/models/drone/model.sdf", name: "drone"'

GPS-Denied Sensors

The run_gazebo.py script provides the same sensor interface as PyBullet:

Sensor Source
IMU Gazebo odometry
Altimeter Gazebo Z position
Velocity Gazebo twist
Camera Gazebo camera sensor
Landing Pad Computed from relative position

Gazebo Topics

Topic Type Description
/drone/cmd_vel Twist Velocity commands
/model/drone/odometry Odometry Drone state
/drone/camera Image Camera images

Headless Mode

Run without GUI:

gz sim -s gazebo/worlds/drone_landing.sdf

Troubleshooting

Model not found

Set the model path:

export GZ_SIM_RESOURCE_PATH=$PWD/gazebo/models:$GZ_SIM_RESOURCE_PATH

Drone falls immediately

Enable the velocity controller:

gz topic -t /drone/enable -m gz.msgs.Boolean -p 'data: true'

"Cannot connect to display"

Use headless mode or WSLg:

# Headless
gz sim -s gazebo/worlds/drone_landing.sdf

# Or ensure DISPLAY is set
export DISPLAY=:0