6 #define M_PI 3.14159265358979323846 16 Command::FloatField::operator bool()
const 31 ret = std::numeric_limits<float>::quiet_NaN();
51 Command::HighResAngleField::operator bool()
const 67 return std::numeric_limits<double>::quiet_NaN();
70 static_cast<double>(revolutions) * 2.0 *
M_PI +
71 static_cast<double>(radian_offset)
80 *radian_offset = std::numeric_limits<float>::quiet_NaN();
86 double revolutions_raw = radians / 2.0 /
M_PI;
87 double revolutions_int_d;
88 double radian_offset_d =
std::modf (revolutions_raw, &revolutions_int_d);
89 radian_offset_d = radian_offset_d * 2.0 *
M_PI;
91 int64_t revolutions_int =
std::isnan(revolutions_int_d) ? 0 :
static_cast<int64_t
>(revolutions_int_d);
92 float radian_offset =
static_cast<float>(radian_offset_d);
121 ret = std::numeric_limits<float>::quiet_NaN();
153 return static_cast<bool>(ret);
158 auto val =
static_cast<int>(value);
172 Command::StringField::operator bool()
const 191 auto buffer =
new char [length];
193 std::string tmp(buffer, length - 1);
200 const char* buffer = value.c_str();
201 size_t length = value.size();
215 Command::FlagField::operator bool()
const 297 return Color(r, g, b, module_ctrl ? 0 : 255);
void clear()
Removes any currently set value for this field.
void set(const Color &color)
Commands a color that overrides the module's control of the LED (if the alpha channel is 255)...
void hebiCommandSetLedOverrideColor(HebiCommandPtr cmd, HebiCommandLedField field, uint8_t r, uint8_t g, uint8_t b)
void clear()
Removes any currently set value for this field.
NumberedFloatField(HebiCommandPtr internal, HebiCommandNumberedFloatField field)
HebiStatusCode hebiCommandGetNumberedFloat(HebiCommandPtr cmd, HebiCommandNumberedFloatField field, size_t number, float *value)
HebiCommandBoolField const field_
HebiCommandPtr const internal_
HebiCommandPtr const internal_
HebiCommandHighResAngleField
void hebiCommandSetBool(HebiCommandPtr cmd, HebiCommandBoolField field, const int32_t *value)
Boot the module from bootloader into application.
HebiStatusCode hebiCommandGetIoPinFloat(HebiCommandPtr cmd, HebiCommandIoPinBank field, size_t pin_number, float *value)
void hebiCommandClearLed(HebiCommandPtr cmd, HebiCommandLedField field)
LedField(HebiCommandPtr internal, HebiCommandLedField field)
float get() const
If the field has a value, returns that value; otherwise, returns a default.
bool has() const
Returns true if the LED command has been set, and false otherwise.
void clear()
Removes any currently set value for this field.
HebiCommandIoPinBank const bank_
HebiCommandPtr const internal_
HebiCommandPtr const internal_
FlagField & stopBoot()
Stop the module from automatically booting into application.
uint8_t getRed() const
Returns the red channel; value is between 0 and 255.
void hebiCommandSetLedModuleControl(HebiCommandPtr cmd, HebiCommandLedField field)
std::string get() const
If the field has a value, returns a copy of that value; otherwise, returns a default.
void setInt(size_t pinNumber, int64_t value)
Sets the particular pin to a integer value (representing a digital output).
Command objects have various fields that can be set; when sent to the module, these fields control in...
~Command() noexcept
Cleans up command object as necessary.
Command(HebiCommandPtr)
Wraps an existing C-style object that is managed by its parent. NOTE: this should not be used except ...
void hebiCommandSetFlag(HebiCommandPtr cmd, HebiCommandFlagField field, int32_t value)
float getFloat(size_t pinNumber) const
If this numbered pin in this bank has an floating point (e.g., analog or PWM) value, returns that value; otherwise returns a default.
int64_t getInt(size_t pinNumber) const
If this numbered pin in this bank has an integer (e.g., digital) value, returns that value; otherwise...
void clear(size_t fieldNumber)
Removes any currently set value for the numbered subvalue of this field.
void set(size_t fieldNumber, float value)
Sets the particular numbered subvalue of this field to a given value.
void set()
Sets this flag.
A message field for interfacing with an LED.
bool has(size_t fieldNumber) const
True if (and only if) the particular numbered subvalue of this field has a value. ...
FloatField(HebiCommandPtr internal, HebiCommandFloatField field)
HebiCommandNumberedFloatField const field_
HebiStatusCode hebiCommandGetBool(HebiCommandPtr cmd, HebiCommandBoolField field, int32_t *value)
HebiCommandPtr const internal_
HebiCommandHighResAngleField const field_
HebiCommandFloatField const field_
int32_t hebiCommandGetFlag(HebiCommandPtr cmd, HebiCommandFlagField field)
FlagField & reset()
Restart the module.
HebiStatusCode hebiCommandGetIoPinInt(HebiCommandPtr cmd, HebiCommandIoPinBank field, size_t pin_number, int64_t *value)
HebiStatusCode hebiCommandGetLedColor(HebiCommandPtr cmd, HebiCommandLedField field, uint8_t *r, uint8_t *g, uint8_t *b)
HebiStatusCode hebiCommandGetString(HebiCommandPtr cmd, HebiCommandStringField field, char *buffer, size_t *length)
const mpreal modf(const mpreal &v, mpreal &n)
A two-state message field (either set/true or cleared/false).
IoBank(HebiCommandPtr internal, HebiCommandIoPinBank bank)
void hebiCommandSetHighResAngle(HebiCommandPtr cmd, HebiCommandHighResAngleField field, const int64_t *int_part, const float *dec_part)
A message field containing a numbered set of single-precision floating point values.
HebiCommandFlagField const field_
HebiCommandPtr const internal_
bool has() const
True if (and only if) the field has a value.
HighResAngleField(HebiCommandPtr internal, HebiCommandHighResAngleField field)
HebiCommandNumberedFloatField
HebiCommandLedField const field_
HebiCommandPtr const internal_
int32_t hebiCommandHasLedModuleControl(HebiCommandPtr cmd, HebiCommandLedField field)
HebiStatusCode hebiCommandGetFloat(HebiCommandPtr cmd, HebiCommandFloatField field, float *value)
uint8_t getBlue() const
Returns the blue channel; value is between 0 and 255.
bool hasFloat(size_t pinNumber) const
True if (and only if) the particular numbered pin in this bank has an floating point (e...
void hebiCommandSetFloat(HebiCommandPtr cmd, HebiCommandFloatField field, const float *value)
void hebiCommandSetNumberedFloat(HebiCommandPtr cmd, HebiCommandNumberedFloatField field, size_t number, const float *value)
uint8_t getGreen() const
Returns the green channel; value is between 0 and 255.
bool get() const
If the field has a value, returns that value; otherwise, returns false.
FlagField(HebiCommandPtr internal, HebiCommandFlagField field)
bool has() const
True if (and only if) the field has a value.
void clear()
Removes any currently set value for this field, so that the module maintains its previous state of LE...
void set(double radians)
Sets the field to a given double value (in radians). Note that double precision floating point number...
FlagField & boot()
Boot the module from bootloader into application.
void clear()
Removes any currently set value for this field.
StringField(HebiCommandPtr internal, HebiCommandStringField field)
NumberedFloatField & debug()
Values for internal debug functions (channel 1-9 available).
void set(float value)
Sets the field to a given value.
struct _HebiCommand * HebiCommandPtr
The C-style's API representation of a command.
void hebiCommandSetIoPinInt(HebiCommandPtr cmd, HebiCommandIoPinBank field, size_t pin_number, const int64_t *value)
void set(bool value)
Sets the field to a given value.
BoolField(HebiCommandPtr internal, HebiCommandBoolField field)
NumberedFloatField debug_
float get(size_t fieldNumber) const
If the particular numbered subvalue of this field has a value, returns that value; otherwise returns ...
double get() const
If the field has a value, returns that value as a double; otherwise, returns a default.
void hebiCommandSetIoPinFloat(HebiCommandPtr cmd, HebiCommandIoPinBank field, size_t pin_number, const float *value)
HebiCommandStringField const field_
bool has() const
Returns true if the flag is set, false if it is cleared.
void setFloat(size_t pinNumber, float value)
Sets the particular pin to a floating point value (representing a PWM output).
TFSIMD_FORCE_INLINE tfScalar length(const Quaternion &q)
void hebiCommandSetString(HebiCommandPtr cmd, HebiCommandStringField field, const char *buffer, const size_t *length)
bool has() const
True if (and only if) the field has a value.
EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC bool() isnan(const half &a)
Structure to describe an RGB color.
Color get() const
Returns the current LED command.
EIGEN_DEVICE_FUNC const Scalar & b
bool has() const
True if (and only if) the field has a value.
Indicates if the module should save the current values of all of its settings.
bool hasInt(size_t pinNumber) const
True if (and only if) the particular numbered pin in this bank has an integer (e.g., digital) value.
void clear()
Clears this flag (e.g., sets it to false/off).
HebiCommandPtr const internal_
HebiStatusCode hebiCommandGetHighResAngle(HebiCommandPtr cmd, HebiCommandHighResAngleField field, int64_t *int_part, float *dec_part)
void clear(size_t pinNumber)
Removes any currently set value for this pin.
void set(const std::string &value)
Sets the field to a given value.
LedField & led()
The module's LED.