petrone_v2 for python / System

Modified : 2018.10.8


System과 관련된 정의를 소개합니다.



DeviceType

장치 타입

주로 데이터 송수신 시 데이터를 보낸 곳과 받을 곳을 지정할 때 사용합니다.

class DeviceType(Enum):
    
    None_               = 0x00

    Drone               = 0x30      # 드론
    Controller          = 0x31      # 조종기
    Link                = 0x32      # 링크 모듈
    Tester              = 0x33      # 테스터
    Monitor             = 0x34      # 모니터
    Updater             = 0x35      # 펌웨어 업데이트 도구
    Encrypter           = 0x36      # 암호화 도구
    Scratch             = 0x37      # 스크래치
    Entry               = 0x38      # 네이버 엔트리
    ByScratch           = 0x39      # 바이스크래치

    EndOfType           = 0x40

    Broadcasting        = 0xFF



ModeVehicle

Vehicle 동작 모드

class ModeVehicle(Enum):
    
    None_               = 0x00

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

    Drive               = 0x20
    DriveFPV            = 0x21

    Test                = 0x30

    EndOfType           = 0x31



ModeSystem

System 동작 모드

class ModeSystem(Enum):
    
    None_               = 0x00

    Boot                = 0x01
    Start               = 0x02
    Running             = 0x03
    ReadyToReset        = 0x04
    Error               = 0x05

    EndOfType           = 0x06



ModeFlight

비행 제어기 동작 모드

class ModeFlight(Enum):
    
    None_               = 0x00

    Ready               = 0x10

    Start               = 0x11
    TakeOff             = 0x12
    Flight              = 0x13
    Landing             = 0x14
    Flip                = 0x15
    Reverse             = 0x16

    Stop                = 0x20

    Accident            = 0x30
    Error               = 0x31

    Test                = 0x40

    EndOfType           = 0x41



ModeDrive

주행 제어기 동작 모드

class ModeDrive(Enum):
    
    None_               = 0x00

    Ready               = 0x10
    Start               = 0x11
    Drive               = 0x12

    Stop                = 0x20

    Accident            = 0x30
    Error               = 0x31

    Test                = 0x40

    EndOfType           = 0x41



ModeUpdate

업데이트 동작 모드

class ModeUpdate(Enum):

    None_           = 0x00
    
    Ready           = 0x01  # 업데이트 가능 상태
    Update          = 0x02  # 업데이트 중
    Complete        = 0x03  # 업데이트 완료
        
    Failed          = 0x04  # 업데이트 실패(업데이트 완료까지 갔으나 body의 CRC16이 일치하지 않는 경우 등)
    
    NotAvailable    = 0x05  # 업데이트 불가능 상태(Debug 모드 등)
    RunApplication  = 0x06  # 어플리케이션 동작 중
    
    EndOfType       = 0x07



ErrorFlagsForSensor

센서 오류 플래그

class ErrorFlagsForSensor(Enum):

    None_                       = 0x00000000

    Imu_NoAnswer                = 0x00000001    # IMU 응답 없음
    Imu_WrongValue              = 0x00000002
    Imu_NotCalibrated           = 0x00000004    # Gyro Bias 보정이 완료되지 않음
    Imu_Calibrating             = 0x00000008    # Gyro Bias 보정 중

    Pressure_NoAnswer           = 0x00000010    # 압력센서 응답 없음
    Pressure_WrongValue         = 0x00000020

    RangeGround_NoAnswer        = 0x00000100    # 바닥 거리센서 응답 없음
    RangeGround_WrongValue      = 0x00000200

    Camera_NoAnswer             = 0x00001000    # 카메라 응답 없음
    OpticalFlow_WrongValue      = 0x00002000

    Battery_NoAnswer            = 0x00010000    # 배터리 응답 없음
    Battery_WrongValue          = 0x00020000
    Battery_NotCalibrated       = 0x00040000    # 배터리 입력값 보정이 완료되지 않음



ErrorFlagsForState

상태 오류 플래그

class ErrorFlagsForState(Enum):

    None_                       = 0x00000000

    NotTested                   = 0x00000001    # 테스트하지 않음



DevelopmentStage

개발 단계

class DevelopmentStage(Enum):
    
    Alpha               = 0x00
    Beta                = 0x01 
    ReleaseCandidate    = 0x02
    Release             = 0x03



FlightEvent

비행 이벤트

class FlightEvent(Enum):
    
    None_               = 0x00

    Stop                = 0x10
    TakeOff             = 0x11
    Landing             = 0x12

    Reverse             = 0x13

    Shot                = 0x18
    UnderAttack         = 0x19

    ResetHeading        = 0x1A

    EndOfType           = 0x1B



DriveEvent

주행 이벤트

class DriveEvent(Enum):
    
    None_               = 0x00

    Stop                = 0x10
    
    Shot                = 0x11
    UnderAttack         = 0x12

    EndOfType           = 0x13



Direction

방향

class Direction(Enum):
    
    None_               = 0x00

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

    Top                 = 0x05
    Bottom              = 0x06

    EndOfType           = 0x07



Rotation

회전 방향

모터를 작동시킬 때 회전 방향을 지정하는데 사용합니다.

PETRONE V2에는 총 4개의 모터가 있으며, 왼쪽 앞 모터부터 각각 0, 1, 2, 3번으로 번호가 부여되어 있습니다.

드론 비행 시에 0번과 2번 모터는 시계방향(Clockwise), 1번과 3번 모터는 반시계방향(Counterclockwise)으로 회전합니다.

0번과 1번 모터는 드론이 뒤집어졌을 때, 다시 원래 상태로 복원하기 위해 시계방향과 반시계방향 모두 동작합니다.

2번 모터는 시계 방향, 3번 모터는 반시계 방향으로만 동작합니다.

class Rotation(Enum):
    
    None_               = 0x00

    Clockwise           = 0x01
    Counterclockwise    = 0x02

    EndOfType           = 0x03



SensorOrientation

센서 방향

드론이 뒤집어졌을 때 상태를 확인하는 용도입니다.

class SensorOrientation(Enum):
    
    None_               = 0x00

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

    EndOfType           = 0x04



Headless

Headless모드

Headless를 선택할 경우, 드론이 이륙할 때 바라보는 방향이나 사용자가 방향을 초기화 할 때 드론이 바라보는 방향을 앞으로 지정합니다. 이 방향을 기준으로 전후좌우 방향이 고정되어 드론이 어느 쪽으로 바라보더라도 지정한 방향을 기준으로 움직입니다.

Normal을 선택할 경우, 드론이 바라보는 방향을 기준으로 전후좌우로 움직입니다.

class Headless(Enum):
    
    None_               = 0x00

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

    EndOfType           = 0x04



Trim

트림

트림 설정 값을 한 단계씩 올리거나 낮출 때 사용합니다.

class Trim(Enum):
    
    None_               = 0x00  # 없음

    RollIncrease        = 0x01  # Roll 증가
    RollDecrease        = 0x02  # Roll 감소
    PitchIncrease       = 0x03  # Pitch 증가
    PitchDecrease       = 0x04  # Pitch 감소
    YawIncrease         = 0x05  # Yaw 증가
    YawDecrease         = 0x06  # Yaw 감소
    ThrottleIncrease    = 0x07  # Throttle 증가
    ThrottleDecrease    = 0x08  # Throttle 감소

    Reset               = 0x09  # 전체 트림 리셋

    EndOfType           = 0x0A



petrone_v2 for python

  1. Intro
  2. System
  3. Protocol
  4. Drone
  5. Examples - Ping
  6. Examples - Information
  7. Examples - Pairing
  8. Examples - Control
  9. Examples - Sensor
  10. Examples - Motor
  11. Examples - Setup
  12. Examples - Buzzer
  13. Examples - Vibrator
  14. Examples - Light
  15. Examples - Display
  16. Examples - Input
  17. Examples - Error


Index