Skip to content

Commit 4921390

Browse files
committed
Merge pull request #547 from dronekit/hgw_dk_sitl_guided_example
Update guided example to use dronekit-sitl by default
2 parents 4e838d0 + 729dc9a commit 4921390

File tree

2 files changed

+174
-142
lines changed

2 files changed

+174
-142
lines changed

docs/examples/guided-set-speed-yaw-demo.rst

Lines changed: 127 additions & 118 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,6 @@ Running the example
3535
The example can be run as described in :doc:`running_examples` (which in turn assumes that the vehicle
3636
and DroneKit have been set up as described in :ref:`installing_dronekit`).
3737

38-
If you're using a simulated vehicle, remember to :ref:`disable arming checks <disable-arming-checks>` so
39-
that the example can run.
40-
4138
In summary, after cloning the repository:
4239

4340
#. Navigate to the example folder as shown:
@@ -47,125 +44,137 @@ In summary, after cloning the repository:
4744
cd dronekit-python/examples/guided_set_speed_yaw/
4845
4946
50-
#. Start the example, passing the :ref:`connection string <get_started_connect_string>` you wish to use in the ``--connect`` parameter:
47+
#. You can run the example against a simulator (DroneKit-SITL) by specifying the Python script without any arguments.
48+
The example will download SITL binaries if needed, start the simulator, and then connect to it:
5149

5250
.. code-block:: bash
5351
54-
python guided_set_speed_yaw.py --connect 127.0.0.1:14550
52+
python guided_set_speed_yaw.py
5553
56-
.. note::
54+
On the command prompt you should see (something like):
5755

58-
The ``--connect`` parameter above connects to SITL on udp port 127.0.0.1:14550.
59-
This is the default value for the parameter, and may be omitted.
60-
56+
.. code:: bash
57+
58+
Starting copter simulator (SITL)
59+
SITL already Downloaded.
60+
Connecting to vehicle on: tcp:127.0.0.1:5760
61+
>>> APM:Copter V3.3 (d6053245)
62+
>>> Frame: QUAD
63+
>>> Calibrating barometer
64+
>>> Initialising APM...
65+
>>> barometer calibration complete
66+
>>> GROUND START
67+
Basic pre-arm checks
68+
Waiting for vehicle to initialise...
69+
...
70+
Waiting for vehicle to initialise...
71+
Arming motors
72+
Waiting for arming...
73+
...
74+
Waiting for arming...
75+
>>> ARMING MOTORS
76+
>>> GROUND START
77+
Waiting for arming...
78+
>>> Link timeout, no heartbeat in last 5 seconds
79+
>>> ...link restored.
80+
>>> Initialising APM...
81+
Taking off!
82+
Altitude: 0.0
83+
Altitude: 0.28
84+
...
85+
Altitude: 4.76
86+
Reached target altitude
87+
TRIANGLE path using standard Vehicle.simple_goto()
88+
Set groundspeed to 5m/s.
89+
Position North 80 West 50
90+
Distance to target: 100.792763565
91+
Distance to target: 99.912599325
92+
...
93+
Distance to target: 1.21731863826
94+
Distance to target: 0.846001925791
95+
Reached target
96+
Position North 0 East 100
97+
Distance to target: 122.623210813
98+
...
99+
Distance to target: 4.75876224557
100+
Distance to target: 0.244650555031
101+
Reached target
102+
Position North -80 West 50
103+
Distance to target: 100.792430814
104+
Distance to target: 100.592652053
105+
...
106+
Distance to target: 2.48849019535
107+
Distance to target: 0.73822537077
108+
Reached target
109+
TRIANGLE path using standard SET_POSITION_TARGET_GLOBAL_INT message and with varying speed.
110+
Position South 100 West 130
111+
Set groundspeed to 5m/s.
112+
Distance to target: 188.180927131
113+
Distance to target: 186.578341133
114+
...
115+
Distance to target: 9.87090024758
116+
Distance to target: 1.4668164732
117+
Reached target
118+
Set groundspeed to 15m/s (max).
119+
Position South 0 East 200
120+
Distance to target: 318.826732298
121+
Distance to target: 320.787965033
122+
...
123+
Distance to target: 11.5626483964
124+
Distance to target: 0.335164775811
125+
Reached target
126+
Set airspeed to 10m/s (max).
127+
Position North 100 West 130
128+
Distance to target: 188.182420209
129+
Distance to target: 189.860730713
130+
...
131+
Distance to target: 10.4263414971
132+
Distance to target: 1.29857175712
133+
Reached target
134+
SQUARE path using SET_POSITION_TARGET_LOCAL_NED and position parameters
135+
North 50m, East 0m, 10m altitude for 20 seconds
136+
Point ROI at current location (home position)
137+
North 50m, East 50m, 10m altitude
138+
Point ROI at current location
139+
North 0m, East 50m, 10m altitude
140+
North 0m, East 0m, 10m altitude
141+
SQUARE path using SET_POSITION_TARGET_LOCAL_NED and velocity parameters
142+
Yaw 180 absolute (South)
143+
Velocity South & up
144+
Yaw 270 absolute (West)
145+
Velocity West & down
146+
Yaw 0 absolute (North)
147+
Velocity North
148+
Yaw 90 absolute (East)
149+
Velocity East
150+
DIAMOND path using SET_POSITION_TARGET_GLOBAL_INT and velocity parameters
151+
Yaw 225 absolute
152+
Velocity South, West and Up
153+
Yaw 90 relative (to previous yaw heading)
154+
Velocity North, West and Down
155+
Set new home location to current location
156+
Get new home location
157+
Home Location: LocationGlobal:lat=-35.363243103,lon=149.164337158,alt=593.890014648
158+
Yaw 90 relative (to previous yaw heading)
159+
Velocity North and East
160+
Yaw 90 relative (to previous yaw heading)
161+
Velocity South and East
162+
Setting LAND mode...
163+
Close vehicle object
164+
Completed
165+
166+
.. tip::
167+
168+
It is more interesting to watch the example run on a map than the console. The topic :ref:`viewing_uav_on_map`
169+
explains how to set up *Mission Planner* to view a vehicle running on the simulator (SITL).
61170

62-
.. tip::
63-
64-
It is more interesting to watch the example above on a map than the console. The topic :ref:`viewing_uav_on_map`
65-
explains how to set up *Mission Planner* to view a vehicle running on the simulator (SITL).
66-
67-
On the command prompt you should see (something like):
68-
69-
70-
.. code-block:: bash
71-
72-
Basic pre-arm checks
73-
Arming motors
74-
Waiting for arming...
75-
Waiting for arming...
76-
Taking off!
77-
Altitude: 0.00999999977648
78-
Altitude: 0.159999996424
79-
Altitude: 0.920000016689
80-
Altitude: 2.38000011444
81-
Altitude: 3.93000006676
82-
Altitude: 4.65000009537
83-
Altitude: 4.82999992371
84-
Reached target altitude
85-
86-
TRIANGLE path using standard Vehicle.simple_goto()
87-
Position North 80 West 50
88-
Distance to target: 100.792762965
89-
Distance to target: 100.25918006
90-
...
91-
Distance to target: 2.34237912414
92-
Distance to target: 0.308823685384
93-
Reached target
94-
Position North 0 East 100
95-
Distance to target: 122.62321461
96-
...
97-
Distance to target: 5.39403923852
98-
Distance to target: 1.00445126117
99-
Reached target
100-
Position North -80 West 50
101-
goto_target_globalint_position
102-
Distance to target: 100.792430952
103-
Distance to target: 100.221083739
104-
...
105-
Distance to target: 1.69678155659
106-
Distance to target: 0.0798488767383
107-
Reached target
108-
109-
TRIANGLE path using standard SET_POSITION_TARGET_GLOBAL_INT message and with varying speed.
110-
Position South 100 West 130
111-
Set speed to 5m/s.
112-
Distance to target: 181.439594672
113-
Distance to target: 132.170351744
114-
...
115-
Distance to target: 2.67615248028
116-
Distance to target: 0.382959594982
117-
Reached target
118-
Set speed to 15m/s (max).
119-
Position South 0 East 200
120-
Distance to target: 318.826739407
121-
Distance to target: 317.613357051
122-
...
123-
Distance to target: 3.5935761745
124-
Distance to target: 0.114090613451
125-
Reached target
126-
Set speed to 10m/s (max).
127-
Position North 100 West 130
128-
goto_target_globalint_position
129-
Distance to target: 188.182423388
130-
Distance to target: 187.540272979
131-
...
132-
Distance to target: 4.82317050152
133-
Distance to target: 0.377390539948
134-
Reached target
135-
136-
SQUARE path using SET_POSITION_TARGET_LOCAL_NED and position parameters
137-
North 50m, East 0m, 10m altitude for 20 seconds
138-
Point ROI at current location (home position)
139-
North 50m, East 50m, 10m altitude
140-
Point ROI at current location
141-
North 0m, East 50m, 10m altitude
142-
North 0m, East 0m, 10m altitude
143-
144-
SQUARE path using SET_POSITION_TARGET_LOCAL_NED and velocity parameters
145-
Velocity South & up
146-
Yaw 180 absolute (South)
147-
Velocity West & down
148-
Yaw 270 absolute (West)
149-
Velocity North
150-
Yaw 0 absolute (North)
151-
Velocity East
152-
153-
DIAMOND path using SET_POSITION_TARGET_GLOBAL_INT and velocity parameters
154-
Velocity North, East and up
155-
Yaw 225 absolute
156-
Velocity South, East and down
157-
Yaw 90 relative (to previous yaw heading)
158-
Set new Home location to current location
159-
Get new home location
160-
Home Location: LocationGlobal:lat=-35.3639335632,lon=149.165328979,alt=628.679992676,is_relative=False
161-
Velocity South and West
162-
Yaw 90 relative (to previous yaw heading)
163-
Velocity North and West
164-
Yaw 90 relative (to previous yaw heading)
165-
166-
Setting LAND mode...
167-
Close vehicle object
168-
Completed
171+
#. You can run the example against a specific connection (simulated or otherwise) by passing the :ref:`connection string <get_started_connect_string>` for your vehicle in the ``--connect`` parameter.
172+
173+
For example, to connect to SITL running on UDP port 14550 on your local computer:
174+
175+
.. code-block:: bash
176+
177+
python guided_set_speed_yaw.py --connect 127.0.0.1:14550
169178
170179
171180
@@ -384,8 +393,8 @@ Testbed settings
384393

385394
This example has been tested on Windows against SITL running both natively and in a virtual machine (as described in :ref:`installing_dronekit`).
386395

387-
* DroneKit version: 2.0.0rc12
388-
* ArduPilot version: 3.4.0.
396+
* DroneKit version: 2.0.2
397+
* ArduPilot version: 3.3
389398

390399

391400

0 commit comments

Comments
 (0)