Code reorganization and Drone Logic Update
This commit is contained in:
167
docs/gazebo_worlds.md
Normal file
167
docs/gazebo_worlds.md
Normal file
@@ -0,0 +1,167 @@
|
||||
# Custom Gazebo Worlds
|
||||
|
||||
Create custom environments for the ARG simulation.
|
||||
|
||||
## Quick Start
|
||||
|
||||
1. Copy template world:
|
||||
```bash
|
||||
cp gazebo/worlds/custom_landing.sdf gazebo/worlds/my_world.sdf
|
||||
```
|
||||
|
||||
2. Edit the world file
|
||||
|
||||
3. Run:
|
||||
```bash
|
||||
./scripts/run_ardupilot_sim.sh gazebo/worlds/my_world.sdf
|
||||
```
|
||||
|
||||
## World Structure
|
||||
|
||||
```xml
|
||||
<?xml version="1.0" ?>
|
||||
<sdf version="1.9">
|
||||
<world name="my_world">
|
||||
|
||||
<!-- Required plugins -->
|
||||
<plugin filename="gz-sim-physics-system" name="gz::sim::systems::Physics"/>
|
||||
<plugin filename="gz-sim-sensors-system" name="gz::sim::systems::Sensors"/>
|
||||
<plugin filename="gz-sim-user-commands-system" name="gz::sim::systems::UserCommands"/>
|
||||
<plugin filename="gz-sim-scene-broadcaster-system" name="gz::sim::systems::SceneBroadcaster"/>
|
||||
<plugin filename="gz-sim-imu-system" name="gz::sim::systems::Imu"/>
|
||||
|
||||
<!-- Physics -->
|
||||
<physics name="1ms" type="ode">
|
||||
<max_step_size>0.001</max_step_size>
|
||||
<real_time_factor>1.0</real_time_factor>
|
||||
</physics>
|
||||
|
||||
<!-- Lighting -->
|
||||
<light type="directional" name="sun">
|
||||
<pose>0 0 10 0 0 0</pose>
|
||||
<diffuse>0.8 0.8 0.8 1</diffuse>
|
||||
</light>
|
||||
|
||||
<!-- Ground -->
|
||||
<model name="ground">
|
||||
<static>true</static>
|
||||
<link name="link">
|
||||
<collision name="collision">
|
||||
<geometry><plane><normal>0 0 1</normal></plane></geometry>
|
||||
</collision>
|
||||
<visual name="visual">
|
||||
<geometry><plane><normal>0 0 1</normal><size>100 100</size></plane></geometry>
|
||||
</visual>
|
||||
</link>
|
||||
</model>
|
||||
|
||||
<!-- Your models here -->
|
||||
|
||||
<!-- ArduPilot drone (required) -->
|
||||
<include>
|
||||
<uri>model://iris_with_ardupilot</uri>
|
||||
<name>iris</name>
|
||||
<pose>0 0 0.195 0 0 0</pose>
|
||||
</include>
|
||||
|
||||
</world>
|
||||
</sdf>
|
||||
```
|
||||
|
||||
## Adding Objects
|
||||
|
||||
### Basic Shapes
|
||||
|
||||
```xml
|
||||
<model name="box">
|
||||
<static>true</static>
|
||||
<pose>5 0 0.5 0 0 0</pose>
|
||||
<link name="link">
|
||||
<collision name="collision">
|
||||
<geometry><box><size>1 1 1</size></box></geometry>
|
||||
</collision>
|
||||
<visual name="visual">
|
||||
<geometry><box><size>1 1 1</size></box></geometry>
|
||||
<material>
|
||||
<ambient>0.8 0.2 0.2 1</ambient>
|
||||
</material>
|
||||
</visual>
|
||||
</link>
|
||||
</model>
|
||||
```
|
||||
|
||||
### Cylinder
|
||||
|
||||
```xml
|
||||
<model name="cylinder">
|
||||
<static>true</static>
|
||||
<pose>0 5 1 0 0 0</pose>
|
||||
<link name="link">
|
||||
<collision name="collision">
|
||||
<geometry><cylinder><radius>0.5</radius><length>2</length></cylinder></geometry>
|
||||
</collision>
|
||||
<visual name="visual">
|
||||
<geometry><cylinder><radius>0.5</radius><length>2</length></cylinder></geometry>
|
||||
</visual>
|
||||
</link>
|
||||
</model>
|
||||
```
|
||||
|
||||
### Include Model
|
||||
|
||||
```xml
|
||||
<include>
|
||||
<uri>model://my_custom_model</uri>
|
||||
<name>obstacle_1</name>
|
||||
<pose>3 4 0 0 0 0.5</pose>
|
||||
</include>
|
||||
```
|
||||
|
||||
## Landing Pad with Rover
|
||||
|
||||
```xml
|
||||
<model name="landing_pad">
|
||||
<static>false</static>
|
||||
<pose>0 0 0.05 0 0 0</pose>
|
||||
<link name="base">
|
||||
<inertial><mass>10</mass></inertial>
|
||||
<collision name="collision">
|
||||
<geometry><cylinder><radius>0.75</radius><length>0.1</length></cylinder></geometry>
|
||||
</collision>
|
||||
<visual name="visual">
|
||||
<geometry><cylinder><radius>0.75</radius><length>0.1</length></cylinder></geometry>
|
||||
<material><diffuse>0.2 0.8 0.2 1</diffuse></material>
|
||||
</visual>
|
||||
</link>
|
||||
<plugin filename="gz-sim-velocity-control-system" name="gz::sim::systems::VelocityControl">
|
||||
<topic>/landing_pad/cmd_vel</topic>
|
||||
</plugin>
|
||||
</model>
|
||||
```
|
||||
|
||||
## Camera Sensor
|
||||
|
||||
Add to drone or create camera model:
|
||||
|
||||
```xml
|
||||
<sensor name="camera" type="camera">
|
||||
<pose>0 0 -0.1 0 1.5708 0</pose>
|
||||
<always_on>true</always_on>
|
||||
<update_rate>30</update_rate>
|
||||
<camera>
|
||||
<horizontal_fov>1.047</horizontal_fov>
|
||||
<image>
|
||||
<width>640</width>
|
||||
<height>480</height>
|
||||
</image>
|
||||
</camera>
|
||||
<topic>/drone/camera</topic>
|
||||
</sensor>
|
||||
```
|
||||
|
||||
## Tips
|
||||
|
||||
- Use `<static>true</static>` for non-moving objects
|
||||
- Pose format: `x y z roll pitch yaw`
|
||||
- Angles are in radians
|
||||
- Colors are RGBA (0-1 range)
|
||||
Reference in New Issue
Block a user