#include <Crazyflie.h>
Classes | |
struct | batchRequest |
struct | logInfo |
struct | LogTocEntry |
struct | MemoryTocEntry |
struct | paramInfo |
struct | ParamTocEntry |
union | ParamValue |
struct | poly4d |
Public Types | |
enum | BootloaderTarget { TargetSTM32 = 0xFF, TargetNRF51 = 0xFE } |
enum | LogType { LogTypeUint8 = 1, LogTypeUint16 = 2, LogTypeUint32 = 3, LogTypeInt8 = 4, LogTypeInt16 = 5, LogTypeInt32 = 6, LogTypeFloat = 7, LogTypeFP16 = 8 } |
enum | MemoryType { MemoryTypeEEPROM = 0x00, MemoryTypeOneWire = 0x01, MemoryTypeLED12 = 0x10, MemoryTypeLOCO = 0x11, MemoryTypeTRAJ = 0x12, MemoryTypeLOCO2 = 0x13, MemoryTypeLH = 0x14, MemoryTypeTester = 0x15, MemoryTypeUSD = 0x16 } |
enum | ParamType { ParamTypeUint8 = 0x00 | (0x00<<2) | (0x01<<3), ParamTypeInt8 = 0x00 | (0x00<<2) | (0x00<<3), ParamTypeUint16 = 0x01 | (0x00<<2) | (0x01<<3), ParamTypeInt16 = 0x01 | (0x00<<2) | (0x00<<3), ParamTypeUint32 = 0x02 | (0x00<<2) | (0x01<<3), ParamTypeInt32 = 0x02 | (0x00<<2) | (0x00<<3), ParamTypeFloat = 0x02 | (0x01<<2) | (0x00<<3) } |
Public Member Functions | |
struct Crazyflie::poly4d | __attribute__ ((packed)) |
template<class T > | |
void | addSetParam (uint16_t id, const T &value) |
void | alloff () |
Crazyflie (const std::string &link_uri, Logger &logger=EmptyLogger, std::function< void(const char *)> consoleCb=nullptr) | |
void | emergencyStop () |
void | emergencyStopWatchdog () |
std::string | getDeviceTypeName () |
std::string | getFirmwareVersion () |
template<class T > | |
T | getParam (uint16_t id) const |
const ParamTocEntry * | getParamTocEntry (const std::string &group, const std::string &name) const |
int | getProtocolVersion () |
void | goTo (float x, float y, float z, float yaw, float duration, bool relative=false, uint8_t groupMask=0) |
void | land (float height, float duration, uint8_t groupMask=0) |
void | logReset () |
std::vector< LogTocEntry >::const_iterator | logVariablesBegin () const |
std::vector< LogTocEntry >::const_iterator | logVariablesEnd () const |
std::vector< MemoryTocEntry >::const_iterator | memoriesBegin () const |
std::vector< MemoryTocEntry >::const_iterator | memoriesEnd () const |
void | notifySetpointsStop (uint32_t remainValidMillisecs) |
std::vector< ParamTocEntry >::const_iterator | paramsBegin () const |
std::vector< ParamTocEntry >::const_iterator | paramsEnd () const |
void | queueOutgoingPacket (const crtpPacket_t &packet) |
void | readFlash (BootloaderTarget target, size_t size, std::vector< uint8_t > &data) |
void | readUSDLogFile (std::vector< uint8_t > &data) |
void | reboot () |
void | rebootFromBootloader () |
uint64_t | rebootToBootloader () |
void | requestLogToc (bool forceNoCache=false) |
void | requestMemoryToc () |
void | requestParamToc (bool forceNoCache=false) |
void | sendExternalPoseUpdate (float x, float y, float z, float qx, float qy, float qz, float qw) |
void | sendExternalPositionUpdate (float x, float y, float z) |
void | sendFullStateSetpoint (float x, float y, float z, float vx, float vy, float vz, float ax, float ay, float az, float qx, float qy, float qz, float qw, float rollRate, float pitchRate, float yawRate) |
void | sendHoverSetpoint (float vx, float vy, float yawrate, float zDistance) |
void | sendPing () |
void | sendPositionSetpoint (float x, float y, float z, float yaw) |
void | sendSetpoint (float roll, float pitch, float yawrate, uint16_t thrust) |
void | sendStop () |
void | sendVelocityWorldSetpoint (float x, float y, float z, float yawRate) |
void | setConsoleCallback (std::function< void(const char *)> cb) |
void | setEmptyAckCallback (std::function< void(const crtpPlatformRSSIAck *)> cb) |
void | setGenericPacketCallback (std::function< void(const ITransport::Ack &)> cb) |
void | setGroupMask (uint8_t groupMask) |
void | setLinkQualityCallback (std::function< void(float)> cb) |
template<class T > | |
void | setParam (uint16_t id, const T &value) |
template<class T > | |
void | setParamByName (const char *group, const char *name, const T &value) |
void | setRequestedParams () |
void | startSetParamRequest () |
void | startTrajectory (uint8_t trajectoryId, float timescale=1.0, bool reversed=false, bool relative=true, uint8_t groupMask=0) |
void | stop (uint8_t groupMask=0) |
void | sysoff () |
void | syson () |
void | takeoff (float height, float duration, uint8_t groupMask=0) |
void | transmitPackets () |
void | uploadTrajectory (uint8_t trajectoryId, uint32_t pieceOffset, const std::vector< poly4d > &pieces) |
float | vbat () |
void | writeFlash (BootloaderTarget target, const std::vector< uint8_t > &data) |
Static Public Member Functions | |
static size_t | size (LogType t) |
Private Member Functions | |
template<typename R > | |
void | addRequest (const R &request, size_t numBytesToMatch) |
void | addRequestInternal (const uint8_t *data, size_t numBytes, size_t numBytesToMatch) |
void | addSetParam (uint16_t id, const ParamValue &value) |
const LogTocEntry * | getLogTocEntry (const std::string &group, const std::string &name) const |
const ParamValue & | getParam (uint16_t id) const |
template<typename R > | |
const R * | getRequestResult (size_t index) const |
void | handleAck (const ITransport::Ack &result) |
void | handleBatchAck (const ITransport::Ack &result, bool crtpMode) |
void | handleRequests (bool crtpMode=true, bool useSafeLink=ENABLE_SAFELINK, float baseTime=2.0, float timePerRequest=0.2) |
uint8_t | registerLogBlock (std::function< void(crtpLogDataResponse *, uint8_t)> cb) |
template<typename R > | |
void | sendPacket (const R &request, ITransport::Ack &result, bool useSafeLink=ENABLE_SAFELINK) |
template<typename R > | |
void | sendPacket (const R &request, bool useSafeLink=ENABLE_SAFELINK) |
void | sendPacketInternal (const uint8_t *data, uint32_t length, ITransport::Ack &result, bool useSafeLink=ENABLE_SAFELINK) |
bool | sendPacketInternal (const uint8_t *data, uint32_t length, bool useSafeLink=ENABLE_SAFELINK) |
template<typename R > | |
void | sendPacketOrTimeout (const R &request, bool useSafeLink=ENABLE_SAFELINK) |
void | sendPacketOrTimeoutInternal (const uint8_t *data, uint32_t length, bool useSafeLink=ENABLE_SAFELINK, float timeout=1.0) |
void | setParam (uint16_t id, const ParamValue &value) |
void | startBatchRequest () |
bool | unregisterLogBlock (uint8_t id) |
Private Attributes | |
struct Crazyflie::logInfo | __attribute__ |
uint64_t | m_address |
std::vector< batchRequest > | m_batchRequests |
uint8_t | m_channel |
std::function< void(const char *)> | m_consoleCallback |
int | m_curr_down |
int | m_curr_up |
Crazyradio::Datarate | m_datarate |
int | m_devId |
std::function< void(const crtpPlatformRSSIAck *)> | m_emptyAckCallback |
std::function< void(const ITransport::Ack &)> | m_genericPacketCallback |
std::function< void(float)> | m_linkQualityCallback |
bool | m_log_use_V2 |
std::map< uint8_t, std::function< void(crtpLogDataResponse *, uint8_t)> > | m_logBlockCb |
Logger & | m_logger |
std::vector< LogTocEntry > | m_logTocEntries |
std::vector< MemoryTocEntry > | m_memoryTocEntries |
size_t | m_numRequestsEnqueued |
size_t | m_numRequestsFinished |
std::vector< crtpPacket_t > | m_outgoing_packets |
bool | m_param_use_V2 |
std::vector< ParamTocEntry > | m_paramTocEntries |
std::map< uint16_t, ParamValue > | m_paramValues |
int | m_protocolVersion |
Crazyradio * | m_radio |
ITransport * | m_transport |
Friends | |
template<typename T > | |
class | LogBlock |
class | LogBlockGeneric |
Definition at line 30 of file Crazyflie.h.
Enumerator | |
---|---|
TargetSTM32 | |
TargetNRF51 |
Definition at line 84 of file Crazyflie.h.
enum Crazyflie::LogType |
Enumerator | |
---|---|
LogTypeUint8 | |
LogTypeUint16 | |
LogTypeUint32 | |
LogTypeInt8 | |
LogTypeInt16 | |
LogTypeInt32 | |
LogTypeFloat | |
LogTypeFP16 |
Definition at line 66 of file Crazyflie.h.
Enumerator | |
---|---|
MemoryTypeEEPROM | |
MemoryTypeOneWire | |
MemoryTypeLED12 | |
MemoryTypeLOCO | |
MemoryTypeTRAJ | |
MemoryTypeLOCO2 | |
MemoryTypeLH | |
MemoryTypeTester | |
MemoryTypeUSD |
Definition at line 89 of file Crazyflie.h.
enum Crazyflie::ParamType |
Enumerator | |
---|---|
ParamTypeUint8 | |
ParamTypeInt8 | |
ParamTypeUint16 | |
ParamTypeInt16 | |
ParamTypeUint32 | |
ParamTypeInt32 | |
ParamTypeFloat |
Definition at line 33 of file Crazyflie.h.
Crazyflie::Crazyflie | ( | const std::string & | link_uri, |
Logger & | logger = EmptyLogger , |
||
std::function< void(const char *)> | consoleCb = nullptr |
||
) |
Definition at line 32 of file Crazyflie.cpp.
struct Crazyflie::poly4d Crazyflie::__attribute__ | ( | (packed) | ) |
|
inlineprivate |
Definition at line 415 of file Crazyflie.h.
|
private |
Definition at line 1255 of file Crazyflie.cpp.
|
inline |
Definition at line 257 of file Crazyflie.h.
|
private |
Definition at line 894 of file Crazyflie.cpp.
void Crazyflie::alloff | ( | ) |
Definition at line 345 of file Crazyflie.cpp.
void Crazyflie::emergencyStop | ( | ) |
Definition at line 185 of file Crazyflie.cpp.
void Crazyflie::emergencyStopWatchdog | ( | ) |
Definition at line 191 of file Crazyflie.cpp.
std::string Crazyflie::getDeviceTypeName | ( | ) |
Definition at line 152 of file Crazyflie.cpp.
std::string Crazyflie::getFirmwareVersion | ( | ) |
Definition at line 143 of file Crazyflie.cpp.
|
private |
Definition at line 1205 of file Crazyflie.cpp.
|
inline |
Definition at line 267 of file Crazyflie.h.
|
inlineprivate |
Definition at line 492 of file Crazyflie.h.
const Crazyflie::ParamTocEntry * Crazyflie::getParamTocEntry | ( | const std::string & | group, |
const std::string & | name | ||
) | const |
Definition at line 1217 of file Crazyflie.cpp.
int Crazyflie::getProtocolVersion | ( | ) |
Definition at line 134 of file Crazyflie.cpp.
|
inlineprivate |
Definition at line 435 of file Crazyflie.h.
void Crazyflie::goTo | ( | float | x, |
float | y, | ||
float | z, | ||
float | yaw, | ||
float | duration, | ||
bool | relative = false , |
||
uint8_t | groupMask = 0 |
||
) |
Definition at line 1429 of file Crazyflie.cpp.
|
private |
Definition at line 1107 of file Crazyflie.cpp.
|
private |
Definition at line 1370 of file Crazyflie.cpp.
|
private |
Definition at line 1267 of file Crazyflie.cpp.
void Crazyflie::land | ( | float | height, |
float | duration, | ||
uint8_t | groupMask = 0 |
||
) |
Definition at line 1417 of file Crazyflie.cpp.
void Crazyflie::logReset | ( | ) |
Definition at line 161 of file Crazyflie.cpp.
|
inline |
Definition at line 206 of file Crazyflie.h.
|
inline |
Definition at line 209 of file Crazyflie.h.
|
inline |
Definition at line 213 of file Crazyflie.h.
|
inline |
Definition at line 216 of file Crazyflie.h.
void Crazyflie::notifySetpointsStop | ( | uint32_t | remainValidMillisecs | ) |
Definition at line 241 of file Crazyflie.cpp.
|
inline |
Definition at line 199 of file Crazyflie.h.
|
inline |
Definition at line 202 of file Crazyflie.h.
|
inline |
En-queues a generic crtpPacket into a vector so that it can be transmitted later.
packet | the crtpPacket to be en-queued. |
Definition at line 323 of file Crazyflie.h.
void Crazyflie::readFlash | ( | BootloaderTarget | target, |
size_t | size, | ||
std::vector< uint8_t > & | data | ||
) |
Definition at line 522 of file Crazyflie.cpp.
void Crazyflie::readUSDLogFile | ( | std::vector< uint8_t > & | data | ) |
Definition at line 1478 of file Crazyflie.cpp.
void Crazyflie::reboot | ( | ) |
Definition at line 287 of file Crazyflie.cpp.
void Crazyflie::rebootFromBootloader | ( | ) |
Definition at line 329 of file Crazyflie.cpp.
uint64_t Crazyflie::rebootToBootloader | ( | ) |
Definition at line 298 of file Crazyflie.cpp.
|
private |
Definition at line 1229 of file Crazyflie.cpp.
void Crazyflie::requestLogToc | ( | bool | forceNoCache = false | ) |
Definition at line 586 of file Crazyflie.cpp.
void Crazyflie::requestMemoryToc | ( | ) |
Definition at line 857 of file Crazyflie.cpp.
void Crazyflie::requestParamToc | ( | bool | forceNoCache = false | ) |
Definition at line 696 of file Crazyflie.cpp.
void Crazyflie::sendExternalPoseUpdate | ( | float | x, |
float | y, | ||
float | z, | ||
float | qx, | ||
float | qy, | ||
float | qz, | ||
float | qw | ||
) |
Definition at line 256 of file Crazyflie.cpp.
void Crazyflie::sendExternalPositionUpdate | ( | float | x, |
float | y, | ||
float | z | ||
) |
Definition at line 247 of file Crazyflie.cpp.
void Crazyflie::sendFullStateSetpoint | ( | float | x, |
float | y, | ||
float | z, | ||
float | vx, | ||
float | vy, | ||
float | vz, | ||
float | ax, | ||
float | ay, | ||
float | az, | ||
float | qx, | ||
float | qy, | ||
float | qz, | ||
float | qw, | ||
float | rollRate, | ||
float | pitchRate, | ||
float | yawRate | ||
) |
Definition at line 217 of file Crazyflie.cpp.
void Crazyflie::sendHoverSetpoint | ( | float | vx, |
float | vy, | ||
float | yawrate, | ||
float | zDistance | ||
) |
Definition at line 207 of file Crazyflie.cpp.
|
inlineprivate |
Definition at line 364 of file Crazyflie.h.
|
inlineprivate |
Definition at line 379 of file Crazyflie.h.
|
private |
Definition at line 1041 of file Crazyflie.cpp.
|
private |
Definition at line 1015 of file Crazyflie.cpp.
|
inlineprivate |
Definition at line 394 of file Crazyflie.h.
|
private |
Definition at line 1025 of file Crazyflie.cpp.
void Crazyflie::sendPing | ( | ) |
Definition at line 264 of file Crazyflie.cpp.
void Crazyflie::sendPositionSetpoint | ( | float | x, |
float | y, | ||
float | z, | ||
float | yaw | ||
) |
Definition at line 197 of file Crazyflie.cpp.
void Crazyflie::sendSetpoint | ( | float | roll, |
float | pitch, | ||
float | yawrate, | ||
uint16_t | thrust | ||
) |
Definition at line 169 of file Crazyflie.cpp.
void Crazyflie::sendStop | ( | ) |
Definition at line 179 of file Crazyflie.cpp.
void Crazyflie::sendVelocityWorldSetpoint | ( | float | x, |
float | y, | ||
float | z, | ||
float | yawRate | ||
) |
Definition at line 233 of file Crazyflie.cpp.
|
inline |
Definition at line 286 of file Crazyflie.h.
|
inline |
Definition at line 276 of file Crazyflie.h.
|
inline |
Definition at line 314 of file Crazyflie.h.
void Crazyflie::setGroupMask | ( | uint8_t | groupMask | ) |
Definition at line 1403 of file Crazyflie.cpp.
|
inline |
Definition at line 281 of file Crazyflie.h.
|
inline |
Definition at line 221 of file Crazyflie.h.
|
private |
Definition at line 1008 of file Crazyflie.cpp.
|
inline |
Definition at line 228 of file Crazyflie.h.
void Crazyflie::setRequestedParams | ( | ) |
Definition at line 1003 of file Crazyflie.cpp.
|
inlinestatic |
Definition at line 291 of file Crazyflie.h.
|
private |
Definition at line 1250 of file Crazyflie.cpp.
void Crazyflie::startSetParamRequest | ( | ) |
Definition at line 889 of file Crazyflie.cpp.
void Crazyflie::startTrajectory | ( | uint8_t | trajectoryId, |
float | timescale = 1.0 , |
||
bool | reversed = false , |
||
bool | relative = true , |
||
uint8_t | groupMask = 0 |
||
) |
Definition at line 1467 of file Crazyflie.cpp.
void Crazyflie::stop | ( | uint8_t | groupMask = 0 | ) |
Definition at line 1423 of file Crazyflie.cpp.
void Crazyflie::sysoff | ( | ) |
Definition at line 337 of file Crazyflie.cpp.
void Crazyflie::syson | ( | ) |
Definition at line 353 of file Crazyflie.cpp.
void Crazyflie::takeoff | ( | float | height, |
float | duration, | ||
uint8_t | groupMask = 0 |
||
) |
Definition at line 1411 of file Crazyflie.cpp.
void Crazyflie::transmitPackets | ( | ) |
Transmits any outgoing packets to the crazyflie.
Definition at line 273 of file Crazyflie.cpp.
|
private |
Definition at line 1241 of file Crazyflie.cpp.
void Crazyflie::uploadTrajectory | ( | uint8_t | trajectoryId, |
uint32_t | pieceOffset, | ||
const std::vector< poly4d > & | pieces | ||
) |
Definition at line 1435 of file Crazyflie.cpp.
float Crazyflie::vbat | ( | ) |
Definition at line 361 of file Crazyflie.cpp.
void Crazyflie::writeFlash | ( | BootloaderTarget | target, |
const std::vector< uint8_t > & | data | ||
) |
Definition at line 374 of file Crazyflie.cpp.
|
friend |
Definition at line 519 of file Crazyflie.h.
|
friend |
Definition at line 520 of file Crazyflie.h.
|
private |
|
private |
Definition at line 502 of file Crazyflie.h.
|
private |
Definition at line 530 of file Crazyflie.h.
|
private |
Definition at line 501 of file Crazyflie.h.
|
private |
Definition at line 515 of file Crazyflie.h.
|
private |
Definition at line 535 of file Crazyflie.h.
|
private |
Definition at line 534 of file Crazyflie.h.
|
private |
Definition at line 503 of file Crazyflie.h.
|
private |
Definition at line 499 of file Crazyflie.h.
|
private |
Definition at line 513 of file Crazyflie.h.
|
private |
Definition at line 516 of file Crazyflie.h.
|
private |
Definition at line 514 of file Crazyflie.h.
|
private |
Definition at line 537 of file Crazyflie.h.
|
private |
Definition at line 506 of file Crazyflie.h.
|
private |
Definition at line 543 of file Crazyflie.h.
|
private |
Definition at line 505 of file Crazyflie.h.
|
private |
Definition at line 511 of file Crazyflie.h.
|
private |
Definition at line 532 of file Crazyflie.h.
|
private |
Definition at line 531 of file Crazyflie.h.
|
private |
Definition at line 405 of file Crazyflie.h.
|
private |
Definition at line 538 of file Crazyflie.h.
|
private |
Definition at line 508 of file Crazyflie.h.
|
private |
Definition at line 509 of file Crazyflie.h.
|
private |
Definition at line 540 of file Crazyflie.h.
|
private |
Definition at line 497 of file Crazyflie.h.
|
private |
Definition at line 498 of file Crazyflie.h.