Skip to content

Commit 52be837

Browse files
AlexanderRexHwurzburg
authored andcommitted
dev: document PteroSim SITL simulator
1 parent e01ea8f commit 52be837

3 files changed

Lines changed: 99 additions & 0 deletions

File tree

dev/source/docs/simulation-2.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ The most commonly used simulators are:
3939
- :ref:`Replay <testing-with-replay>` has no graphical interface but allows re-running master from a dataflash log
4040
- :ref:`JSBSim <sitl-with-jsbsim>` is a sophisticated open-source plane and multicopter simulator with no graphical interface. It can be used with a wide variety of airframes.
4141
- :ref:`AirSim <sitl-with-airsim>` is an open-source, cross-platform simulator for drones & cars, built on Unreal Engine for physically and visually realistic simulations
42+
- :ref:`PteroSim <sitl-with-pterosim>` is a UAV simulator built on Unreal Engine, providing 6-DOF flight dynamics and simulated sensors
4243
- :ref:`Silent Wings Soaring<soaring-sitl-with-silentwings>`
4344
- :ref:`MATLAB and Simulink<sitl-with-MATLAB>` are numerical computing environments used for developing algorithms and plotting data developed by `MathWorks <https://www.mathworks.com/>`__.
4445
- :ref:`JSON interface<sitl-with-JSON>` The JSON interface is a generic interface protocol designed to be easy to implement for those developing physics backend. There are Python and MATLAB examples.
@@ -66,6 +67,7 @@ List of simulators (so they can appear in the menu):
6667
Replay <testing-with-replay>
6768
JSBSim <sitl-with-jsbsim>
6869
AirSim <sitl-with-airsim>
70+
PteroSim <sitl-with-pterosim>
6971
Silent Wings Soaring<soaring-sitl-with-silentwings>
7072
Last Letter <using-last_letter-as-an-external-sitl-simulator>
7173
CRRCSim <simulation-2sitl-simulator-software-in-the-loopusing-using-the-crrcsim-simulator>
Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
.. _sitl-with-pterosim:
2+
3+
========================
4+
Using SITL with PteroSim
5+
========================
6+
7+
`PteroSim <https://pterolabs.ai>`__ is a UAV simulator built on Unreal Engine 5 that can be used as a physics backend for SITL through the :ref:`JSON interface <sitl-with-JSON>`. PteroSim provides the 6-DOF flight dynamics, the visual scene and the simulated sensors, while ArduPilot runs as the flight controller.
8+
9+
.. figure:: ../images/pterosim-quadcopter.jpg
10+
:target: ../_images/pterosim-quadcopter.jpg
11+
12+
A quadcopter flown by ArduPilot SITL in PteroSim
13+
14+
PteroSim runs on Windows and Linux. It is closed source, but prebuilt binaries are published on `GitHub <https://github.com/PteroLabsAI/PteroSim-UAV-Simulator/releases>`__ and are free for personal, academic and other non-commercial use. Setup guides and the Python API reference are kept in the `PteroSim documentation <https://pterosimdocs.readthedocs.io/en/latest/>`__.
15+
16+
Supported Vehicles
17+
==================
18+
19+
The steps on this page use a quadcopter, which is included in the free tier. Helicopter, coaxial helicopter, fixed wing, quadplane VTOL and tailsitter airframes are part of the paid tiers, and all of them can be flown with ArduPilot. See `pterolabs.ai <https://pterolabs.ai/#pricing>`__ for the licensing details.
20+
21+
Simulated IMU, GPS, barometer, airspeed and camera sensors are provided for all of them, and vehicles can be spawned and controlled from a Python API.
22+
23+
Installation
24+
============
25+
26+
#. Download the archive for your platform from the `releases page <https://github.com/PteroLabsAI/PteroSim-UAV-Simulator/releases>`__ and extract it.
27+
#. Run **PteroSim.exe** on Windows or **PteroSim.sh** on Linux.
28+
29+
Setting Up the Simulator
30+
========================
31+
32+
#. Pause the simulation with the button at the top of the screen.
33+
#. Press **Spawn** in the lower left corner and drag the vehicle you want to fly into the scene.
34+
#. Set **Physics Hz** to 1000 with the slider at the top of the screen. This is the rate recommended for ArduPilot.
35+
#. Select **ArduPilot** in the control source panel on the right hand side of the screen.
36+
#. Resume the simulation.
37+
38+
PteroSim then waits for ArduPilot on UDP port 9002.
39+
40+
Starting SITL
41+
=============
42+
43+
Start SITL on the machine where ArduPilot is built, pointing the JSON backend at the machine running PteroSim:
44+
45+
.. code-block:: bash
46+
47+
sim_vehicle.py -v ArduCopter -f quad --model JSON:127.0.0.1 --console --map
48+
49+
Use ``127.0.0.1`` when SITL and PteroSim run on the same machine, otherwise use the address of the machine running PteroSim.
50+
51+
Frame parameters can be set on the command line. For example, a quadcopter in X configuration:
52+
53+
.. code-block:: bash
54+
55+
sim_vehicle.py -v ArduCopter -f quad --model JSON:127.0.0.1 -P FRAME_TYPE=1
56+
57+
Once SITL has started, the vehicle can be armed and flown from MAVProxy, or from any other ground station connected to SITL.
58+
59+
Running SITL in WSL
60+
-------------------
61+
62+
WSL2 has its own virtual network, so ``127.0.0.1`` inside WSL does not reach a simulator running on Windows. Get the address of the Windows host from WSL:
63+
64+
.. code-block:: bash
65+
66+
ip route show default
67+
68+
which prints a line such as ``default via 172.20.0.1 dev eth0``, and pass that address to SITL:
69+
70+
.. code-block:: bash
71+
72+
sim_vehicle.py -v ArduCopter -f quad --model JSON:172.20.0.1
73+
74+
The Windows firewall must allow inbound UDP traffic on the simulator port.
75+
76+
Troubleshooting
77+
===============
78+
79+
If ArduPilot keeps waiting for the simulator, check that the simulation has been started in PteroSim, that the control source of the vehicle is set to **ArduPilot**, that the address given to ``--model JSON:`` is the machine running PteroSim, and that inbound UDP traffic on the simulator port is not blocked by a firewall.
80+
81+
Videos
82+
======
83+
84+
Spawning a vehicle, connecting SITL and flying a mission from Mission Planner:
85+
86+
.. youtube:: uGROLUsJneE
87+
:width: 100%
88+
89+
An overview of the simulator:
90+
91+
.. youtube:: 8CDnchf_Ulk
92+
:width: 100%
93+
94+
Getting Help
95+
============
96+
97+
Setup guides for each vehicle type are kept in the `PteroSim documentation <https://pterosimdocs.readthedocs.io/en/latest/sitl_simulation_ardupilot.html>`__. Problems with the simulator can be reported on its `issue tracker <https://github.com/PteroLabsAI/PteroSim-UAV-Simulator/issues>`__.
186 KB
Loading

0 commit comments

Comments
 (0)