Drone

Device pinout

Drone

API function description

class pywpc.Drone
  1. Wing span: 550mm

  2. Overall length: 70cm

  3. Overall height: 26.5cm

  4. Net weight: 1.9kg

  5. Propulsion: battery & motor

  6. Max payload: 1kg

  7. Max takeoff weight: 1kg

  8. Max wind speed resistance: 17.2m/s

  9. Hovering accuracy range: 10cm

  10. Endurance: 10-20min

  11. Operating range: 3.4km

  12. Remote control communication interface: PWM

  13. SDK communication interface: UART

  14. Take off method: VTOL

  15. Recover speed: VTOL

  16. Sensor fusion update rate: 400Hz

  17. Attitude control method: 400Hz

  18. Flight recorder: USB

  19. Body material: carbon fiber

Drone_abortLanding(timeout=3)

Abort the drone’s takeoff process.

Parameters
timeoutint

Specify the time (sec) to wait before reporting a timeout error. The default is 3 s.

Returns
statusint

Return 0 if executed successfully; return error code otherwise. See here for corresponding error messages.

Drone_abortTakeOff(timeout=3)

Abort the drone’s takeoff process.

Parameters
timeoutint

Specify the time (sec) to wait before reporting a timeout error. The default is 3 s.

Returns
statusint

Return 0 if executed successfully; return error code otherwise. See here for corresponding error messages.

Drone_activate(timeout=3)

Activate the drone.

Parameters
timeoutint

Specify the time (sec) to wait before reporting a timeout error. The default is 3 s.

Returns
statusint

Return 0 if executed successfully; return error code otherwise. See here for corresponding error messages.

Drone_deactivate(timeout=3)

Deactivate the drone.

Parameters
timeoutint

Specify the time (sec) to wait before reporting a timeout error. The default is 3 s.

Returns
statusint

Return 0 if executed successfully; return error code otherwise. See here for corresponding error messages.

Drone_getAccelerationWithNED(timeout=3)

Get the drone’s acceleration in the NED (North-East-Down) coordinate frame.

Parameters
timeoutint

Specify the time (sec) to wait before reporting a timeout error. The default is 3 s.

Returns
statelist of float
  • A list representing the drone’s acceleration in NED frame.

  • Format: [X, Y, Z, roll, pitch, yaw]

  • X, Y, Z: Acceleration in m/s²

  • roll, pitch, yaw: Angular acceleration in degree/s²

Drone_getActiveStatus(timeout=3)

Get the current activation status of the drone.

Parameters
timeoutint

Specify the time (sec) to wait before reporting a timeout error. The default is 3 s.

Returns
statusint
  • 0: Deactivated.

  • 1: Activated.

Drone_getFirmwareVersion(timeout=3)

Get drone firmware version.

Parameters
timeoutint

Specify the time (sec) to wait before reporting a timeout error. The default is 3 s.

Returns
firmware versionstring
Drone_getFlightMode(timeout=3)

Get the current flight mode of the drone.

Parameters
timeoutint

Specify the time (sec) to wait before reporting a timeout error. The default is 3 s.

Returns
stateint
  • 0: Attitude mode.

  • 1: Position mode.

Drone_getLandingStatus(timeout=3)

Get the drone’s landing process status.

Parameters
timeoutint

Specify the time (sec) to wait before reporting a timeout error. The default is 3 s.

Returns
statusint
  • 0: Landing completed.

  • 1: Landing in progress.

Drone_getPositionWithNED(timeout=3)

Get the drone’s attitude and position in the NED (North-East-Down) coordinate frame.

Parameters
timeoutint

Specify the time (sec) to wait before reporting a timeout error. The default is 3 s.

Returns
statelist of float
  • A list representing the drone’s attitude and position in NED frame.

  • Format: [roll, pitch, yaw, X, Y, Z]

  • Roll, pitch, yaw: Orientation angles in degrees

  • X, Y, Z: Position in meters along the north, east, down axes respectively

Drone_getSerialNumber(timeout=3)

Get drone firmware information.

Parameters
timeoutint

Specify the time (sec) to wait before reporting a timeout error. The default is 3 s.

Returns
firmware versionstring
Drone_getTakeOffStatus(timeout=3)

Get the drone’s takeoff process status.

Parameters
timeoutint

Specify the time (sec) to wait before reporting a timeout error. The default is 3 s.

Returns
statusint
  • 0: It has not yet entered flight mode or is still on the ground.

  • 1: It has completed the takeoff procedure and is currently in flight.

Drone_getVelocityWithNED(timeout=3)

Get the drone’s velocity in the NED (North-East-Down) coordinate frame.

Parameters
timeoutint

Specify the time (sec) to wait before reporting a timeout error. The default is 3 s.

Returns
statelist of float
  • A list representing the drone’s velocity in NED frame.

  • Format: [X, Y, Z, roll, pitch, yaw]

  • X, Y, Z: (m/s)

  • roll, pitch, yaw: (degree/s)

Drone_moveNedAbsX(position, velocity, timeout=3)

Move absolute x position and velocity in ned frame.

Parameters
positionfloat
  • Unit will be m.

velocityfloat
  • Unit will be m/s.

timeoutfloat

Specify the time (sec) to wait before reporting a timeout error. The default is 3 s.

Returns
statusint

Return 0 if executed successfully; return error code otherwise. See here for corresponding error messages.

Drone_moveNedAbsXY(position_x, position_y, velocity_xy, timeout=3)

Move absolute xy position and velocity in ned frame.

Parameters
position_xfloat
  • Unit will be m.

position_yfloat
  • Unit will be m.

velocity_xyfloat
  • Unit will be m/s.

timeoutfloat

Specify the time (sec) to wait before reporting a timeout error. The default is 3 s.

Returns
statusint

Return 0 if executed successfully; return error code otherwise. See here for corresponding error messages.

Drone_moveNedAbsY(position, velocity, timeout=3)

Move absolute y position and velocity in ned frame.

Parameters
positionfloat
  • Unit will be m.

velocityfloat
  • Unit will be m/s.

timeoutfloat

Specify the time (sec) to wait before reporting a timeout error. The default is 3 s.

Returns
statusint

Return 0 if executed successfully; return error code otherwise. See here for corresponding error messages.

Drone_moveNedAbsYaw(position, velocity, timeout=3)

Move absolute yaw angular position and velocity in Ned frame.

Parameters
positionfloat
  • Unit will be degree.

velocityfloat
  • Unit will be degree/s.

timeoutfloat

Specify the time (sec) to wait before reporting a timeout error. The default is 3 s.

Returns
statusint

Return 0 if executed successfully; return error code otherwise. See here for corresponding error messages.

Drone_moveNedAbsZ(position, velocity, timeout=3)

Move absolute z position and velocity in ned frame.

Parameters
positionfloat
  • Unit will be m.

velocityfloat
  • Unit will be m/s.

timeoutfloat

Specify the time (sec) to wait before reporting a timeout error. The default is 3 s.

Returns
statusint

Return 0 if executed successfully; return error code otherwise. See here for corresponding error messages.

Drone_moveNedRelX(position, velocity, timeout=3)

Move relative x position and velocity in ned frame.

Parameters
positionfloat
  • Unit will be m.

velocityfloat
  • Unit will be m/s.

timeoutfloat

Specify the time (sec) to wait before reporting a timeout error. The default is 3 s.

Returns
statusint

Return 0 if executed successfully; return error code otherwise. See here for corresponding error messages.

Drone_moveNedRelXY(position_x, position_y, velocity_xy, timeout=3)

Move relative xy position and velocity in ned frame.

Parameters
position_xfloat
  • Unit will be m.

position_yfloat
  • Unit will be m.

velocity_xyfloat
  • Unit will be m/s.

timeoutfloat

Specify the time (sec) to wait before reporting a timeout error. The default is 3 s.

Returns
statusint

Return 0 if executed successfully; return error code otherwise. See here for corresponding error messages.

Drone_moveNedRelY(position, velocity, timeout=3)

Move relative y position and velocity in ned frame.

Parameters
positionfloat
  • Unit will be m.

velocityfloat
  • Unit will be m/s.

timeoutfloat

Specify the time (sec) to wait before reporting a timeout error. The default is 3 s.

Returns
statusint

Return 0 if executed successfully; return error code otherwise. See here for corresponding error messages.

Drone_moveNedRelYaw(position, velocity, timeout=3)

Move relative yaw angular position and velocity in ned frame.

Parameters
positionfloat
  • Unit will be degree.

velocityfloat
  • Unit will be degree/s.

timeoutfloat

Specify the time (sec) to wait before reporting a timeout error. The default is 3 s.

Returns
statusint

Return 0 if executed successfully; return error code otherwise. See here for corresponding error messages.

Drone_moveNedRelZ(position, velocity, timeout=3)

Move relative z position and velocity in ned frame.

Parameters
positionfloat
  • Unit will be m.

velocityfloat
  • Unit will be m/s.

timeoutfloat

Specify the time (sec) to wait before reporting a timeout error. The default is 3 s.

Returns
statusint

Return 0 if executed successfully; return error code otherwise. See here for corresponding error messages.

Drone_moveVehicleAbsPitch(position, velocity, timeout=3)

Move absolute pitch angular position and velocity in vehicle frame.

Parameters
positionfloat
  • Unit will be degree.

velocityfloat
  • Unit will be degree/s.

timeoutfloat

Specify the time (sec) to wait before reporting a timeout error. The default is 3 s.

Returns
statusint

Return 0 if executed successfully; return error code otherwise. See here for corresponding error messages.

Drone_moveVehicleAbsRoll(position, velocity, timeout=3)

Move absolute roll angular position and velocity in vehicle frame.

Parameters
positionfloat
  • Unit will be degree.

velocityfloat
  • Unit will be degree/s.

timeoutfloat

Specify the time (sec) to wait before reporting a timeout error. The default is 3 s.

Returns
statusint

Return 0 if executed successfully; return error code otherwise. See here for corresponding error messages.

Drone_moveVehicleRelX(position, velocity, timeout=3)

Move relative x position and velocity in vehicle frame.

Parameters
positionfloat
  • Unit will be m.

velocityfloat
  • Unit will be m/s.

timeoutfloat

Specify the time (sec) to wait before reporting a timeout error. The default is 3 s.

Returns
statusint

Return 0 if executed successfully; return error code otherwise. See here for corresponding error messages.

Drone_moveVehicleRelXY(position_x, position_y, velocity_xy, timeout=3)

Move relative xy position and velocity in vehicle frame.

Parameters
position_xfloat
  • Unit will be m.

position_yfloat
  • Unit will be m.

velocity_xyfloat
  • Unit will be m/s.

timeoutfloat

Specify the time (sec) to wait before reporting a timeout error. The default is 3 s.

Returns
statusint

Return 0 if executed successfully; return error code otherwise. See here for corresponding error messages.

Drone_moveVehicleRelY(position, velocity, timeout=3)

Move relative y position and velocity in vehicle frame.

Parameters
positionfloat
  • Unit will be m.

velocityfloat
  • Unit will be m/s.

timeoutfloat

Specify the time (sec) to wait before reporting a timeout error. The default is 3 s.

Returns
statusint

Return 0 if executed successfully; return error code otherwise. See here for corresponding error messages.

Drone_readBattery(timeout=3)

Read the drone’s battery status, including voltage (V), current (A), and capacity (%).

Parameters
timeoutint

Specify the time (sec) to wait before reporting a timeout error. The default is 3 s.

Returns
statelist
  • A list containing battery information in the following order:

  • [voltage(V), current(A), capacity(%)]

Drone_readInposition(timeout=3)

Read whether the drone is in position for each axis.

Parameters
timeoutint

Specify the time (sec) to wait before reporting a timeout error. The default is 3 s.

Returns
statelist of int
  • A list of in-position status for each axis.

  • 0: Not in position

  • 1: In position

  • Format: [roll, pitch, yaw, X, Y, Z]

Drone_readTaskControlMode(timeout=3)

Read the current task control mode of the drone.

Parameters
timeoutint

Specify the time (sec) to wait before reporting a timeout error. The default is 3 s.

Returns
modeint
  • 0: Remote controller mode

  • 1: Mission computer mode

Drone_readTrajectory(timeout=3)

Read drone’s trajectory.

Parameters
timeoutint

Specify the time (sec) to wait before reporting a timeout error. The default is 3 s.

Returns
statelist
  • The list of trajectory.

  • [roll(rad), pitch(rad), yaw(rad), X(m), Y(m), Z(m)]

Drone_readTrajectoryStatus(timeout=3)

Read drone current trajectory status.

Parameters
timeoutint

Specify the time (sec) to wait before reporting a timeout error. The default is 3 s.

Returns
statelist
  • The U8 list of trajectory

  • 0: false, 1: true

  • [roll, pitch, yaw, X, Y, Z]

Drone_setAltitudeSensorMode(mode, timeout=3)

Set the altitude sensing mode.

Parameters
modeint

0: Automatically switch between barometer and optical flow based on altitude. 1: Use barometer only.

timeoutint

Specify the time (sec) to wait before reporting a timeout error. The default is 3 s.

Returns
statusint

Return 0 if executed successfully; return error code otherwise. See here for corresponding error messages.

Drone_setAttiudeMode(timeout=3)

Set the drone to attitude mode.

Parameters
timeoutint

Specify the time (sec) to wait before reporting a timeout error. The default is 3 s.

Returns
statusint

Return 0 if executed successfully; return error code otherwise. See here for corresponding error messages.

Drone_setPositionMode(timeout=3)

Set the drone to position mode.

Parameters
timeoutint

Specify the time (sec) to wait before reporting a timeout error. The default is 3 s.

Returns
statusint

Return 0 if executed successfully; return error code otherwise. See here for corresponding error messages.

Drone_startLanding(timeout=3)

Start the drone landing process.

Parameters
timeoutint

Specify the time (sec) to wait before reporting a timeout error. The default is 3 s.

Returns
statusint

Return 0 if executed successfully; return error code otherwise. See here for corresponding error messages.

Drone_startTakeOff(timeout=3)

Start the drone’s takeoff process.

Parameters
timeoutint

Specify the time (sec) to wait before reporting a timeout error. The default is 3 s.

Returns
statusint

Return 0 if executed successfully; return error code otherwise. See here for corresponding error messages.

Drone_stopMovement(timeout=3)

Stop the current movement of the drone immediately.

Behavior depends on the current control mode:
  • Position Mode: The drone stops at its current position.

  • Attitude Mode: Roll and pitch are set to zero degrees, and yaw remains at the current angle.

Parameters
timeoutint

Specify the time (sec) to wait before reporting a timeout error. The default is 3 s.

Returns
statusint

Return 0 if executed successfully; return error code otherwise. See here for corresponding error messages.

close()

Close web device handle.

Parameters
verbose: bool, default: True

Whether to print out messages or not.

Returns
None
connect(port='COM4', baudrate=91600, verbose=True)

Connect handle to UART device.

Parameters
portstring, default: COM4

UART COM port.

verbose: bool, default: True

Whether to print out messages or not.

Returns
None
disconnect(verbose=True)

Disconnect handle from web device.

Parameters
verbose: bool, default: True

Whether to print out messages or not.

Returns
None