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/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). 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 diff --git a/docs/guide/vehicle_state_and_parameters.rst b/docs/guide/vehicle_state_and_parameters.rst index 8e9bad3e8..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 @@ -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 ` -attribute (a :py:class:`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 `_, +`Plane Parameters `_, +`Rover Parameters `_ +(the lists are automatically generated from the latest ArduPilot source code, and may contain or omit parameters +in your vehicle). - `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. +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). 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. diff --git a/dronekit/lib/__init__.py b/dronekit/lib/__init__.py index df0c81327..cdad082aa 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 @@ -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: 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