# Running Gazebo with ArduPilot SITL & DroneKit

Pre-req: [Virtual Machine](/robotics/virtual-machines-virtual-box.md), [Gazebo Garden](/robotics/gazebo-garden.md), [ArduPilot](/robotics/ardupilot-and-sitl.md)

### Open first terminal (Ctrl + Alt + T) for Gazebo

```
export GZ_SIM_RESOURCE_PATH=$HOME/gz_ws/src/ardupilot_gazebo/models:$HOME/gz_ws/src/ardupilot_gazebo/worlds:$GZ_SIM_RESOURCE_PATH
```

```
export GZ_SIM_SYSTEM_PLUGIN_PATH=$HOME/gz_ws/src/ardupilot_gazebo/build:$GZ_SIM_SYSTEM_PLUGIN_PATH
```

```
gz sim -r iris_runway.sdf
```

> Note: this takes up alot of RAM and slows my computer

### Open second terminal (Ctrl + Alt + T) for ArduPilot

```
sim_vehicle.py -v ArduCopter -L Mojave -f gazebo-iris --model JSON --map --console
```

> wait for pop ups to show and for command line to say one of the following:<br>
>
> MAV>
>
> STABLIZE>

### Open third terminal (Ctrl + Alt + T) for Python Script using DroneKit

> wait for connections to establish

There are two optional scripts (aruco Script or the built in example)

### Built in example

```
cd examples/simple_goto
```

```
*edit the python file*

# comment out .argparse lines
# add the following lines:

print('Connecting to vehicle on 127.0.0.1:14450')
vehicle = connnect("127.0.0.1:14550", wait_ready=False)
print('connected')
```

```
python simple_goto.py
```

[Example Python Script](https://github.com/punkypankaj/Aruco-marker-detection-to-land-a-drone-python-script)

```
*edit the python file*

# comment out .argparse lines
# add the following lines:

print('Connecting to vehicle on 127.0.0.1:14450')
vehicle = connnect("127.0.0.1:14550", wait_ready=False)
print('connected')
```

```
cd Downloads/
python aruco_land.py
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://davids-tutorials.gitbook.io/robotics/running-gazebo-with-ardupilot-sitl-and-dronekit.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
