This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision | ||
|
doc:crazyflie:crtp:generic_setpoint [2018-02-15 09:23] arnaud |
doc:crazyflie:crtp:generic_setpoint [2020-05-12 14:19] (current) kimberly |
||
|---|---|---|---|
| Line 1: | Line 1: | ||
| + | <WRAP center round important 60%> | ||
| + | This page has deprecated and moved to the new documentation framework of the main Bitcraze website. Please go to [[https:// | ||
| + | </ | ||
| + | |||
| + | |||
| ====== Generic Setpoint CRTP Port ====== | ====== Generic Setpoint CRTP Port ====== | ||
| Line 18: | Line 23: | ||
| | 1 | [[doc: | | 1 | [[doc: | ||
| | 2 | [[doc: | | 2 | [[doc: | ||
| + | | 3 | [[doc: | ||
| + | | 4 | [[doc: | ||
| + | | 5 | [[doc: | ||
| + | | 6 | [[doc: | ||
| + | | 7 | [[doc: | ||
| Line 52: | Line 62: | ||
| </ | </ | ||
| + | ==== CPPM Emulation ==== | ||
| + | |||
| + | CRTP packet containing an emulation of CPPM channels | ||
| + | Channels have a range of 1000-2000 with a midpoint of 1500 | ||
| + | Supports the ordinary RPYT channels plus up to MAX_AUX_RC_CHANNELS auxiliary channels. | ||
| + | Auxiliary channels are optional and transmitters do not have to transmit all the data | ||
| + | unless a given channel is actually in use (numAuxChannels must be set accordingly) | ||
| + | |||
| + | Current aux channel assignments: | ||
| + | * AuxChannel0: | ||
| + | |||
| + | Payload format: | ||
| + | <code c> | ||
| + | #define MAX_AUX_RC_CHANNELS 10 | ||
| + | |||
| + | static float s_CppmEmuRollMaxRateDps = 720.0f; // For rate mode | ||
| + | static float s_CppmEmuPitchMaxRateDps = 720.0f; // For rate mode | ||
| + | static float s_CppmEmuRollMaxAngleDeg = 50.0f; // For level mode | ||
| + | static float s_CppmEmuPitchMaxAngleDeg = 50.0f; // For level mode | ||
| + | static float s_CppmEmuYawMaxRateDps = 400.0f; // Used regardless of flight mode | ||
| + | |||
| + | struct cppmEmuPacket_s { | ||
| + | struct { | ||
| + | uint8_t numAuxChannels : 4; // Set to 0 through MAX_AUX_RC_CHANNELS | ||
| + | uint8_t reserved : 4; | ||
| + | } hdr; | ||
| + | uint16_t channelRoll; | ||
| + | uint16_t channelPitch; | ||
| + | uint16_t channelYaw; | ||
| + | uint16_t channelThrust; | ||
| + | uint16_t channelAux[MAX_AUX_RC_CHANNELS]; | ||
| + | } __attribute__((packed)); | ||
| + | </ | ||
| + | |||
| + | ==== Altitude Hold ==== | ||
| + | |||
| + | Set the Crazyflie vertical velocity and roll/pitch angle. | ||
| + | |||
| + | Payload format: | ||
| + | <code c> | ||
| + | struct altHoldPacket_s { | ||
| + | float roll; // rad | ||
| + | float pitch; | ||
| + | float yawrate; | ||
| + | float zVelocity; | ||
| + | } __attribute__((packed)); | ||
| + | </ | ||
| + | |||
| + | ==== Hover ==== | ||
| + | |||
| + | Set the Crazyflie absolute height and velocity in the body coordinate system. | ||
| + | |||
| + | Payload format: | ||
| + | <code c> | ||
| + | struct hoverPacket_s { | ||
| + | float vx; // m/s in the body frame of reference | ||
| + | float vy; // ... | ||
| + | float yawrate; | ||
| + | float zDistance; | ||
| + | } __attribute__((packed)); | ||
| + | </ | ||
| + | |||
| + | ==== Full State ==== | ||
| + | |||
| + | Set the full state. | ||
| + | |||
| + | Payload format: | ||
| + | <code c> | ||
| + | struct fullStatePacket_s { | ||
| + | int16_t x; // position - mm | ||
| + | int16_t y; | ||
| + | int16_t z; | ||
| + | int16_t vx; // velocity - mm / sec | ||
| + | int16_t vy; | ||
| + | int16_t vz; | ||
| + | int16_t ax; // acceleration - mm / sec^2 | ||
| + | int16_t ay; | ||
| + | int16_t az; | ||
| + | int32_t quat; // compressed quaternion, see quatcompress.h | ||
| + | int16_t rateRoll; | ||
| + | int16_t ratePitch; // (NOTE: limits to about 5 full circles per sec. | ||
| + | int16_t rateYaw; | ||
| + | } __attribute__((packed)); | ||
| + | </ | ||
| + | |||
| + | === Position === | ||
| + | |||
| + | Set the absolute postition and orientation. | ||
| + | |||
| + | <code c> | ||
| + | | ||
| + | float x; // Position in m | ||
| + | float y; | ||
| + | float z; | ||
| + | float yaw; // Orientation in degree | ||
| + | } __attribute__((packed)); | ||
| + | </ | ||