From de940b34c5368cef5e3c07db34875208c97187c2 Mon Sep 17 00:00:00 2001 From: Hamish Willee Date: Tue, 10 Nov 2015 10:13:47 +1100 Subject: [PATCH 1/5] Fix typo in note about setting yaw --- docs/guide/copter/guided_mode.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/guide/copter/guided_mode.rst b/docs/guide/copter/guided_mode.rst index 2fa224162..a467a27be 100644 --- a/docs/guide/copter/guided_mode.rst +++ b/docs/guide/copter/guided_mode.rst @@ -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 `_ 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). From 7cf5277dcfe47e01037ec0cbf0f7a5e5feda1f46 Mon Sep 17 00:00:00 2001 From: Hamish Willee Date: Tue, 10 Nov 2015 10:28:54 +1100 Subject: [PATCH 2/5] Fixes connect docs as per #395. Makes the docs display --- dronekit/lib/__init__.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/dronekit/lib/__init__.py b/dronekit/lib/__init__.py index df0c81327..882dd4db9 100644 --- a/dronekit/lib/__init__.py +++ b/dronekit/lib/__init__.py @@ -1,3 +1,4 @@ +# DroneAPI module """ This is the API Reference for the DroneKit-Python API. @@ -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. ---- @@ -54,8 +58,6 @@ """ -# DroneAPI module - import threading, time, math, copy import CloudClient from pymavlink.dialects.v10 import ardupilotmega From 2ea5e4713f1ebed9549b27c01ba7c4e05b954909 Mon Sep 17 00:00:00 2001 From: Hamish Willee Date: Tue, 10 Nov 2015 11:34:10 +1100 Subject: [PATCH 3/5] Document current parameter download strategy as per #352 --- docs/guide/vehicle_state_and_parameters.rst | 31 +++++++++++---------- 1 file changed, 17 insertions(+), 14 deletions(-) diff --git a/docs/guide/vehicle_state_and_parameters.rst b/docs/guide/vehicle_state_and_parameters.rst index 8e9bad3e8..f4e81e658 100644 --- a/docs/guide/vehicle_state_and_parameters.rst +++ b/docs/guide/vehicle_state_and_parameters.rst @@ -300,26 +300,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 ` +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 `_, +`Plane Parameters `_, +`Rover Parameters `_ +(the lists are automatically generated from the latest ArduPilot source code, and may contain or omit parameters +in your vehicle). + +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 ` attribute (a :py:class:`Parameters ` object). -.. tip:: - - `Copter Parameters `_, - `Plane Parameters `_, - and `Rover 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. - - 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. From 3df7a99bcdf50b57508827d7856a0535d6c205f1 Mon Sep 17 00:00:00 2001 From: Hamish Willee Date: Tue, 10 Nov 2015 11:52:52 +1100 Subject: [PATCH 4/5] Add ekf_ok attribute docs --- docs/examples/vehicle_state.rst | 1 + docs/guide/vehicle_state_and_parameters.rst | 2 ++ dronekit/lib/__init__.py | 3 +++ examples/vehicle_state/vehicle_state.py | 1 + 4 files changed, 7 insertions(+) diff --git a/docs/examples/vehicle_state.rst b/docs/examples/vehicle_state.rst index 20afac94e..3e0d4b136 100644 --- a/docs/examples/vehicle_state.rst +++ b/docs/examples/vehicle_state.rst @@ -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 diff --git a/docs/guide/vehicle_state_and_parameters.rst b/docs/guide/vehicle_state_and_parameters.rst index f4e81e658..181be2b41 100644 --- a/docs/guide/vehicle_state_and_parameters.rst +++ b/docs/guide/vehicle_state_and_parameters.rst @@ -30,6 +30,7 @@ Vehicle state information is exposed through vehicle *attributes*. DroneKit-Pyth :py:attr:`Vehicle.mount_status `, :py:attr:`Vehicle.battery `, :py:attr:`Vehicle.rangefinder `, +:py:attr:`Vehicle.ekf_ok `, :py:attr:`Vehicle.home_location `, :py:func:`Vehicle.system_status `, :py:func:`Vehicle.heading `, @@ -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 diff --git a/dronekit/lib/__init__.py b/dronekit/lib/__init__.py index 882dd4db9..cdad082aa 100644 --- a/dronekit/lib/__init__.py +++ b/dronekit/lib/__init__.py @@ -1138,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: diff --git a/examples/vehicle_state/vehicle_state.py b/examples/vehicle_state/vehicle_state.py index 58329df50..9f8c92f1d 100644 --- a/examples/vehicle_state/vehicle_state.py +++ b/examples/vehicle_state/vehicle_state.py @@ -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 From 3085cdb5a531062eaacb70a3580171c314b00fa7 Mon Sep 17 00:00:00 2001 From: Hamish Willee Date: Tue, 10 Nov 2015 12:03:21 +1100 Subject: [PATCH 5/5] Update migrating doc to make it clear that numpy is no longer a dependency and note that it may now be possible to use other python distributions --- docs/guide/migrating.rst | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/docs/guide/migrating.rst b/docs/guide/migrating.rst index 6c8b1c60b..22013f816 100644 --- a/docs/guide/migrating.rst +++ b/docs/guide/migrating.rst @@ -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