Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions docs/automodule.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ DroneKit-Python API Reference
.. automodule:: dronekit.lib
:members:
:inherited-members:
:exclude-members: Mission, get_mission, ConnectionInfo, web_connect, AuthInfo, delete, notify_observers, remove_all_observers, local_connect, APIConnection
:exclude-members: Mission, get_mission, ConnectionInfo, web_connect, AuthInfo, delete, notify_observers, remove_all_observers, local_connect, APIConnection, flush



Expand All @@ -19,5 +19,4 @@ DroneKit-Python API Reference




.. todolist::
4 changes: 2 additions & 2 deletions docs/examples/channel_overrides.rst
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ In summary, after cloning the repository:

.. note::

The examples uses the ``--connect`` parameter to pass the :ref:`connection string <get_started_connect_string>` into the script.
The command above would be used to connect to :ref:`SITL <sitl_setup>` running on the local machine via UDP port 14550.
The ``--connect`` parameter above connects to SITL on udp port 127.0.0.1:14550.
This is the default value for the parameter, and may be omitted.



Expand Down
4 changes: 2 additions & 2 deletions docs/examples/create_attribute.rst
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ In summary, after cloning the repository:

.. note::

The command parameter above is the default, and may be omitted. This
connects to SITL on udp port 127.0.0.1:14550.
The ``--connect`` parameter above connects to SITL on udp port 127.0.0.1:14550.
This is the default value for the parameter, and may be omitted.



Expand Down
4 changes: 2 additions & 2 deletions docs/examples/drone_delivery.rst
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ In summary, after cloning the repository:

.. note::

The command parameter above is the default, and may be omitted. This
connects to SITL on udp port 127.0.0.1:14550.
The ``--connect`` parameter above connects to SITL on udp port 127.0.0.1:14550.
This is the default value for the parameter, and may be omitted.

#. After a short while you should be able to reach your new webserver at http://localhost:8080.

Expand Down
39 changes: 16 additions & 23 deletions docs/examples/flight_replay.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,17 @@
Example: Flight Replay
=========================

This example requests a past flight from Droneshare, and then "replays" the mission
by sending waypoints to a vehicle. For safety reasons, the vehicle is replayed at a height of 30 meters.
This example requests a past flight from Droneshare, and then writes the recorded path to the vehicle as mission waypoints.
For safety reasons, the altitude for the waypoints is set to 30 meters (irrespective of the recorded height).

.. warning::
.. note::

At time of writing this example fails with an exception in DKYP2: `#355 DKPY2 Can't clear waypoints <https://github.com/dronekit/dronekit-python/issues/355>`_.
The mission is not actually run by this code - though it easily could be by taking off and putting the vehicle into
AUTO mode.

.. todo:: Check if `#355 DKPY2 Can't clear waypoints <https://github.com/dronekit/dronekit-python/issues/355>`_ is fixed and re-review example.

You can specify which mission to replay using a parameter when starting the script (for example, to replay your own local flights).
By default the code gets (and replays) the public `Droneshare mission with ID 101 <http://www.droneshare.com/mission/101>`_.
By default the code gets the public `Droneshare mission with ID 101 <http://www.droneshare.com/mission/101>`_.

.. figure:: flight_replay_example.png

Expand Down Expand Up @@ -47,8 +47,9 @@ In summary, after cloning the repository:

.. note::

The command parameters above are the defaults, and may be omitted. These
connect to SITL on udp port 127.0.0.1:14550 and replay the mission with id 101.
The ``--connect`` parameter above connects to SITL on udp port 127.0.0.1:14550, while
``--mission_id`` specifies we're replaying mission 101. Both of these are the default
values for the parameters, and may be omitted.


.. tip::
Expand All @@ -60,22 +61,20 @@ On the command prompt you should see (something like):

.. code-block:: bash


\dronekit-python\examples\flight_replay>flight_replay.py
Connecting to vehicle on: 127.0.0.1:14550
>>> APM:Copter V3.4-dev (e0810c2e)
>>> APM:Copter V3.3 (d6053245)
>>> Frame: QUAD
JSON downloaded...
Generating 95 waypoints from replay...
...
Close vehicle object
Completed...


How it works
============

The example requests the web server for representative points from the flight, parses the JSON response
and uses that data to generate 100 waypoints. These are then sent to the vehicle.

and uses that data to generate 100 waypoints. These are then sent to the vehicle.


Getting the points
Expand Down Expand Up @@ -111,7 +110,6 @@ shown in :ref:`example_mission_basic`):
print "Generating %s waypoints from replay..." % len(messages)
cmds = vehicle.commands
cmds.clear()
vehicle.flush()
for i in xrange(0, len(messages)):
pt = messages[i]
lat = pt['lat']
Expand All @@ -127,19 +125,14 @@ shown in :ref:`example_mission_basic`):
0, 0, 0, 0, 0, 0,
lat, lon, altitude)
cmds.add(cmd)
vehicle.flush()
#Upload clear message and command messages to vehicle.
cmds.upload()


Known issues
============

At time of writing this example fails with an exception. See `#355 DKPY2 Can't clear waypoints <https://github.com/dronekit/dronekit-python/issues/355>`_ for more information.

.. todo::

When example is fixed replace above text with
"This example works around the :ref:`known issues in the API <api-information-known-issues>`.
Provided that the vehicle is connected and able to arm, it should run through to completion."
There are no known issues with this example.



Expand Down
29 changes: 18 additions & 11 deletions docs/examples/guided-set-speed-yaw-demo.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,14 @@
Example: Guided Mode Movement and Commands (Copter)
===================================================

This example shows how to control Copter movement and send immediate commands in :ref:`GUIDED mode <guided_mode_copter>`. It demonstrates three methods for explicitly specifying a target position and two commands for controlling movement by setting the vehicle's velocity vectors. It also shows how to send commands to control the yaw (direction that the front of the vehicle is pointing), region of interest, speed and home position, along with some useful functions for converting between frames of reference.
This example shows how to control Copter movement and send immediate commands in :ref:`GUIDED mode <guided_mode_copter>`.
It demonstrates three methods for explicitly specifying a target position and two commands for controlling movement by
setting the vehicle's velocity vectors. It also shows how to send commands to control the yaw (direction that the front
of the vehicle is pointing), region of interest, speed and home location, along with some useful functions for
converting between frames of reference.

The example is :ref:`documented in the source code <guided_example_source_code>`. More detailed information about using GUIDED mode can be found in the guide: :ref:`guided_mode_copter`.
The example is :ref:`documented in the source code <guided_example_source_code>`.
More detailed information about using GUIDED mode can be found in the guide: :ref:`guided_mode_copter`.


.. figure:: GuidedModeExample_FlyByPosition.png
Expand Down Expand Up @@ -50,8 +55,8 @@ In summary, after cloning the repository:

.. note::

The command parameter above is the default, and may be omitted. This
connects to SITL on udp port 127.0.0.1:14550.
The ``--connect`` parameter above connects to SITL on udp port 127.0.0.1:14550.
This is the default value for the parameter, and may be omitted.


.. tip::
Expand Down Expand Up @@ -152,8 +157,7 @@ On the command prompt you should see (something like):
Yaw 90 relative (to previous yaw heading)
Set new Home location to current location
Get new home location
Home WP: MISSION_ITEM {target_system : 255, target_component : 0, seq : 0, frame : 0, command : 16, current : 0, autocontinue : 1, param1 : 0.0, param2 : 0.0, param3 : 0.0, param4 : 0.0, x :
-35.3632583618, y : 149.164352417, z : 593.91998291}
Home Location: LocationGlobal:lat=-35.3639335632,lon=149.165328979,alt=628.679992676,is_relative=False
Velocity South and West
Yaw 90 relative (to previous yaw heading)
Velocity North and West
Expand Down Expand Up @@ -266,8 +270,9 @@ which is used to directly specify the speed components of the vehicle. The funct
goto_position_target_global_int()
---------------------------------

The function ``goto_position_target_global_int()`` generates a `SET_POSITION_TARGET_GLOBAL_INT <https://pixhawk.ethz.ch/mavlink/#SET_POSITION_TARGET_GLOBAL_INT>`_ MAVLink message
which is used to directly specify the target location of the vehicle. When used with ``MAV_FRAME_GLOBAL_RELATIVE_ALT_INT`` as shown below, this method is effectively the same as :ref:`Vehicle.commands.goto <guided_mode_copter_position_control>`.
The function ``goto_position_target_global_int()`` generates a `SET_POSITION_TARGET_GLOBAL_INT <https://pixhawk.ethz.ch/mavlink/#SET_POSITION_TARGET_GLOBAL_INT>`_
MAVLink message which is used to directly specify the target location of the vehicle. When used with ``MAV_FRAME_GLOBAL_RELATIVE_ALT_INT`` as shown below,
this method is effectively the same as :ref:`Vehicle.commands.goto <guided_mode_copter_position_control>`.

.. code-block:: python

Expand Down Expand Up @@ -310,7 +315,8 @@ which is used to directly specify the target location in the North, East, Down f

.. note::

The `documentation <https://pixhawk.ethz.ch/mavlink/#SET_POSITION_TARGET_LOCAL_NED>`_ lists a number of possible frames of reference. At time of writing experimentation indicates that the actual frame use is always relative to the home location (not the vehicle, as indicated by MAV_FRAME_BODY_NED).
The `documentation <https://pixhawk.ethz.ch/mavlink/#SET_POSITION_TARGET_LOCAL_NED>`_ lists a number of possible frames of reference.
Up until Copter 3.2.1 the actual frame use is always relative to the home location (not the vehicle, as indicated by MAV_FRAME_BODY_NED).


.. code-block:: python
Expand All @@ -333,7 +339,7 @@ which is used to directly specify the target location in the North, East, Down f
vehicle.send_mavlink(msg)


At time of writing, acceleration and yaw bits are ignored.
At time of writing, acceleration and yaw bits are ignored.


Testbed settings
Expand All @@ -359,7 +365,8 @@ ArduPilot version:
Source code
===========

The full source code at documentation build-time is listed below (`current version on github <https://github.com/dronekit/dronekit-python/blob/master/examples/guided_set_speed_yaw/guided_set_speed_yaw.py>`_):
The full source code at documentation build-time is listed below
(`current version on github <https://github.com/dronekit/dronekit-python/blob/master/examples/guided_set_speed_yaw/guided_set_speed_yaw.py>`_):

.. literalinclude:: ../../examples/guided_set_speed_yaw/guided_set_speed_yaw.py
:language: python
Expand Down
Loading