Skip to content

Commit 32c5051

Browse files
committed
Merge branch 'master' into release_branch_2_1_0_update
2 parents 2e99e07 + bd6e853 commit 32c5051

File tree

12 files changed

+913
-355
lines changed

12 files changed

+913
-355
lines changed

docs/develop/best_practice.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ Exactly what state information you observe, and how you react to it, depends on
184184
Sleep the script when not needed
185185
================================
186186

187-
Sleeping your script appropriately can reduce the memory overhead.
187+
Sleeping your script can reduce the CPU overhead.
188188

189189
For example, at low speeds you might only need to check whether you've reached a target every few seconds.
190190
Using ``time.sleep(2)`` between checks will be more efficient than checking more often.

docs/develop/sitl_setup.rst

Lines changed: 67 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,19 @@ The `SITL (Software In The Loop) <http://dev.ardupilot.com/wiki/simulation-2/sit
88
simulator allows you to create and test DroneKit-Python apps without a real vehicle (and from the comfort of
99
your own developer desktop!).
1010

11-
SITL can run natively on Linux, Mac and Windows, or within a virtual machine. It can be
11+
SITL can run natively on Linux (x86 architecture only), Mac and Windows, or within a virtual machine. It can be
1212
installed on the same computer as DroneKit, or on another computer on the same network.
1313

1414
The sections below explain how to install and run SITL, and how to connect to DroneKit-Python and Ground
1515
Stations at the same time.
1616

1717

18+
.. _dronekit_sitl:
19+
1820
DroneKit-SITL
1921
=============
2022

21-
DroneKit-SITL is the simplest, fastest and easiest way to run SITL on Windows, Linux, or MAC OSX.
23+
DroneKit-SITL is the simplest, fastest and easiest way to run SITL on Windows, Linux (x86 architecture only), or Mac OS X.
2224
It is installed from Python's *pip* tool on all platforms, and works by downloading and running pre-built
2325
vehicle binaries that are appropriate for the host operating system.
2426

@@ -27,8 +29,12 @@ the `project on Github <https://github.com/dronekit/dronekit-sitl>`_.
2729

2830
.. note::
2931

30-
DroneKit-SITL is still relatively experimental. There are only a few pre-built vehicles and
31-
they have not been as well tested as the native builds.
32+
DroneKit-SITL is still relatively experimental and there are only a few pre-built vehicles.
33+
34+
The binaries are built and tested on Windows 10, Ubuntu Linux, and Mac OS X
35+
"El Capitan". Binaries are only available for x86 architectures. ARM builds
36+
(e.g. for RPi) are not supported.
37+
3238
Please report any issues on `Github here <https://github.com/dronekit/dronekit-sitl/issues>`_.
3339

3440
Installation
@@ -68,42 +74,38 @@ There are a number of other useful arguments:
6874
dronekit-sitl --reset #Delete all downloaded vehicle binaries.
6975
dronekit-sitl ./path [args...] #Start SITL instance at target file location.
7076
71-
72-
.. note::
73-
74-
DroneKit-SITL also `exposes a Python API <https://github.com/dronekit/dronekit-sitl#api>`_, which you can use to start simulation from within your scripts. This is particularly useful for test code!
7577
7678
7779
.. _connecting_dronekit_sitl:
7880

79-
Connecting to (DroneKit-) SITL
80-
------------------------------
81+
Connecting to DroneKit-SITL
82+
---------------------------
8183

82-
SITL waits for TCP connections on ``127.0.0.1:5760``. DroneKit-Python scripts running on the same
84+
DroneKit-SITL waits for TCP connections on ``127.0.0.1:5760``. DroneKit-Python scripts running on the same
8385
computer can connect to the simulation using the connection string as shown:
8486

8587
.. code-block:: python
8688
8789
vehicle = connect('tcp:127.0.0.1:5760', wait_ready=True)
8890
89-
If you need to connect to DroneKit-Python and a ground station at the same time you will need to
90-
`install MAVProxy <http://dronecode.github.io/MAVProxy/html/getting_started/download_and_installation.html>`_
91-
for your system.
91+
After something connects to port ``5760``, SITL will then wait for additional connections on port ``5763``
92+
(and subsequently ``5766``, ``5769`` etc.)
93+
94+
.. note::
9295

93-
Then in a second terminal you spawn an instance of *MAVProxy* to forward messages from
94-
TCP ``127.0.0.1:5760`` to UDP ports ``127.0.0.1:14550`` and ``127.0.0.1:14551`` (this is what **sim_vehicle.sh** does
95-
if you build SITL from source):
96+
While you can connect to these additional ports, some users have reported problems when
97+
viewing the running examples with *Mission Planner*. If you need to connect a ground station
98+
and DroneKit at the same time we recommend you use *MAVProxy* (see :ref:`viewing_uav_on_map`).
9699

97-
.. code-block:: bash
98100

99-
mavproxy.py --master tcp:127.0.0.1:5760 --sitl 127.0.0.1:5501 --out 127.0.0.1:14550 --out 127.0.0.1:14551
100101

101-
You can then connect to a ground station using one UDP address, and DroneKit-Python using the other.
102-
For example:
102+
.. _dronekit_sitl_api:
103103

104-
.. code-block:: python
104+
DroneKit-SITL Python API
105+
------------------------
106+
107+
DroneKit-SITL `exposes a Python API <https://github.com/dronekit/dronekit-sitl#api>`_, which you can use to start and control simulation from within your scripts. This is particularly useful for test code and :ref:`examples <example-toc>`.
105108

106-
vehicle = connect('127.0.0.1:14550', wait_ready=True)
107109

108110

109111

@@ -117,7 +119,14 @@ Building from source is useful if you want to need to test the latest changes (o
117119
a version for which DroneKit-SITL does not have pre-built binaries).
118120
It can also be useful if you have problems getting DroneKit-SITL to work.
119121

120-
The following topics from the ArduPilot wiki explain how:
122+
SITL built from source has a few differences from DroneKit-SITL:
123+
124+
* MAVProxy is included and started by default. You can use MAVProxy terminal to control the autopilot.
125+
* You connect to SITL via UDP on ``127.0.0.1:14550``. You can use MAVProxy's ``output add`` command to add additional ports if needed.
126+
* You may need to disable arming checks and load autotest parameters to run examples.
127+
* It is easier to `add a virtual rangefinder <http://dev.ardupilot.com/wiki/using-sitl-for-ardupilot-testing/#adding_a_virtual_rangefinder>`_ and `add a virtual gimbal <http://dev.ardupilot.com/wiki/using-sitl-for-ardupilot-testing/#adding_a_virtual_gimbal>`_ for testing.
128+
129+
The following topics from the ArduPilot wiki explain how to set up Native SITL builds:
121130

122131
* `Setting up SITL on Linux <http://dev.ardupilot.com/wiki/setting-up-sitl-on-linux/>`_
123132
* `Setting up SITL on Windows <http://dev.ardupilot.com/wiki/simulation-2/sitl-simulator-software-in-the-loop/sitl-native-on-windows/>`_
@@ -129,24 +138,38 @@ The following topics from the ArduPilot wiki explain how:
129138
Connecting an additional Ground Station
130139
=======================================
131140

132-
You can connect a ground station to an unused port to which messages
133-
are being forwarded. You can forward messages to additional ports
134-
when you start *MAVProxy* using the using ``-out``
135-
parameter (as shown :ref:`above <connecting_dronekit_sitl>`).
141+
You can connect a ground station to an unused port to which messages are being forwarded.
136142

137-
Alternatively, once *MAVProxy* is started you can add new output ports in the *MAVProxy* console using: ``output add``:
143+
The most reliable way to add new ports is to use *MAVProxy*:
138144

139-
.. code:: bash
145+
* If you're using SITL built from source you will already have *MAVProxy* running.
146+
You can add new ports in the MAVProxy console using ``output add``:
140147

141-
output add 127.0.0.1:14552
148+
.. code:: bash
142149
143-
.. note::
150+
output add 127.0.0.1:14552
151+
152+
* If you're using Dronekit-SITL you can:
153+
154+
* `Install MAVProxy <http://dronecode.github.io/MAVProxy/html/getting_started/download_and_installation.html>`_
155+
for your system.
156+
* In a second terminal spawn an instance of *MAVProxy* to forward messages from
157+
TCP ``127.0.0.1:5760`` to other UDP ports like ``127.0.0.1:14550`` and ``127.0.0.1:14551``:
158+
159+
.. code-block:: bash
144160
145-
Instead of the loopback address you can also specify the network IP address of your computer
146-
(On Windows you can get this by running *ipconfig* in the *Windows Command Prompt*).
161+
mavproxy.py --master tcp:127.0.0.1:5760 --sitl 127.0.0.1:5501 --out 127.0.0.1:14550 --out 127.0.0.1:14551
147162
163+
Once you have available ports you can connect to a ground station using one UDP address, and DroneKit-Python using the other.
148164

149-
Then connect Mission Planner to this UDP port:
165+
For example, first connect the script:
166+
167+
.. code-block:: python
168+
169+
vehicle = connect('127.0.0.1:14550', wait_ready=True)
170+
171+
172+
Then connect Mission Planner to the second UDP port:
150173

151174
* `Download and install Mission Planner <http://ardupilot.com/downloads/?did=82>`_
152175
* Ensure the selection list at the top right of the Mission Planner screen says *UDP* and then select the **Connect** button next to it.
@@ -159,3 +182,12 @@ Then connect Mission Planner to this UDP port:
159182

160183
After connecting, vehicle parameters will be loaded into *Mission Planner* and the vehicle is displayed on the map.
161184

185+
.. tip::
186+
187+
If you're using the :ref:`dronekit_sitl_api` then you will instead have to
188+
connect to SITLs TCP port (as there is no way to set up MAVProxy in this case).
189+
So if DroneKit is connecting to TCP port 5760, you would connect your GCS to 5763.
190+
191+
Note that a few examples may not behave perfectly using this approach. If you need to
192+
observe them in a GCS you should run SITL externally and use MAVProxy to connect to it.
193+

0 commit comments

Comments
 (0)