9#ifndef APM_Interface_DEFINED
10#define APM_Interface_DEFINED
14#ifdef WHITEBOARD_POSTER_STRING_CONVERSION
44 if(this->mode() != s.mode())
46#pragma clang diagnostic push
47#pragma clang diagnostic ignored "-Wswitch-enum"
51#define QUAD(o, p) ( o ).data().quad. p ()
52 if(
QUAD(*
this, thrust) !=
QUAD(s, thrust) ||
53 QUAD(*
this, pitch) !=
QUAD(s, pitch) ||
54 QUAD(*
this, roll) !=
QUAD(s, roll) ||
59#define PLANE(o, p) ( o ).data().plane. p ()
66#pragma clang diagnostic pop
76#ifdef WHITEBOARD_POSTER_STRING_CONVERSION
88 std::vector<std::string> v = components_of_string_separated(str,
DELIMITER,
true);
91 fprintf(stderr,
"APM_Interface couldn't parse this string, have it back %s\n", str.c_str());
96#pragma clang diagnostic push
97#pragma clang diagnostic ignored "-Wswitch-enum"
101 this->data().quad.set_thrust(
static_cast<uint8_t
>(atoi(v.at(1).c_str())));
102 this->data().quad.set_pitch(
static_cast<int16_t
>(atoi(v.at(2).c_str())));
103 this->data().quad.set_roll(
static_cast<int16_t
>(atoi(v.at(3).c_str())));
104 this->data().quad.set_yaw(
static_cast<int16_t
>(atoi(v.at(4).c_str())));
107 this->data().plane.set_thrust(
static_cast<uint8_t
>(atoi(v.at(1).c_str())));
108 fprintf(stderr,
"APM_Interface mode 'Plane' is NYI\n");
113 fprintf(stderr,
"APM_Interface couldn't parse this string, have it back %s\n", str.c_str());
116#pragma clang diagnostic pop
124 std::stringstream ss;
126#pragma clang diagnostic push
127#pragma clang diagnostic ignored "-Wswitch-enum"
128 switch (this->mode())
131 ss <<
"Thrust: " <<
static_cast<int>(this->data().quad.thrust()) <<
", ";
132 ss <<
"Pitch: " << this->data().quad.pitch() <<
", ";
133 ss <<
"Roll: " << this->data().quad.roll() <<
", ";
134 ss <<
"Yaw: " << this->data().quad.yaw() <<
"";
137 ss <<
"Plane mode NYI";
142#pragma clang diagnostic pop
Class for interacting with and reading the values of APM sensors and motors.
APM_Interface(const std::string &str)
string constructor (see from_string() below)
APM_Interface()
default constructor
bool operator==(const APM_Interface &s)
comparison operator
std::string description() const
pretty print method for showing the current property values
bool operator!=(const APM_Interface &s)
return false if the two interfaces are the same
void from_string(const std::string &str)
parse class properties from a string
Interface for talking with an APM.
apm_mode
/file wb_apm_interface.h