DRONEFIGHTER2017 / Protocol / Structs
Modified : 2018.02.08


Introduce the structures used to send and receive data.



Protocol::Ping

Use for check specific device is exists. Response is ACK type.

namespace Protocol
{
    struct Ping
    {
        u32  systemTime;   // Ping send time
    };
}
  • Device that received this data sent Protocol::Ack



Protocol::Ack

Send Ack when the specific data is not requested. This protocols has crc16 of the received data, it can be checked whether the data was transmitted correctly.

namespace Protocol
{
    struct Ack
    {
        u32     systemTime;     // Recieve time
        u8      dataType;       // Recieve datatype
        u16     crc16;          // Recieve data crc16
    };
}
  • dataType : Protocol::DataType::Type
  • If the data request clearly, response data. Otherwise is Protocol::Ack respond.
  • The crc16 of the received data was sent back in response. It can be checked whether the data was transmitted correctly.



Protocol::Request

Request data to Drone Fighter 2017.

namespace Protocol
{
    struct Request
    {
        u8   dataType;     // Request datatype
    };
}



Control::Double8

Control for drive mode. Ignore in flight mode this command.

namespace Control
{
    struct Double8
    {
        s8      wheel;      // wheel
        s8      accel;      // accel
    };
}

Control::Double8 input values are this range

Name Type Range Direction Minus(-) Plus(+)
wheel s8 -100 ~ 100 Left-Right Left Right
accel s8 -100 ~ 100 Forward-Backward Backward Forward



Control::Quad8

Control for Drone Fighter 2017.

namespace Control
{
    struct Quad8
    {
        s8      roll;       // roll
        s8      pitch;      // pitch
        s8      yaw;        // yaw
        s8      throttle;   // throttle
    };
}

Control input values are this range : ! Drive Mode uses throttle(Forward/Backward) and roll (Left/Right).

Name Type Range Direction Minus(-) Plus(+)
roll s8 -100 ~ 100 Left-Right Left Right
pitch s8 -100 ~ 100 Forward-Backward Backward Forward
yaw s8 -100 ~ 100 Turn Left-Right Turn Left Turn Right
throttle s8 -100 ~ 100 Up/Down Down Up



Protocol::Command

Request data or change settings for Drone Fighter 2017.

namespace Protocol
{
    struct Command
    {
        u8 commandType;   // command type
        u8 option;        // command option
    };
}



Protocol::Address

Respons device address or Change device address.

namespace Protocol
{
    struct Address
    {
        u8   address[8];
    };
}
  • Communication device, such as BLE or Zigbee, and when given a unique device address, return device's unique device address. (DroneFighter is using Zigbee for communication and uses communication chip's MAC address.)



Protocol::State

Drone Fighter 2017's current state response.

namespace Protocol
{
    struct State
    {
        u8          modeVehicle;        // vehicle mode.
        
        u8          modeSystem;         // system mode
        u8          modeFlight;         // flight mode
        u8          modeDrive;          // drive mode
        
        u8          sensorOrientation;  // sensor orientation
        u8          coordinate;         // coordinate
        u8          battery;            // battery state (0 ~ 100)
    };
}



Protocol::Attitude

Returns the Attitude value.

namespace Protocol
{
    struct Attitude
    {
        s16          roll;         // Roll
        s16          pitch;        // Pitch
        s16          yaw;          // Yaw
    };
}

The drones's attitude range of use is as follows :

Name Type Range Description
roll s16 -180 ~ 180 Angle of roll
pitch s16 -180 ~ 180 Angle of pitch
yaw s16 0 ~ 360 Angle of gravity rotated axis



Protocol::GyroBias

Retruns gyro bias value.

namespace Protocol
{
    struct GyroBias
    {
        s16          roll;         // Roll
        s16          pitch;        // Pitch
        s16          yaw;          // Yaw
    };
}

When checking the gyro sensor data, the range of use is as follows :

Name Type Range
roll s16 -32768 ~ 32767
pitch s16 -32768 ~ 32767
yaw s16 -32768 ~ 32767



Protocol::TrimFlight

Flight mode trim setting protocol.

namespace Protocol
{
    struct TrimFlight
    {
        s16          roll;         // Roll
        s16          pitch;        // Pitch
        s16          yaw;          // Yaw
        s16          throttle;     // Throttle
    };
}



Protocol::TrimDrive

Drive mode trim setting protocol.

namespace Protocol
{
    struct TrimDrive
    {
        s16          wheel;         // Wheel
    };
}



Protocol::TrimAll

All trim setting once.

namespace Protocol
{
    struct TrimAll
    {
        TrimFlight   flight;
        TrimDrive    drive;
    };
}



Protocol::CountFlight

Use to read the stored flight log.

namespace Protocol
{
    struct CountFlight
    {
        u32     timeFlight;             // Flight time
        
        u16     countTakeOff;           // count of Takeoff
        u16     countLanding;           // count of Landing
        u16     countAccident;          // count of Accident
    };
}



Protocol::CountDrive

Use to read the stored drive log.

namespace Protocol
{
    struct CountDrive
    {
        u32     timeDrive;              // Drive time
        
        u16     countAccident;          // count of Accident
    };
}

countAccident variable make for count of accident. But count may also increase due to the impact of uneven road surfaces during actual driving. Consider it meaningless at this time.



Protocol::IrMessage

Data that is used to transfer IR data or sent to an external device when IR data is received.

namespace Protocol
{
    struct IrMessage
    {
        u32     irData;                  // IR message
    };
}
  • Drone Fighter 2017 uses only 7 bits. Therefore, only the values from 0 to 127 can be used.



Protocol::Imu

Returns the value of the gyro sensor and the attitude value of the drone.

namespace Protocol
{
    struct Imu
    {
        u32     systemTime;
        s16     accX;
        s16     accY;
        s16     accZ;
        s16     gyroRoll;
        s16     gyroPitch;
        s16     gyroYaw;
        s16     angleRoll;
        s16     anglePitch;
        s16     angleYaw;
    };
}



Protocol::Button

Drone Controller's button input

namespace Protocol
{
    struct Button
    {
        u8      button;
    };
}



Protocol::Motor

Operate motor or determine the current motor inputs, Mostly used for operate the 4 motors or to check their movement. Use the following structure as an array in this case :

namespace Protocol
{
    struct Motor
    {
        u8	direction;
        s16	value;
    };
}
  • Transport using 4 Protocol::Motor arrays in the data area. Applied to motors 0, 1, 2, 3. The order is from the left front motor to the clockwise. Drone Fighter 2017r can not reverse the motor ; these values are not applicable for motor control when using Motor::Direction:::None or Moto::Direction::Direction::None.

  • direction : Motor::Direction::Type
  • value : 0 ~ 4095



Protocol::MotorSingle

Used to operate one motor or check current inputs to the motor.

namespace Protocol
{
    struct MotorSingle
    {
        u8	target;
        u8	direction;
        s16	value;
    };
}
  • Used to operate motor of specified number. Drone Fighter 2017 can not reverse the motor ; these values are not applicable for motor control when using Motor::Direction:::None or Moto::Direction::Direction::None.
  • target : Motor::Part::Type
  • direction : Motor::Direction::Type
  • value : 0 ~ 4095



Protocol::JoystickBlock

Joystick input value of one axis.

namespace Protocol
{
    struct JoystickBlock
    {
        s8      x;              // X axis(-100 ~ 100)
        s8      y;              // Y aixs(-100 ~ 100)
        u8      direction;      // Joystick direction (Joystick::Direction::Type)
        u8      event;          // Joystick event (Joystick::Event::Type)
        u8      command;        // Joystick command (Joystick::Command::Type)
    };
}



Protocol::Joystick

Joystick input value of the left and right.

namespace Protocol
{
    struct Joystick
    {
        Protocol::JoystickBlock     left;
        Protocol::JoystickBlock     right;
    };
}



Protocol::Buzzer

Use for joystick buzzer.

namespace Protocol
{
    struct Buzzer
    {
        u8      mode;   // Buzzer mode
        u16     value;  // Octave scale or hz
        u16     time;   // Playing time(ms)
    };
}



Protocol::Vibrator

Use for joystick vibrator

namespace Protocol
{
    struct Vibrator
    {
        u8      mode;   // vibrator mode(0 is set, 1 is reserve)
        u16     on;     // vibrator on time(ms)
        u16     off;    // vibrator off time(ms)
        u16     total;  // total playing time(ms)
    };
}



Protocol::UserInterface

Specify the desired function for each button and joystick direction in Joystick setting mode.

namespace Protocol
{
    struct UserInterface
    {
        u8      command;    // command
        u8      function;   // function
    };
}



Protocol::Pairing

Used to pairing the device.

namespace Protocol
{
    struct Pairing
    {
        u16     addressLocal;
        u16     addressRemote;
        u8      channel;
    };
}
  • addressLocal : 0x0001 ~ 0xFFFE, 0x0000은 사용하지 않음, 0xFFFF는 Broadcasting에 사용
  • addressRemote : 0x0001 ~ 0xFFFE, 0x0000은 사용하지 않음, 0xFFFF는 Broadcasting에 사용
  • channel : 0 ~ 255(Undetermination)



DRONE FIGHTER 2017

  1. Intro
  2. Typedef
  3. DataType
  4. Definitions
  5. Structs
  6. Structs - Light


Index