diff --git a/include/crazyflie_cpp/Crazyflie.h b/include/crazyflie_cpp/Crazyflie.h index 90fc4a9..99d6d79 100644 --- a/include/crazyflie_cpp/Crazyflie.h +++ b/include/crazyflie_cpp/Crazyflie.h @@ -158,6 +158,9 @@ class Crazyflie std::string getFirmwareVersion(); std::string getDeviceTypeName(); + + void sendArmingRequest(bool arm); + void logReset(); void sendSetpoint( @@ -764,6 +767,8 @@ class CrazyflieBroadcaster return m_connection.statisticsDelta(); } + void sendArmingRequest(bool arm); + // High-Level setpoints void takeoff(float height, float duration, uint8_t groupMask = 0); diff --git a/include/crazyflie_cpp/crtp.h b/include/crazyflie_cpp/crtp.h index 579bf92..d5a44d7 100644 --- a/include/crazyflie_cpp/crtp.h +++ b/include/crazyflie_cpp/crtp.h @@ -1008,6 +1008,13 @@ struct crtpGetDeviceTypeNameResponse static std::string name(const bitcraze::crazyflieLinkCpp::Packet &p); }; +class crtpArmingRequest + : public bitcraze::crazyflieLinkCpp::Packet +{ +public: + crtpArmingRequest(bool arm); +}; + // Port 15 (Link) class crtpLatencyMeasurementRequest : public bitcraze::crazyflieLinkCpp::Packet diff --git a/src/Crazyflie.cpp b/src/Crazyflie.cpp index cc565bd..1a4313f 100644 --- a/src/Crazyflie.cpp +++ b/src/Crazyflie.cpp @@ -108,6 +108,12 @@ std::string Crazyflie::getDeviceTypeName() return res::name(p); } +void Crazyflie::sendArmingRequest(bool arm) +{ + crtpArmingRequest req(arm); + m_connection.send(req); +} + void Crazyflie::logReset() { crtpLogResetRequest request; @@ -1215,6 +1221,13 @@ CrazyflieBroadcaster::CrazyflieBroadcaster( : m_connection(link_uri) { } + +void CrazyflieBroadcaster::sendArmingRequest(bool arm) +{ + crtpArmingRequest req(arm); + m_connection.send(req); +} + void CrazyflieBroadcaster::takeoff(float height, float duration, uint8_t groupMask) { crtpCommanderHighLevelTakeoffRequest req(groupMask, height, duration); diff --git a/src/crtp.cpp b/src/crtp.cpp index 67083d4..cb5172e 100644 --- a/src/crtp.cpp +++ b/src/crtp.cpp @@ -293,6 +293,13 @@ std::string crtpGetDeviceTypeNameResponse::name(const bitcraze::crazyflieLinkCpp return p.payloadAtString(1); } +crtpArmingRequest::crtpArmingRequest(bool arm) + : Packet(13, 0, 2) +{ + setPayloadAt(0, 1); + setPayloadAt(1, arm); +} + #if 0 crtpFullStateSetpointRequest::crtpFullStateSetpointRequest( float x, float y, float z,