HEBI C++ API  2.2.0
command.hpp
Go to the documentation of this file.
1 #pragma once
2 
3 #include "hebi.h"
4 
5 #include <string>
6 
7 #include "color.hpp"
8 #include "gains.hpp"
9 #include "util.hpp"
10 
11 namespace hebi {
12 
32 class Command final {
33 public:
34  enum class ControlStrategy {
36  Off,
38  DirectPWM,
41  Strategy2,
44  Strategy3,
47  Strategy4,
48  };
49 
50  enum class MstopStrategy {
52  Disabled,
54  MotorOff,
57  };
58 
59  enum class PositionLimitStrategy {
65  MotorOff,
67  Disabled,
68  };
69 
70 protected:
72  class FloatField final {
73  public:
74 #ifndef DOXYGEN_OMIT_INTERNAL
75  FloatField(HebiCommandPtr internal, HebiCommandFloatField field);
76 #endif // DOXYGEN_OMIT_INTERNAL
77  explicit operator bool() const { return has(); }
91  bool has() const;
94  float get() const;
96  void set(float value);
98  void clear();
99 
101  private:
102  HebiCommandPtr const internal_;
103  HebiCommandFloatField const field_;
104  };
105 
111  class HighResAngleField final {
112  public:
113 #ifndef DOXYGEN_OMIT_INTERNAL
114  HighResAngleField(HebiCommandPtr internal, HebiCommandHighResAngleField field);
115 #endif // DOXYGEN_OMIT_INTERNAL
116  explicit operator bool() const { return has(); }
130  bool has() const;
136  double get() const;
148  void get(int64_t* revolutions, float* radian_offset) const;
153  void set(double radians);
160  void set(int64_t revolutions, float radian_offset);
162  void clear();
163 
165  private:
166  HebiCommandPtr const internal_;
167  HebiCommandHighResAngleField const field_;
168  };
169 
172  class NumberedFloatField final {
173  public:
174 #ifndef DOXYGEN_OMIT_INTERNAL
175  NumberedFloatField(HebiCommandPtr internal, HebiCommandNumberedFloatField field);
176 #endif // DOXYGEN_OMIT_INTERNAL
177  bool has(size_t fieldNumber) const;
188  float get(size_t fieldNumber) const;
194  void set(size_t fieldNumber, float value);
200  void clear(size_t fieldNumber);
201 
203  private:
204  HebiCommandPtr const internal_;
205  HebiCommandNumberedFloatField const field_;
206  };
207 
209  class BoolField final {
210  public:
211 #ifndef DOXYGEN_OMIT_INTERNAL
212  BoolField(HebiCommandPtr internal, HebiCommandBoolField field);
213 #endif // DOXYGEN_OMIT_INTERNAL
214  bool has() const;
218  bool get() const;
220  void set(bool value);
222  void clear();
223 
225  private:
226  HebiCommandPtr const internal_;
227  HebiCommandBoolField const field_;
228  };
229 
231  class StringField final {
232  public:
233 #ifndef DOXYGEN_OMIT_INTERNAL
234  StringField(HebiCommandPtr internal, HebiCommandStringField field);
235 #endif // DOXYGEN_OMIT_INTERNAL
236  explicit operator bool() const { return has(); }
250  bool has() const;
253  std::string get() const;
255  void set(const std::string& value);
257  void clear();
258 
260  private:
261  HebiCommandPtr const internal_;
262  HebiCommandStringField const field_;
263  };
264 
266  class FlagField final {
267  public:
268 #ifndef DOXYGEN_OMIT_INTERNAL
269  FlagField(HebiCommandPtr internal, HebiCommandFlagField field);
270 #endif // DOXYGEN_OMIT_INTERNAL
271  explicit operator bool() const { return has(); }
285  bool has() const;
287  void set();
289  void clear();
290 
292  private:
293  HebiCommandPtr const internal_;
294  HebiCommandFlagField const field_;
295  };
296 
298  template<typename T>
299  class EnumField final {
300  public:
301 #ifndef DOXYGEN_OMIT_INTERNAL
302  EnumField(HebiCommandPtr internal, HebiCommandEnumField field) : internal_(internal), field_(field) {}
303 #endif // DOXYGEN_OMIT_INTERNAL
304  explicit operator bool() const { return has(); }
318  bool has() const { return (hebiCommandGetEnum(internal_, field_, nullptr) == HebiStatusSuccess); }
321  T get() const {
322  int32_t ret{};
323  hebiCommandGetEnum(internal_, field_, &ret);
324  return static_cast<T>(ret);
325  }
327  void set(T _value) {
328  int32_t value = static_cast<int32_t>(_value);
329  hebiCommandSetEnum(internal_, field_, &value);
330  }
332  void clear() { hebiCommandSetEnum(internal_, field_, nullptr); }
333 
335  private:
336  HebiCommandPtr const internal_;
337  HebiCommandEnumField const field_;
338  };
339 
341  class IoBank final {
342  public:
343 #ifndef DOXYGEN_OMIT_INTERNAL
344  IoBank(HebiCommandPtr internal, HebiCommandIoPinBank bank);
345 #endif // DOXYGEN_OMIT_INTERNAL
346  bool hasInt(size_t pinNumber) const;
357  bool hasFloat(size_t pinNumber) const;
363  int64_t getInt(size_t pinNumber) const;
370  float getFloat(size_t pinNumber) const;
376  void setInt(size_t pinNumber, int64_t value);
382  void setFloat(size_t pinNumber, float value);
387  void clear(size_t pinNumber);
388 
390  private:
391  HebiCommandPtr const internal_;
392  HebiCommandIoPinBank const bank_;
393  };
395  class LedField final {
396  public:
397 #ifndef DOXYGEN_OMIT_INTERNAL
398  LedField(HebiCommandPtr internal, HebiCommandLedField field);
399 #endif // DOXYGEN_OMIT_INTERNAL
400  bool has() const;
415  Color get() const;
421  void set(const Color& color);
426  void clear();
427 
429  private:
430  HebiCommandPtr const internal_;
431  HebiCommandLedField const field_;
432  };
433 
435  class Io final {
436  public:
437 #ifndef DOXYGEN_OMIT_INTERNAL
438  Io(HebiCommandPtr internal)
439  : internal_(internal),
440  a_(internal, HebiCommandIoBankA),
441  b_(internal, HebiCommandIoBankB),
442  c_(internal, HebiCommandIoBankC),
443  d_(internal, HebiCommandIoBankD),
444  e_(internal, HebiCommandIoBankE),
445  f_(internal, HebiCommandIoBankF) {}
446 #endif // DOXYGEN_OMIT_INTERNAL
447 
448  // With all submessage and field getters: Note that the returned reference
449  // should not be used after the lifetime of this parent.
450 
451  // Subfields ----------------
452 
454  IoBank& a() { return a_; }
456  const IoBank& a() const { return a_; }
458  IoBank& b() { return b_; }
460  const IoBank& b() const { return b_; }
462  IoBank& c() { return c_; }
464  const IoBank& c() const { return c_; }
466  IoBank& d() { return d_; }
468  const IoBank& d() const { return d_; }
470  IoBank& e() { return e_; }
472  const IoBank& e() const { return e_; }
474  IoBank& f() { return f_; }
476  const IoBank& f() const { return f_; }
477 
479  private:
480  HebiCommandPtr const internal_;
481 
482  IoBank a_;
483  IoBank b_;
484  IoBank c_;
485  IoBank d_;
486  IoBank e_;
487  IoBank f_;
488  };
489 
491 
493  class Settings final {
494  protected:
496  class Actuator final {
497  public:
498 #ifndef DOXYGEN_OMIT_INTERNAL
499  Actuator(HebiCommandPtr internal)
500  : internal_(internal),
501  position_gains_(internal, HebiCommandFloatPositionKp, HebiCommandBoolPositionDOnError),
502  velocity_gains_(internal, HebiCommandFloatVelocityKp, HebiCommandBoolVelocityDOnError),
503  effort_gains_(internal, HebiCommandFloatEffortKp, HebiCommandBoolEffortDOnError),
504  spring_constant_(internal, HebiCommandFloatSpringConstant),
505  reference_position_(internal, HebiCommandFloatReferencePosition),
506  reference_effort_(internal, HebiCommandFloatReferenceEffort),
507  velocity_limit_min_(internal, HebiCommandFloatVelocityLimitMin),
508  velocity_limit_max_(internal, HebiCommandFloatVelocityLimitMax),
509  effort_limit_min_(internal, HebiCommandFloatEffortLimitMin),
510  effort_limit_max_(internal, HebiCommandFloatEffortLimitMax),
511  position_limit_min_(internal, HebiCommandHighResAnglePositionLimitMin),
512  position_limit_max_(internal, HebiCommandHighResAnglePositionLimitMax),
513  control_strategy_(internal, HebiCommandEnumControlStrategy),
514  mstop_strategy_(internal, HebiCommandEnumMstopStrategy),
515  min_position_limit_strategy_(internal, HebiCommandEnumMinPositionLimitStrategy),
516  max_position_limit_strategy_(internal, HebiCommandEnumMaxPositionLimitStrategy) {}
517 #endif // DOXYGEN_OMIT_INTERNAL
518 
519  // With all submessage and field getters: Note that the returned reference
520  // should not be used after the lifetime of this parent.
521 
522  // Submessages ----------------
523 
525  CommandGains& positionGains() { return position_gains_; }
527  const CommandGains& positionGains() const { return position_gains_; }
529  CommandGains& velocityGains() { return velocity_gains_; }
531  const CommandGains& velocityGains() const { return velocity_gains_; }
533  CommandGains& effortGains() { return effort_gains_; }
535  const CommandGains& effortGains() const { return effort_gains_; }
536 
537  // Subfields ----------------
538 
540  FloatField& springConstant() { return spring_constant_; }
542  const FloatField& springConstant() const { return spring_constant_; }
545  FloatField& referencePosition() { return reference_position_; }
548  const FloatField& referencePosition() const { return reference_position_; }
550  FloatField& referenceEffort() { return reference_effort_; }
552  const FloatField& referenceEffort() const { return reference_effort_; }
554  FloatField& velocityLimitMin() { return velocity_limit_min_; }
556  const FloatField& velocityLimitMin() const { return velocity_limit_min_; }
558  FloatField& velocityLimitMax() { return velocity_limit_max_; }
560  const FloatField& velocityLimitMax() const { return velocity_limit_max_; }
562  FloatField& effortLimitMin() { return effort_limit_min_; }
564  const FloatField& effortLimitMin() const { return effort_limit_min_; }
566  FloatField& effortLimitMax() { return effort_limit_max_; }
568  const FloatField& effortLimitMax() const { return effort_limit_max_; }
570  HighResAngleField& positionLimitMin() { return position_limit_min_; }
572  const HighResAngleField& positionLimitMin() const { return position_limit_min_; }
574  HighResAngleField& positionLimitMax() { return position_limit_max_; }
576  const HighResAngleField& positionLimitMax() const { return position_limit_max_; }
578  EnumField<ControlStrategy>& controlStrategy() { return control_strategy_; }
580  const EnumField<ControlStrategy>& controlStrategy() const { return control_strategy_; }
582  EnumField<MstopStrategy>& mstopStrategy() { return mstop_strategy_; }
584  const EnumField<MstopStrategy>& mstopStrategy() const { return mstop_strategy_; }
586  EnumField<PositionLimitStrategy>& minPositionLimitStrategy() { return min_position_limit_strategy_; }
588  const EnumField<PositionLimitStrategy>& minPositionLimitStrategy() const { return min_position_limit_strategy_; }
590  EnumField<PositionLimitStrategy>& maxPositionLimitStrategy() { return max_position_limit_strategy_; }
592  const EnumField<PositionLimitStrategy>& maxPositionLimitStrategy() const { return max_position_limit_strategy_; }
593 
595  private:
596  HebiCommandPtr const internal_;
597 
598  CommandGains position_gains_;
599  CommandGains velocity_gains_;
600  CommandGains effort_gains_;
601 
602  FloatField spring_constant_;
603  FloatField reference_position_;
604  FloatField reference_effort_;
605  FloatField velocity_limit_min_;
606  FloatField velocity_limit_max_;
607  FloatField effort_limit_min_;
608  FloatField effort_limit_max_;
609  HighResAngleField position_limit_min_;
610  HighResAngleField position_limit_max_;
611  EnumField<ControlStrategy> control_strategy_;
612  EnumField<MstopStrategy> mstop_strategy_;
613  EnumField<PositionLimitStrategy> min_position_limit_strategy_;
614  EnumField<PositionLimitStrategy> max_position_limit_strategy_;
615  };
616 
618  class Imu final {
619  public:
620 #ifndef DOXYGEN_OMIT_INTERNAL
621  Imu(HebiCommandPtr internal)
622  : internal_(internal), accel_includes_gravity_(internal, HebiCommandBoolAccelIncludesGravity) {}
623 #endif // DOXYGEN_OMIT_INTERNAL
624 
625  // With all submessage and field getters: Note that the returned reference
626  // should not be used after the lifetime of this parent.
627 
628  // Subfields ----------------
629 
631  BoolField& accelIncludesGravity() { return accel_includes_gravity_; }
633  const BoolField& accelIncludesGravity() const { return accel_includes_gravity_; }
634 
636  private:
637  HebiCommandPtr const internal_;
638 
639  BoolField accel_includes_gravity_;
640  };
641 
642  public:
643 #ifndef DOXYGEN_OMIT_INTERNAL
644  Settings(HebiCommandPtr internal)
645  : internal_(internal),
646  actuator_(internal),
647  imu_(internal),
648  name_(internal, HebiCommandStringName),
649  family_(internal, HebiCommandStringFamily),
650  save_current_settings_(internal, HebiCommandFlagSaveCurrentSettings) {}
651 #endif // DOXYGEN_OMIT_INTERNAL
652 
653  // With all submessage and field getters: Note that the returned reference
654  // should not be used after the lifetime of this parent.
655 
656  // Submessages ----------------
657 
659  Actuator& actuator() { return actuator_; }
661  const Actuator& actuator() const { return actuator_; }
663  Imu& imu() { return imu_; }
665  const Imu& imu() const { return imu_; }
666 
667  // Subfields ----------------
668 
671  StringField& name() { return name_; }
674  const StringField& name() const { return name_; }
677  StringField& family() { return family_; }
680  const StringField& family() const { return family_; }
682  FlagField& saveCurrentSettings() { return save_current_settings_; }
684  const FlagField& saveCurrentSettings() const { return save_current_settings_; }
685 
687  private:
688  HebiCommandPtr const internal_;
689 
690  Actuator actuator_;
691  Imu imu_;
692 
693  StringField name_;
694  StringField family_;
695  FlagField save_current_settings_;
696  };
697 
699  class Actuator final {
700  public:
701 #ifndef DOXYGEN_OMIT_INTERNAL
702  Actuator(HebiCommandPtr internal)
703  : internal_(internal),
704  velocity_(internal, HebiCommandFloatVelocity),
705  effort_(internal, HebiCommandFloatEffort),
706  position_(internal, HebiCommandHighResAnglePosition) {}
707 #endif // DOXYGEN_OMIT_INTERNAL
708 
709  // With all submessage and field getters: Note that the returned reference
710  // should not be used after the lifetime of this parent.
711 
712  // Subfields ----------------
713 
715  FloatField& velocity() { return velocity_; }
717  const FloatField& velocity() const { return velocity_; }
719  FloatField& effort() { return effort_; }
721  const FloatField& effort() const { return effort_; }
723  HighResAngleField& position() { return position_; }
725  const HighResAngleField& position() const { return position_; }
726 
728  private:
729  HebiCommandPtr const internal_;
730 
731  FloatField velocity_;
732  FloatField effort_;
733  HighResAngleField position_;
734  };
735 
736 private:
741  HebiCommandPtr internal_;
742 
743 public:
744 #ifndef DOXYGEN_OMIT_INTERNAL
745 
749  Command(HebiCommandPtr);
750 #endif // DOXYGEN_OMIT_INTERNAL
751 
754  Command(Command&& other);
755 
756  // With all submessage and field getters: Note that the returned reference
757  // should not be used after the lifetime of this parent.
758 
759  // Submessages -------------------------------------------------------------
760 
762  Io& io() { return io_; }
764  const Io& io() const { return io_; }
766  Settings& settings() { return settings_; }
768  const Settings& settings() const { return settings_; }
770  Actuator& actuator() { return actuator_; }
772  const Actuator& actuator() const { return actuator_; }
773 
774  // Subfields -------------------------------------------------------------
775 
776 #ifndef DOXYGEN_OMIT_INTERNAL
777  NumberedFloatField& debug() { return debug_; }
780  const NumberedFloatField& debug() const { return debug_; }
781 #endif // DOXYGEN_OMIT_INTERNAL
782  StringField& appendLog() { return append_log_; }
785  const StringField& appendLog() const { return append_log_; }
787  FlagField& reset() { return reset_; }
789  const FlagField& reset() const { return reset_; }
791  FlagField& boot() { return boot_; }
793  const FlagField& boot() const { return boot_; }
795  FlagField& stopBoot() { return stop_boot_; }
797  const FlagField& stopBoot() const { return stop_boot_; }
799  FlagField& clearLog() { return clear_log_; }
801  const FlagField& clearLog() const { return clear_log_; }
803  LedField& led() { return led_; }
805  const LedField& led() const { return led_; }
806 
811 
812  /* Disable move assigment operator. */
813  Command& operator=(Command&& other) = delete;
814 
815 private:
816  Io io_;
817  Settings settings_;
818  Actuator actuator_;
819 
820  NumberedFloatField debug_;
821  StringField append_log_;
822  FlagField reset_;
823  FlagField boot_;
824  FlagField stop_boot_;
825  FlagField clear_log_;
826  LedField led_;
827 };
828 
829 } // namespace hebi
const FloatField & referencePosition() const
Definition: command.hpp:548
void clear()
Removes any currently set value for this field.
Definition: command.cpp:110
void set(const Color &color)
Commands a color that overrides the module's control of the LED (if the alpha channel is 255),...
Definition: command.cpp:199
bool has() const
True if (and only if) the field has a value.
Definition: command.hpp:318
void clear()
Removes any currently set value for this field.
Definition: command.cpp:67
const IoBank & a() const
I/O pin bank a (pins 1-8 available)
Definition: command.hpp:456
IoBank & f()
I/O pin bank f (pins 1-8 available)
Definition: command.hpp:474
FlagField & reset()
Restart the module.
Definition: command.hpp:787
FlagField & saveCurrentSettings()
Indicates if the module should save the current values of all of its settings.
Definition: command.hpp:682
IoBank & d()
I/O pin bank d (pins 1-8 available)
Definition: command.hpp:466
const EnumField< PositionLimitStrategy > & minPositionLimitStrategy() const
The position limit strategy (at the minimum position) for the actuator.
Definition: command.hpp:588
MstopStrategy
Definition: command.hpp:50
const FloatField & effortLimitMin() const
The firmware safety limit for the minimum allowed effort.
Definition: command.hpp:564
const FloatField & velocityLimitMin() const
The firmware safety limit for the minimum allowed velocity.
Definition: command.hpp:556
HighResAngleField & positionLimitMax()
The firmware safety limit for the maximum allowed position.
Definition: command.hpp:574
#define HEBI_DISABLE_COPY(Class)
Definition: util.hpp:16
void clear()
Removes any currently set value for this field.
Definition: command.cpp:27
A message field representable by a bool value.
Definition: command.hpp:209
Actuator & actuator()
Actuator-specific commands.
Definition: command.hpp:770
Actuator-specific commands.
Definition: command.hpp:699
Io & io()
Any available digital or analog output pins on the device.
Definition: command.hpp:762
const FloatField & effort() const
Effort at the module output; units vary (e.g., N * m for rotational joints and N for linear stages).
Definition: command.hpp:721
Triggering the M-Stop results in the control strategy being set to 'off'. Remains 'off' until changed...
Settings & settings()
Module settings that are typically changed at a slower rate.
Definition: command.hpp:766
const Io & io() const
Any available digital or analog output pins on the device.
Definition: command.hpp:764
FloatField & springConstant()
The spring constant of the module.
Definition: command.hpp:540
bool get() const
If the field has a value, returns that value; otherwise, returns false.
Definition: command.cpp:97
FloatField & effortLimitMin()
The firmware safety limit for the minimum allowed effort.
Definition: command.hpp:562
bool has() const
True if (and only if) the field has a value.
Definition: command.cpp:95
A message field for interfacing with a bank of I/O pins.
Definition: command.hpp:341
Triggering the M-Stop results in the motor holding the motor position. Operations resume to normal on...
FlagField & boot()
Boot the module from bootloader into application.
Definition: command.hpp:791
Actuator & actuator()
Actuator-specific settings, such as controller gains.
Definition: command.hpp:659
const HighResAngleField & position() const
Position of the module output (post-spring), in radians.
Definition: command.hpp:725
const IoBank & d() const
I/O pin bank d (pins 1-8 available)
Definition: command.hpp:468
void setInt(size_t pinNumber, int64_t value)
Sets the particular pin to a integer value (representing a digital output).
Definition: command.cpp:172
StringField & family()
Definition: command.hpp:677
Command objects have various fields that can be set; when sent to the module, these fields control in...
Definition: command.hpp:32
const BoolField & accelIncludesGravity() const
Whether to include acceleration due to gravity in acceleration feedback.
Definition: command.hpp:633
IoBank & a()
I/O pin bank a (pins 1-8 available)
Definition: command.hpp:454
A message field representable by a std::string.
Definition: command.hpp:231
BoolField & accelIncludesGravity()
Whether to include acceleration due to gravity in acceleration feedback.
Definition: command.hpp:631
Definition: color.hpp:5
void clear(size_t fieldNumber)
Removes any currently set value for the numbered subvalue of this field.
Definition: command.cpp:88
void set(size_t fieldNumber, float value)
Sets the particular numbered subvalue of this field to a given value.
Definition: command.cpp:84
std::string get() const
If the field has a value, returns a copy of that value; otherwise, returns a default.
Definition: command.cpp:119
void set()
Sets this flag.
Definition: command.cpp:146
A message field for interfacing with an LED.
Definition: command.hpp:395
const FlagField & clearLog() const
Clears the log message on the module.
Definition: command.hpp:801
Exceeding the position limit results in the actuator holding the position. Needs to be manually set t...
const FloatField & effortLimitMax() const
The firmware safety limit for the maximum allowed effort.
Definition: command.hpp:568
The motor is not given power (equivalent to a 0 PWM value)
const StringField & name() const
Definition: command.hpp:674
CommandGains & effortGains()
Controller gains for the effort PID loop.
Definition: command.hpp:533
#define HEBI_DISABLE_COPY_MOVE(Class)
Definition: util.hpp:6
const FlagField & reset() const
Restart the module.
Definition: command.hpp:789
const IoBank & c() const
I/O pin bank c (pins 1-8 available)
Definition: command.hpp:464
IoBank & c()
I/O pin bank c (pins 1-8 available)
Definition: command.hpp:462
const CommandGains & effortGains() const
Controller gains for the effort PID loop.
Definition: command.hpp:535
HighResAngleField & position()
Position of the module output (post-spring), in radians.
Definition: command.hpp:723
const FloatField & springConstant() const
The spring constant of the module.
Definition: command.hpp:542
Exceeding the position limit results in the control strategy being set to 'off'. Remains 'off' until ...
const EnumField< ControlStrategy > & controlStrategy() const
How the position, velocity, and effort PID loops are connected in order to control motor PWM.
Definition: command.hpp:580
CommandGains & velocityGains()
Controller gains for the velocity PID loop.
Definition: command.hpp:529
const IoBank & b() const
I/O pin bank b (pins 1-8 available)
Definition: command.hpp:460
Actuator-specific settings, such as controller gains.
Definition: command.hpp:496
Module settings that are typically changed at a slower rate.
Definition: command.hpp:493
const CommandGains & positionGains() const
Controller gains for the position PID loop.
Definition: command.hpp:527
FloatField & referencePosition()
Definition: command.hpp:545
bool has() const
True if (and only if) the field has a value.
Definition: command.cpp:32
const Settings & settings() const
Module settings that are typically changed at a slower rate.
Definition: command.hpp:768
A two-state message field (either set/true or cleared/false).
Definition: command.hpp:266
void set(T _value)
Sets the field to a given value.
Definition: command.hpp:327
bool has() const
Returns true if the flag is set, false if it is cleared.
Definition: command.cpp:144
StringField & appendLog()
Appends to the current log message on the module.
Definition: command.hpp:783
const Actuator & actuator() const
Actuator-specific settings, such as controller gains.
Definition: command.hpp:661
IoBank & b()
I/O pin bank b (pins 1-8 available)
Definition: command.hpp:458
const IoBank & e() const
I/O pin bank e (pins 1-8 available)
Definition: command.hpp:472
A message field containing a numbered set of single-precision floating point values.
Definition: command.hpp:172
Triggering the M-Stop has no effect.
const StringField & family() const
Definition: command.hpp:680
Color get() const
Returns the current LED command.
Definition: command.cpp:192
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...
Definition: command.cpp:160
double get() const
If the field has a value, returns that value as a double; otherwise, returns a default.
Definition: command.cpp:36
const FlagField & boot() const
Boot the module from bootloader into application.
Definition: command.hpp:793
FloatField & effortLimitMax()
The firmware safety limit for the maximum allowed effort.
Definition: command.hpp:566
EnumField< ControlStrategy > & controlStrategy()
How the position, velocity, and effort PID loops are connected in order to control motor PWM.
Definition: command.hpp:578
const LedField & led() const
The module's LED.
Definition: command.hpp:805
HighResAngleField & positionLimitMin()
The firmware safety limit for the minimum allowed position.
Definition: command.hpp:570
float getFloat(size_t pinNumber) const
If this numbered pin in this bank has an floating point (e.g., analog or PWM) value,...
Definition: command.cpp:166
FloatField & velocity()
Velocity of the module output (post-spring), in radians/second.
Definition: command.hpp:715
Exceeding the position limit results in a virtual spring that pushes the actuator back to within the ...
Any available digital or analog output pins on the device.
Definition: command.hpp:435
const HighResAngleField & positionLimitMin() const
The firmware safety limit for the minimum allowed position.
Definition: command.hpp:572
float get() const
If the field has a value, returns that value; otherwise, returns a default.
Definition: command.cpp:17
FloatField & referenceEffort()
The internal effort reference offset (setting this matches the current effort to the given reference ...
Definition: command.hpp:550
ControlStrategy
Definition: command.hpp:34
const EnumField< PositionLimitStrategy > & maxPositionLimitStrategy() const
The position limit strategy (at the maximum position) for the actuator.
Definition: command.hpp:592
const HighResAngleField & positionLimitMax() const
The firmware safety limit for the maximum allowed position.
Definition: command.hpp:576
const Imu & imu() const
IMU-specific settings.
Definition: command.hpp:665
const FloatField & referenceEffort() const
The internal effort reference offset (setting this matches the current effort to the given reference ...
Definition: command.hpp:552
const FlagField & saveCurrentSettings() const
Indicates if the module should save the current values of all of its settings.
Definition: command.hpp:684
void clear()
Removes any currently set value for this field.
Definition: command.hpp:332
IoBank & e()
I/O pin bank e (pins 1-8 available)
Definition: command.hpp:470
FlagField & clearLog()
Clears the log message on the module.
Definition: command.hpp:799
EnumField< PositionLimitStrategy > & maxPositionLimitStrategy()
The position limit strategy (at the maximum position) for the actuator.
Definition: command.hpp:590
const EnumField< MstopStrategy > & mstopStrategy() const
The motion stop strategy for the actuator.
Definition: command.hpp:584
T get() const
If the field has a value, returns that value; otherwise, returns a default.
Definition: command.hpp:321
void clear()
Removes any currently set value for this field, so that the module maintains its previous state of LE...
Definition: command.cpp:207
Command(Command &&other)
Move constructor (necessary for containment in STL template classes)
Definition: command.cpp:209
A message field for an angle measurement which does not lose precision at very high angles.
Definition: command.hpp:111
void set(double radians)
Sets the field to a given double value (in radians). Note that double precision floating point number...
Definition: command.cpp:52
Imu & imu()
IMU-specific settings.
Definition: command.hpp:663
const FlagField & stopBoot() const
Stop the module from automatically booting into application.
Definition: command.hpp:797
void clear()
Removes any currently set value for this field.
Definition: command.cpp:139
EnumField< MstopStrategy > & mstopStrategy()
The motion stop strategy for the actuator.
Definition: command.hpp:582
void set(float value)
Sets the field to a given value.
Definition: command.cpp:25
bool has() const
True if (and only if) the field has a value.
Definition: command.cpp:115
void set(bool value)
Sets the field to a given value.
Definition: command.cpp:105
const FloatField & velocity() const
Velocity of the module output (post-spring), in radians/second.
Definition: command.hpp:717
const Actuator & actuator() const
Actuator-specific commands.
Definition: command.hpp:772
float get(size_t fieldNumber) const
If the particular numbered subvalue of this field has a value, returns that value; otherwise returns ...
Definition: command.cpp:76
FloatField & velocityLimitMax()
The firmware safety limit for the maximum allowed velocity.
Definition: command.hpp:558
const StringField & appendLog() const
Appends to the current log message on the module.
Definition: command.hpp:785
const FloatField & velocityLimitMax() const
The firmware safety limit for the maximum allowed velocity.
Definition: command.hpp:560
IMU-specific settings.
Definition: command.hpp:618
StringField & name()
Definition: command.hpp:671
LedField & led()
The module's LED.
Definition: command.hpp:803
void setFloat(size_t pinNumber, float value)
Sets the particular pin to a floating point value (representing a PWM output).
Definition: command.cpp:176
Exceeding the position limit has no effect.
bool has() const
Returns true if the LED command has been set, and false otherwise.
Definition: command.cpp:187
bool hasFloat(size_t pinNumber) const
True if (and only if) the particular numbered pin in this bank has an floating point (e....
Definition: command.cpp:156
const CommandGains & velocityGains() const
Controller gains for the velocity PID loop.
Definition: command.hpp:531
bool hasInt(size_t pinNumber) const
True if (and only if) the particular numbered pin in this bank has an integer (e.g....
Definition: command.cpp:152
const IoBank & f() const
I/O pin bank f (pins 1-8 available)
Definition: command.hpp:476
A direct PWM value (-1 to 1) can be sent to the motor (subject to onboard safety limiting).
Structure to describe an RGB color.
Definition: color.hpp:8
CommandGains & positionGains()
Controller gains for the position PID loop.
Definition: command.hpp:525
A message field representable by a single-precision floating point value.
Definition: command.hpp:72
bool has(size_t fieldNumber) const
True if (and only if) the particular numbered subvalue of this field has a value.
Definition: command.cpp:72
void clear()
Clears this flag (e.g., sets it to false/off).
Definition: command.cpp:148
Command & operator=(Command &&other)=delete
PositionLimitStrategy
Definition: command.hpp:59
bool has() const
True if (and only if) the field has a value.
Definition: command.cpp:15
FloatField & velocityLimitMin()
The firmware safety limit for the minimum allowed velocity.
Definition: command.hpp:554
void clear(size_t pinNumber)
Removes any currently set value for this pin.
Definition: command.cpp:180
void set(const std::string &value)
Sets the field to a given value.
Definition: command.cpp:133
EnumField< PositionLimitStrategy > & minPositionLimitStrategy()
The position limit strategy (at the minimum position) for the actuator.
Definition: command.hpp:586
FlagField & stopBoot()
Stop the module from automatically booting into application.
Definition: command.hpp:795
A message field representable by an enum of a given type.
Definition: command.hpp:299
FloatField & effort()
Effort at the module output; units vary (e.g., N * m for rotational joints and N for linear stages).
Definition: command.hpp:719