Structs

데이터 송수신 시에 사용하는 구조체들을 소개합니다.

Protocol::Header

헤더.

데이터 송수신 시에 사용하는 헤더입니다.

namespace Protocol
{
    struct Header
    {
        u8      dataType;       // 데이터의 형식
        u8      length;         // 데이터의 길이
        u8      from;           // 데이터를 전송하는 장치의 DeviceType
        u8      to;             // 데이터를 수신하는 장치의 DeviceType
        
    };
}

변수 이름.

형식.

크기.

범위.

설명.

dataType

Protocol::DataType::Type

1 Byte

-

데이터의 타입.

length

uint8_t

1 Byte

0 ~ 255

데이터의 길이.

from

Protocol::DeviceType::Type

1 Byte

-

데이터를 전송하는 장치.

to

Protocol::DeviceType::Type

1 Byte

-

데이터를 수신하는 장치.

Protocol::Ping

Ping

특정 장치가 존재하는지를 확인할 때 사용합니다. 응답은 Ack를 받습니다.

변수 이름.

형식.

크기.

범위.

설명.

systemTime

uint64_t

8 Byte

-

시스템 시

Protocol::Ack

응답.

특정한 데이터를 요청하지 않은 경우에 Ack를 응답으로 전송합니다. 수신 받은 데이터의 crc16을 포함하여 돌려보내기 때문에 데이터를 전송한 측에서 정상적으로 데이터를 전송했는지 판별하는데 사용합니다.

변수 이름.

형식.

크기.

범위.

설명.

systemTime

uint64_t

8 Byte

-

시스템 시간.

dataType

Protocol::DataType::Type

1 Byte

-

수신 받은 데이터 타입.

crc16

uint16_t

2 Byte

-

수신 받은 헤더와 데이터의 CRC16 값.

Protocol::Error

오류.

드론에 문제가 생긴 경우 Error 구조체를 600ms에 한 번 RF를 통해 송신합니다. errorFlagsForSensor와 errorFlagsForState는 각각의 값에 해당하는 플래그를 조합하여 여러 오류들이 동시에 발생하는 것을 표시합니다. 문제가 완전히 없어진 경우 Error 플래그를 0으로 초기화하여 추가로 5회 전송 후 전송을 중단합니다.

변수 이름.

형식.

크기.

범위.

설명.

systemTime

uint64_t

8 Byte

-

시스템 시간.

errorFlagsForSensor

ErrorFlagsForSensor::Type

4 Byte

-

센서 오류 플래그 조합.

errorFlagsForState

ErrorFlagsForState::Type

4 Byte

-

상태 오류 플래그 조합.

Protocol::Request

데이터 요청.

변수 이름.

형식.

크기.

범위.

설명.

dataType

Protocol::DataType::Type

1 Byte

-

요청할 데이터 타입.

Protocol::Address

장치 주소(고유번호).

변수 이름.

형식.

크기.

범위.

설명.

address

uint8_t Array

16 Byte

-

장치 주소.

Protocol::Information

펌웨어 정보.

변수 이름.

형식.

크기.

범위.

설명.

modeUpdate

Mode::Update::Type

1 Byte

-

업데이트 모드.

modelNumber

ModelNumber::Type

4 Byte

-

모델 번호.

version

Protocol::Version

4 Byte

-

펌웨어의 버전.

year

uint16_t

2 Byte

-

펌웨어 빌드 년.

month

uint8_t

1 Byte

-

펌웨어 빌드 월.

day

uint8_t

1 Byte

-

펌웨어 빌드 일.

Protocol::Version

펌웨어 버전.

버전 비교 시 v값으로 비교할 수 있도록 struct 내부의 변수 배치 순서를 다른 구조체들과 다르게 역순으로 배열하였습니다.

변수 이름.

형식.

크기.

범위.

설명.

build

uint16_t

14 bit

0 ~ 65535

빌드 번호.

minor

uint8_t

1 Byte

0 ~ 255

부 번호.

major

uint8_t

1 Byte

0 ~ 255

주 번호.

v

uint32_t

4 Byte

-

build, minor, major를 하나로 묶은 것.

Control::Quad8

드론.

변수 이름.

형식.

크기.

범위.

설명.

음수 값(-)

양수 값(+)

roll

int8_t

1 Byte

-100 ~ 100

좌우.

좌측.

우측.

pitch

int8_t

1 Byte

-100 ~ 100

전후.

후방.

전방.

yaw

int8_t

1 Byte

-100 ~ 100

좌우 회전.

시계 방향.

반시계 방향.

throttle

int8_t

1 Byte

-100 ~ 100

승하강.

하강.

상승.

Control::Quad8AndRequestData

드론 조종 및 데이터 요청.

조종 명령 시 응답 데이터로 Ack 대신 요청한 데이터를 응답으로 보내게 합니다.

변수 이름.

형식.

크기.

범위.

설명.

음수 값(-)

양수 값(+)

roll

int8_t

1 Byte

-100 ~ 100

좌우.

좌측.

우측.

pitch

int8_t

1 Byte

-100 ~ 100

전후.

후방.

전방.

yaw

int8_t

1 Byte

-100 ~ 100

좌우 회전.

시계 방향.

반시계 방향.

throttle

int8_t

1 Byte

-100 ~ 100

승하강.

하강.

상승.

dataType

Protocol::DataType::Type

-

1 Byte

요청할 데이터

-

-

Control::Position16

드론 이동 .

드론에 이동 명령을 내리는 경우 사용합니다.

변수 이름.

형식.

크기.

범위.

.

설명.

positionX

int16_t

2 Byte

-100 ~ 100(-10.0 ~ 10.0)

meter x 10

앞(+), 뒤(-)

positionY

int16_t

2 Byte

-100 ~ 100(-10.0 ~ 10.0)

meter x 10

좌(+), 우(-)

positionZ

int16_t

2 Byte

-100 ~ 100(-10.0 ~ 10.0)

meter x 10

위(+), 아래(-)

velocity

int16_t

2 Byte

0 ~ 50(0.0 ~ 5.0)

m/s x 10

이동 속도

heading

int16_t

2 Byte

-360 ~ 360

degree

반시계방향(+), 시계방향(-)

rotationalVelocity

int16_t

2 Byte

10 ~ 180

degree/s

좌우 회전 속도

Control::Position

드론 이동 명령.

드론에 이동 명령을 내리는 경우 사용합니.

변수 이름.

형식.

크기.

범위.

.

설명.

positionX

float

4 Byte

-10.0 ~ 10.0

meter

앞(+), 뒤(-)

positionY

float

4 Byte

-10.0 ~ 10.0

meter

좌(+), 우(-)

positionZ

float

4 Byte

-10.0 ~ 10.0

meter

위(+), 아래(-)

velocity

float

4 Byte

0.0 ~ 5.0

m/s

앞뒤 이동 속도

heading

float

2 Byte

-360 ~ 360

degree

반시계방향(+), 시계방향(-)

rotationalVelocity

float

2 Byte

10 ~ 180

degree/s

좌우 회전 속도

Protocol::Command::Command

설정 변경.

변수 이름.

형식.

크기.

범위.

설명.

commandType

Protocol::CommandType::Type

1 Byte

-

명령 타입

option

Mode::Control::Flight::Type

1 Byte

-

좌(+), 우(-)

System::FlightEvent::Type

-

Headless::Type

-

System::Trim::Type

-

Mode::Controller::Type

-

uint8_t

Protocol::Command::LightEvent

설정 변경 + LED 이벤트.

변수 이름.

형식.

크기.

범위.

설명.

command

Protocol::Command::Command

2 Byte

-

명령.

event

Protocol::Light::Event

4 Byte

-

LED 이벤트.

Protocol::Command::LightEventColor

설정 변경 + LED 이벤트(RGB)

변수 이름.

형식.

크기.

범위.

설명.

command

Protocol::Command::Command

2 Byte

-

명령.

event

Protocol::Light::Event

4 Byte

-

LED 이벤트.

color

Light::Color

3 Byte

-

LED RGB 색상.

Protocol::Command::LightEventColors

설정 변경 + LED 이벤트(Palette)

변수 이름.

형식.

크기.

범위.

설명.

command

Protocol::Command::Command

2 Byte

-

명령.

event

Protocol::Light::Event

4 Byte

-

LED 이벤트.

color

Light::Color::Type

1 Byte

-

LED 팔레트 .

Protocol::Pairing

페어링.

장치의 페어링 정보를 확인하거나 변경할 때 사용합니다. address0, address1, address2를 모두 0으로 설정한 경우 RF 데이터 송신을 실행하지 않으며, 데이터 수신 시에도 해당 데이터를 무시합니다. channelArray에는 모두 4개의 채널이 들어가며, 주파수 호핑(FHSS) 동작 시 지정한 모든 채널을 사용하고, 주파수 고정 동작 시 배열의 첫 번째에 있는 채널을 사용합니다.

변수 이름.

형식.

크기.

범위.

설명.

address0

uint16_t

2 Byte

0x0000 ~ 0xFFFF

주소0

address1

uint16_t

2 Byte

0x0000 ~ 0xFFFF

주소1

address2

uint16_t

2 Byte

0x0000 ~ 0xFFFF

주소2

scramble

uint8_t

1 Byte

0x00 ~ 0x7F(0~127)

스크램블.

channelArray

uint8_t

4 Byte

0~81

채널.

Protocol::Rssi

RSSI

Received signal strength indication http://www.metageek.com/training/resources/understanding-rssi.html 현재 무선으로 연결된 장치의 신호 세기를 반환합니다.

변수 이름.

형식.

크기.

범위.

설명.

rssi

int8_t

1 Byte

-100 ~ 0

신호 세기.

Protocol::RawMotion

Motion 센서 RAW 데이터.

변수 이름.

형식.

크기.

범위.

설명.

accelX

Int16

2 Byte

-32,768 ~ 32,767

가속도 X

accelY

Int16

2 Byte

-32,768 ~ 32,767

가속도 Y

accelZ

Int16

2 Byte

-32,768 ~ 32,767

가속도 Z

gyroRoll

Int16

2 Byte

-32,768 ~ 32,767

자이로 Roll

gyroPitch

Int16

2 Byte

-32,768 ~ 32,767

자이로 Pitch

gyroYaw

Int16

2 Byte

-32,768 ~ 32,767

자이로 Yaw

Protocol::RawFlow

Flow 센서 RAW 데이터.

변수 이름.

형식.

크기.

범위.

설명.

x

float

4 Byte

-

X축.

y

float

4 Byte

-

Y축.

Protocol::State

드론의 현재 상태.

변수 이름.

형식.

크기.

범위.

설명.

modeSystem

Mode::System::Type

1 Byte

-

System 동작 모드.

modeFlight

Mode::Flight::Type

1 Byte

-

비행 제어기 동작 모드.

modeControlFlight

Mode::Control::Flight::Type

1 Byte

-

비행 제어 모드.

modeMovement

Mode::Movement::Type

1 Byte

-

이동 상태.

headless

Headless::Type

1 Byte

-

Headless 설정 상태.

controlSpeed

uint8_t

1 Byte

-

제어 속도(1,2,3)

sensorOrientation

SensorOrientation:Type

1 Byte

-

센서 방향

battery

uint8_t

1 Byte

0 ~ 100

드론 배터리 잔량.

Protocol::StateController

조종의 현재 상태.

변수 이름.

형식.

크기.

범위.

설명.

modeSystem

Mode::System::Type

1 Byte

-

System 동작 모드.

modeController

Mode::Controller::Type

1 Byte

-

조종기 동작 모드.

modeConnection

Mode::Connection::Type

1 Byte

-

연결 모드.

deviceType

Protocol::DeviceType::Type

1 Byte

-

장치 타입.

rssi

int8_t

1 Byte

-

RSSI

systemTime

uint32_t

4 Byte

-

시스템 시간(ms)

timeConnected

uint32_t

4 Byte

-

연결된 이후부터의 시간(ms)

timeLostConnection

uint32_t

4 Byte

0 ~ 100

연결이 끊어지고 나서의 시간(ms)

countCycleTransferRF

uint8_t

1 Byte

0 ~ 255

1초당 전송 횟수 RF

countCycleReceiveRF

uint8_t

1 Byte

0 ~ 255

1초당 수신 횟수 RF

countCycleTransferExternal

uint8_t

1 Byte

0 ~ 255

1초당 전송 횟수 External

countCycleReceiveExternal

uint8_t

1 Byte

0 ~ 255

1초당 수신 횟수 External

countCycleTransferUSB

uint8_t

1 Byte

0 ~ 255

1초당 전송 횟수 USB

countCycleReceiveUSB

uint8_t

1 Byte

0 ~ 255

1초당 수신 횟수 USB

Protocol::StateLink

LINK 모듈의 현재 상태.

변수 이름.

형식.

크기.

범위.

설명.

modeSystem

Mode::System::Type

1 Byte

-

System 동작 모드.

modeConnection

Mode::Connection::Type

1 Byte

-

연결 모.

deviceType

Protocol::DeviceType::Type

1 Byte

-

장치 타입.

rssi

int8_t

1 Byte

-

RSSI

systemTime

uint32_t

4 Byte

-

시스템 시간(ms)

timeConnected

uint32_t

4 Byte

-

연결된 이후부터의 시간(ms)

timeLostConnection

uint32_t

4 Byte

0 ~ 100

연결이 끊어지고 나서의 시간(ms)

countCycleTransferRF

uint8_t

1 Byte

0 ~ 255

1초당 전송 횟수 RF

countCycleReceiveRF

uint8_t

1 Byte

0 ~ 255

1초당 수신 횟수 RF

countCycleTransferExternal

uint8_t

1 Byte

0 ~ 255

1초당 전송 횟수 External

countCycleReceiveExternal

uint8_t

1 Byte

0 ~ 255

1초당 수신 횟수 External

countCycleTransferUSB

uint8_t

1 Byte

0 ~ 255

1초당 전송 횟수 USB

countCycleReceiveUSB

uint8_t

1 Byte

0 ~ 255

1초당 수신 횟수 USB

Protocol::Attitude

자세.

변수 이름.

형식.

크기.

범위.

설명.

roll

int16_t

2 Byte

-32,768 ~ 32,767

Roll

pitch

int16_t

2 Byte

-32,768 ~ 32,767

Pitch

yaw

int16_t

2 Byte

-32,768 ~ 32,767

Yaw

드론의 자세를 확인할 때 값의 범위는 다음과 같습니다.

변수 이름.

형식.

크기.

범위.

설명.

roll

int16_t

2 Byte

-90 ~ 90

좌우 기울기 각도

pitch

int16_t

2 Byte

-90 ~ 90

전후 기울기 각도

yaw

int16_t

2 Byte

-180 ~ 180

좌우 회전 시 각

Protocol::Position

‌위치.

변수 이름.

형식.

크기.

범위.

단위.

설명.

x

float

4 Byte

-100.0 ~ 100.0

meter

앞(+),뒤(-)

y

float

4 Byte

-100.0 ~ 100.0

meter

좌(+),우(-)

z

float

4 Byte

-100.0 ~ 100.0

meter

위(+),아래(-)

Protocol::Altitude

고.

변수 이름.

형식.

크기.

범위.

설명.

temperature

float

4 Byte

-

온도.

pressure

float

4 Byte

-

압력.

altitude

float

4 Byte

-

고도.

rangeHeight

float

4 Byte

-

거리 센서의

Protocol::Motion

Motion 센서 데이터와 드론의 자세.

변수 이름.

형식.

크기.

범위.

단위.

설명.

accelX

int16_t

2 Byte

-1,568 ~ 1,568

(-156.8 ~ 156.8)

m/s2 x 10

가속도 X

accelY

int16_t

2 Byte

-1,568 ~ 1,568

(-156.8 ~ 156.8)

m/s2 x 10

가속도 Y

accelZ

int16_t

2 Byte

-1,568 ~ 1,568

(-156.8 ~ 156.8)

m/s2 x 10

가속도 Z

gyroRoll

int16_t

2 Byte

-2,000 ~ 2,000

degree/s

자이로 Roll

gyroPitch

int16_t

2 Byte

-2,000 ~ 2,000

degree/s

자이로 Pitch

gyroYaw

int16_t

2 Byte

-2,000 ~ 2,000

degree/s

자이로 Yaw

angleRoll

int16_t

2 Byte

-180 ~ 180

degree

자세 Roll

angelPitch

int16_t

2 Byte

-180 ~ 180

degree

자세 Pitch

angleYaw

int16_t

2 Byte

-180 ~ 180

degree

자세 Yaw

Protocol::Range

Range 센서 데이터 출력.

변수 이름.

형식.

크기.

범위.

단위.

설명.

left

int16_t

2 Byte

0 ~ 2,000

mm

왼쪽을 바라보는 거리 센서의 출력 값.

front

int16_t

2 Byte

0 ~ 2,000

mm

정면을 바라보는 거리 센서의 출력 값.

right

int16_t

2 Byte

0 ~ 2,000

mm

오른쪽을 바라보는 거리 센서의 출력 값.

rear

int16_t

2 Byte

0 ~ 2,000

mm

뒤를 바라보는 거리 센서의 출력 값.

top

int16_t

2 Byte

0 ~ 2,000

mm

위쪽을 바라보는 거리 센서의 출력 값.

bottom

int16_t

2 Byte

0 ~ 2,000

mm

쪽을 바라보는 거리 센서의 출력 값.

Protocol::Count

카운트.

비행 시간 및 관련 카운트 값을 읽을 때 사용합니다.

변수 이름.

형식.

크기.

범위.

설명.

timeSystem

uint32_t

4 Byte

-

시스템 동작 시간(sec)

timeFlight

uint32_t

4 Byte

-

비행 시간(sec)

countTakeOff

uint16_t

2 Byte

0 ~ 65,535

이륙 횟수

countLanding

uint16_t

2 Byte

0 ~ 65,535

착륙 횟수

countAccident

uint16_t

2 Byte

0 ~ 65,535

충돌

Protocol::Bias

바이어스.

변수 이름.

형식.

크기.

범위.

설명.

accelX

int16_t

2 Byte

-32,768 ~ 32,767

Accel X

accelY

int16_t

2 Byte

-32,768 ~ 32,767

Accel Y

accelZ

int16_t

2 Byte

-32,768 ~ 32,767

Accel Z

gyroRoll

int16_t

2 Byte

-32,768 ~ 32,767

Gyro Roll

gyroPitch

int16_t

2 Byte

-32,768 ~ 32,767

Gyro Pitch

gyroYaw

int16_t

2 Byte

-32,768 ~ 32,767

Gyro Yaw

Protocol::Trim

Trim

변수 이름.

형식.

크기.

범위.

설명.

roll

int16_t

2 Byte

-200 ~ 200

Roll

pitch

int16_t

2 Byte

-200 ~ 200

Pitch

yaw

int16_t

2 Byte

-200 ~ 200

Yaw

throttle

int16_t

2 Byte

-200 ~ 200

Throttle

Protocol::Weight

무게.

변수 이름.

형식.

크기.

범위.

설명.

weight

float

4 Byte

100 ~ 150

무게.

Protocol::LostConnection

연결이 끊어졌을 때 드론 동작을 처리할 시간 설정.

단위는 ms, 값을 0으로 설정할 경우 해당 항목은 무시. 마지막으로 드론 조종 명령을 전송한 장치와의 연결이 끊어지면, 지정한 시간 후 조종 중립, 착륙, 강제 정지를 실행합니다. 기본으로 연결된 장치는 Rf이며, 설정값은 플래시 메모리에 저장되지 않으므로 매번 드론을 새로 시작할 때마다 설정해야 합니.

변수 이름.

형식.

크기.

범위.

설명.

timeNeutral

uint16_t

2 Byte

0 ~ 65,535

연결이 끊어졌을 때 조종 중립으로 변경할 시.

timeLanding

uint16_t

2 Byte

0 ~ 65,535

연결이 끊어졌을 때 드론을 착륙할 시간.

timeStop

uint32_t

4 Byte

0 ~ 4,294,967,295

연결이 끊어졌을 때 드론을 정할 시간.

Protocol::Motor

모.

모터 4개를 동시에 작동시키거나, 현재 모터에 입력된 값을 확인할 때 사용합니다. 아래의 구조체를 배열로 사용합니다.

변수 이름.

형식.

크기.

범위.

설명.

rotation

Rotation::Type

1 Byte

-

회전 방향.

value

uint16_t

2 Byte

0 ~ 4,095

회전 속도.

Protocol::MotorSingle

한 개의 모터 제어.

하나의 모터를 동작시키거나, 현재 모터에 입력된 값을 확인할 때 사용합니다. 아래의 구조체를 배열로 사용합니다.

변수 이름.

형식.

크기.

범위.

설명.

rotation

Rotation::Type

1 Byte

-

회전 방향.

value

uint16_t

2 Byte

0 ~ 4,095

회전 속도.

Protocol::BuzzerMelody

한 개의 모터 제어.

변수 이름.

형식.

크기.

범위.

설명.

melody

Buzzer::Melody::Type

1 Byte

-

멜로디.

repeat

uint8_t

1 Byte

0 ~ 255

반복 속도.

Protocol::Buzzer

버저.

변수 이름.

형식.

크기.

범위.

설명.

mode

Buzzer::Mode::Type

1 Byte

-

버저 동작 모드.

value

Buzzer::Scale::Type

2 Byte

-

Scale.

uint16_t

2 Byte

0 ~ 8,000

Hz.

time

uint16_t

2 Byte

0 ~ 65,535

소리를 지속할 시간(ms)

Protocol::Vibrator

.

변수 이름.

형식.

크기.

범위.

설명.

mode

Vibrator::Mode::Type

1 Byte

-

진동 동작 모드.

on

uint16_t

2 Byte

0 ~ 65,535

진동을 켠 시간 (ms)

off

uint16_t

2 Byte

0 ~ 65,535

진동을 시간 (ms

total

uint16_t

2 Byte

0 ~ 65,535

전체 시간(ms)

Protocol::Button

버튼.

변수 이름.

형식.

크기.

범위.

설명.

button

uint16_t

2 Byte

-

버튼 입력.

event

Button::Event::Type

1 Byte

-

버튼 이벤트.

Protocol::JoystickBlock

조종기 조이스틱 한 축의 입력 값 .

변수 이름.

형식.

크기.

범위.

설명.

x

int8_t

1 Byte

-100 ~ 100

조이스틱 가로축.

y

int8_t

1 Byte

-100 ~ 100

조이스틱 세로축.

direction

Joystick::Direction::Type

1 Byte

-

조이스틱 향.

event

Joystick::Event::Type

1 Byte

-

이벤트.

Protocol::Joystick

조종기 조이스틱 한 축의 입력 .

변수 이름.

형식.

크기.

범위.

설명.

left

Protocol::JoystickBlock

4 Byte

-

왼쪽 조이스틱.

right

Protocol::JoystickBlock

4 Byte

-

오른쪽 조이스틱.

Protocol::InformationAssembledForController

자주 갱신되는 데이터 모음(조종기)

조종기에 표시되는 데이터의 갱신 속도를 높일 목적으로 여러 데이터를 하나로 합친 구조체.

Protocol::InformationAssembledForEntry

자주 갱신되는 데이터 모음(엔트리).

Protocol::InformationAssembledForByblocks

자주 갱신되는 데이터 모음().

Last updated