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
1 change: 1 addition & 0 deletions docs/examples/vehicle_state.rst
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ On the command prompt you should see (something like):
Airspeed: 0.0
Mount status: [None, None, None]
Battery: Battery:voltage=12.587,current=0.0,level=95
EKF OK?: True
Rangefinder: Rangefinder: distance=None, voltage=None
Rangefinder distance: None
Rangefinder voltage: None
Expand Down
2 changes: 1 addition & 1 deletion docs/guide/copter/guided_mode.rst
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ The command allows you to specify that whether the heading is an absolute angle

* The yaw will return to the default (facing direction of travel) after you set the mode or change the command used for controlling movement.
* `At time of writing <https://github.com/diydrones/ardupilot/issues/2427>`_ there is no *safe way* to return to the default yaw "face direction of travel" behaviour.
* After taking off, yaw commands are ignored until the first "movement" command has been received. If you need to
* After taking off, yaw commands are ignored until the first "movement" command has been received.
If you need to yaw immediately following takeoff then send a command to "move" to your current position.
* :ref:`guided_mode_copter_set_roi` may work to get yaw to track a particular point (depending on the gimbal setup).

Expand Down
10 changes: 7 additions & 3 deletions docs/guide/migrating.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,16 @@ The sections below outline the main migration areas.
Installation
============

DKPY 2.0 is installed from `pip` on all platforms - see :ref:`get-started` for more information.
DKPY 2.0 is now installed from `pip` on all platforms - see :ref:`get-started` for more information.

Installation is generally simpler than on DK 1.x because there are far fewer dependencies (both MAVProxy and numpy
are no longer needed).

.. note::

The DroneKit-Python Windows installer is no longer needed. Installation is generally simpler
than on DK 1.x because MAVProxy is not a dependency.
* The DroneKit-Python Windows installer cannot be used for DKPY2.x (and is no longer needed).
* One implication of the reduced dependencies is that it should now be easier to use other Python distributions
(like ActivePython - although this has not been verified!)


Launching scripts
Expand Down
31 changes: 18 additions & 13 deletions docs/guide/vehicle_state_and_parameters.rst
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ Vehicle state information is exposed through vehicle *attributes*. DroneKit-Pyth
:py:attr:`Vehicle.mount_status <dronekit.lib.Vehicle.mount_status>`,
:py:attr:`Vehicle.battery <dronekit.lib.Vehicle.battery>`,
:py:attr:`Vehicle.rangefinder <dronekit.lib.Vehicle.rangefinder>`,
:py:attr:`Vehicle.ekf_ok <dronekit.lib.Vehicle.ekf_ok>`,
:py:attr:`Vehicle.home_location <dronekit.lib.Vehicle.home_location>`,
:py:func:`Vehicle.system_status <dronekit.lib.Vehicle.system_status>`,
:py:func:`Vehicle.heading <dronekit.lib.Vehicle.heading>`,
Expand Down Expand Up @@ -69,6 +70,7 @@ regularly updated from MAVLink messages sent by the vehicle).
print "Airspeed: %s" % vehicle.airspeed
print "Mount status: %s" % vehicle.mount_status
print "Battery: %s" % vehicle.battery
print "EKF OK?: %s" % vehicle.ekf_ok
print "Rangefinder: %s" % vehicle.rangefinder
print "Rangefinder distance: %s" % vehicle.rangefinder.distance
print "Rangefinder voltage: %s" % vehicle.rangefinder.voltage
Expand Down Expand Up @@ -300,26 +302,29 @@ waypoints is set relative to this position.
Parameters
==========

Vehicle parameters provide the information used to configure the autopilot for the vehicle-specific hardware/capabilities.
These can be read and set using the :py:attr:`Vehicle.parameters <dronekit.lib.Vehicle.parameters>`
attribute (a :py:class:`Parameters <dronekit.lib.Parameters>` object).

.. tip::
Vehicle parameters provide the information used to configure the autopilot for the vehicle-specific hardware/capabilities.
The available parameters for each platform are documented in the ardupilot wiki here:
`Copter Parameters <http://copter.ardupilot.com/wiki/configuration/arducopter-parameters/>`_,
`Plane Parameters <http://plane.ardupilot.com/wiki/arduplane-parameters/>`_,
`Rover Parameters <http://rover.ardupilot.com/wiki/apmrover2-parameters/>`_
(the lists are automatically generated from the latest ArduPilot source code, and may contain or omit parameters
in your vehicle).

`Copter Parameters <http://copter.ardupilot.com/wiki/configuration/arducopter-parameters/>`_,
`Plane Parameters <http://plane.ardupilot.com/wiki/arduplane-parameters/>`_,
and `Rover Parameters <http://rover.ardupilot.com/wiki/apmrover2-parameters/>`_ list all the supported parameters for each platform.
The lists are automatically generated from the latest ArduPilot source code, and may contain parameters
that are not yet in the stable released versions of the code.
DroneKit downloads all parameters when you first connect to the UAV (forcing parameter reads to wait
until the download completes), and subsequently keeps the values updated by monitoring vehicle messages
for changes to individual parameters. This process ensures that it is always safe to read supported parameters,
and that their values will match the information on the vehicle.

Parameters can be read and set using the :py:attr:`Vehicle.parameters <dronekit.lib.Vehicle.parameters>`
attribute (a :py:class:`Parameters <dronekit.lib.Parameters>` object).


Getting parameters
------------------

The parameters are read using the parameter name as a key. Reads will generally succeed unless you attempt to read an unsupported parameter
(which results in a Key error exception).

The parameters are read using the parameter name as a key. Reads will always succeed unless you attempt to access an unsupported parameter
(which will result in a ``KeyError`` exception).
The code example below shows how to set Minimum Throttle (THR_MIN) setting. On Copter and Rover (not Plane), this is the minimum PWM setting for the
throttle at which the motors will keep spinning.

Expand Down
17 changes: 11 additions & 6 deletions dronekit/lib/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# DroneAPI module
"""
This is the API Reference for the DroneKit-Python API.

Expand Down Expand Up @@ -38,11 +39,14 @@

:param String ip: Connection string for target address - e.g. 127.0.0.1:14550.
:param Bool wait_ready: Wait until all :py:func:`Vehicle.parameters` have downloaded before the method returns (default is false)
:param status_printer: NA
:param Vehicle vehicle_class: NA
:param int rate: NA
:param status_printer: Method of signature ``def status_printer(txt)`` that prints STATUS_TEXT messages from the Vehicle and other diagnostic information.
By default the status information is printed to the command prompt in which the script is running.
:param Vehicle vehicle_class: The class that will be instantiated by the ``connect()`` method.
This can be any sub-class of ``Vehicle`` (and defaults to ``Vehicle``).
:param int rate: Data sream refresh rate. The default is 4Hz (4 updates per second).
:param int baud: The baud rate for the connection. The default is 115200.



:returns: A connected :py:class:`Vehicle` object.

----
Expand All @@ -54,8 +58,6 @@

"""

# DroneAPI module

import threading, time, math, copy
import CloudClient
from pymavlink.dialects.v10 import ardupilotmega
Expand Down Expand Up @@ -1136,6 +1138,9 @@ def mount_status(self):

@property
def ekf_ok(self):
"""
``True`` if the EKF status is considered acceptable, ``False`` otherwise.
"""
# legacy check for dronekit-python for solo
# use same check that ArduCopter::system.pde::position_ok() is using
if self.armed:
Expand Down
1 change: 1 addition & 0 deletions examples/vehicle_state/vehicle_state.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
print " Airspeed: %s" % vehicle.airspeed
print " Mount status: %s" % vehicle.mount_status
print " Battery: %s" % vehicle.battery
print " EKF OK?: %s" % vehicle.ekf_ok
print " Rangefinder: %s" % vehicle.rangefinder
print " Rangefinder distance: %s" % vehicle.rangefinder.distance
print " Rangefinder voltage: %s" % vehicle.rangefinder.voltage
Expand Down