petrone for python / System

Modified : 2018.10.8


Introduce the system definitions.



DeviceType

Device type

Used mostly to determine version of device firmware.

class DeviceType(Enum):
    
    None_               = 0x00

    DroneMain           = 0x01      # Drone main firmware
    DroneSub            = 0x02      # Drone sub firmware
    Link                = 0x03      # Link module
    Tester              = 0x04      # test

    EndOfType           = 0x05



ModeVehicle

Vehicle Mode

class ModeVehicle(Enum):
    
    None_               = 0x00

    FlightGuard         = 0x10
    FlightNoGuard       = 0x11
    FlightFPV           = 0x12

    Drive               = 0x20
    DriveFPV            = 0x21

    Test                = 0x30

    EndOfType           = 0x31



ModeSystem

System Operating Mode

class ModeSystem(Enum):
    
    None_               = 0x00

    Boot                = 0x01      # Booting
    Wait                = 0x02      # Waiting for connect

    Ready               = 0x03      # Ready

    Running             = 0x04      # Running code

    Update              = 0x05      # Firmware update
    UpdateComplete      = 0x06      # Firmware update complete

    Error               = 0x07      # Error

    EndOfType           = 0x08



ModeFlight

Flight mode - system operating

class ModeFlight(Enum):
    
    None_               = 0x00

    Ready               = 0x01      # Ready for fly

    TakeOff             = 0x02      # Takeoff (Automatic transition to flight mode)
    Flight              = 0x03      # Flight
    Flip                = 0x04
    Stop                = 0x05      # Force stop
    Landing             = 0x06      # Landing
    Reverse             = 0x07      # Reverse

    Accident            = 0x08      # Accident (Automatic transition to Ready)
    Error               = 0x09      # Error

    EndOfType           = 0x0A



ModeDrive

Drive mode - system operating

class ModeDrive(Enum):
    
    None_               = 0x00

    Ready               = 0x01      # Ready

    Start               = 0x02      # Start
    Drive               = 0x03      # Drive
    Stop                = 0x04      # Force stop

    Accident            = 0x05      # Accident (Automatic transition to Ready)
    Error               = 0x06      # Error

    EndOfType           = 0x07



ModeUpdate

Update mode - system operating

class ModeUpdate(Enum):

    None_               = 0x00

    Ready               = 0x01      # Ready for Update
    Update              = 0x02      # Updating
    Complete            = 0x03      # Update complete

    Failed              = 0x04      # Update Failed( Ex: Update has reached completion but firmware data body CRC16 does not match, etc.)

    EndOfType           = 0x05



FlightEvent

Flight event

class FlightEvent(Enum):
    
    None_               = 0x00

    TakeOff             = 0x01      # Takeoff

    FlipFront           = 0x02      # Flip to front 
    FlipRear            = 0x03      # Flip to rear
    FlipLeft            = 0x04      # Flip to left
    FlipRight           = 0x05      # Flip to right

    Stop                = 0x06      # Stop
    Landing             = 0x07      # Landing
    Reverse             = 0x08      # Reverse

    Shot                = 0x09      # IR missle shot action
    UnderAttack         = 0x0A      # IR missle underattack action

    EndOfType           = 0x0B



DriveEvent

Drive Event

class DriveEvent(Enum):
    
    None_               = 0x00

    Stop                = 0x01
    
    Shot                = 0x02
    UnderAttack         = 0x03

    EndOfType           = 0x04



Direction

Direction

class Direction(Enum):
    
    None_               = 0x00

    Left                = 0x01
    Front               = 0x02
    Right               = 0x03
    Rear                = 0x04

    Top                 = 0x05
    Bottom              = 0x06

    EndOfType           = 0x07



SensorOrientation

Sensor Orientation

To check the condition when the drone is Reversed.

class SensorOrientation(Enum):
    
    None_               = 0x00

    Normal              = 0x01
    ReverseStart        = 0x02
    Reversed            = 0x03

    EndOfType           = 0x04



Headless

Headless mode

  • Headless mode : The reference directions is fixed in the direction of view when the drones are takeoff.

  • Normal : Moves on the direction the drone is looking.

class Headless(Enum):
    
    None_               = 0x00

    Headless            = 0x01      # Headless
    Normal              = 0x02      # Normal

    EndOfType           = 0x03



Trim

Trim

Used to increase or decrease the trim setting by step.

class Trim(Enum):
    
    None_               = 0x00  # None

    RollIncrease        = 0x01  # Roll Increase
    RollDecrease        = 0x02  # Roll Decrease
    PitchIncrease       = 0x03  # Pitch Increase
    PitchDecrease       = 0x04  # Pitch Decrease
    YawIncrease         = 0x05  # Yaw Increase
    YawDecrease         = 0x06  # Yaw Decrease
    ThrottleIncrease    = 0x07  # Throttle Increase
    ThrottleDecrease    = 0x08  # Throttle Decrease

    Reset               = 0x09  # All trim reset

    EndOfType           = 0x0A



petrone for python

  1. Intro
  2. System
  3. Protocol
  4. Drone
  5. Examples - Information


Index