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_activate(timeout=3)

Let drone servo on.

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_disactivate(timeout=3)

Let drone servo off.

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_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_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_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_readAbsPosition(timeout=3)

Read the current position relative to the drone’s takeoff point.

Parameters:
timeoutint

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

Returns:
statelist
  • The list of absolute position

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

Drone_readActivateStatus(timeout=3)

Read drone’s servo status.

Parameters:
timeoutint

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

Returns:
statusint

0: Servo off. 1: Servo on.

Drone_readBattery(timeout=3)

Read drone’s voltage(V), current(A), capacity(%).

Parameters:
timeoutint

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

Returns:
statelist
  • The list of battery status.

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

Drone_readFlightMode(timeout=3)

Read the flight mode of drone.

Parameters:
timeoutint

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

Returns:
modeint

0: Attitude mode 1: Position mode

Drone_readInposition(timeout=3)

Read drone current inposition.

Parameters:
timeoutint

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

Returns:
statelist
  • The UB list of inposition

  • 0: false, 1: true

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

Drone_readStatus(timeout=3)

Read drone status.

Parameters:
timeoutint

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

Returns:
statusint

0: Stop. 1: Idle. 2: Pre-rotation. 3: Take off. 4: Flight

Drone_readTakeOffStatus(timeout=3)

Read drone’s take off status.

Parameters:
timeoutint

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

Returns:
statusint

0: Not in the takeoff procedure. 1: Running.

Drone_readTaskControlMode(timeout=3)

Read the task control mode of drone.Please turn to mission computer mode.

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 UB list of trajectory

  • 0: false, 1: true

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

Drone_readVelocity(timeout=3)

Read drone current velocity.

Parameters:
timeoutint

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

Returns:
statelist
  • The list of velocity

  • [roll(deg/s), pitch(deg/s), yaw(deg/s), X(m/s), Y(m/s), Z(m/s)]

Drone_startLanding(timeout=3)

Start drone landing.

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 drone take off.

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_stop(timeout=3)

Halt 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_stopLanding(timeout=3)

Stop drone landing.

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_stopTakeOff(timeout=3)

Stop drone take off.

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_writeFlightMode(mode, timeout=3)

Write the flight mode of drone.

Parameters:
modeint

0: Attitude mode. 1: Position mode.

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_writeVelocity(target, velocity, timeout=3)

Write drone current velocity.

Parameters:
timeoutint

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

Returns:
statelist
  • The list of velocity

  • [roll(deg/s), pitch(deg/s), yaw(deg/s), X(m/s), Y(m/s), Z(m/s)]

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