HEBI C++ API  3.5.1
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 "message_helpers.hpp"
10 #include "util.hpp"
11 
12 namespace hebi {
13 
33 class Command final {
34 public:
35  enum class ControlStrategy {
37  Off,
39  DirectPWM,
42  Strategy2,
45  Strategy3,
48  Strategy4,
49  };
50 
51  enum class MstopStrategy {
53  Disabled,
55  MotorOff,
58  };
59 
60  enum class PositionLimitStrategy {
66  MotorOff,
68  Disabled,
69  };
70 
71 protected:
73  class FloatField final {
74  public:
75 #ifndef DOXYGEN_OMIT_INTERNAL
76  FloatField(HebiCommandRef& internal, HebiCommandFloatField field);
77 #endif // DOXYGEN_OMIT_INTERNAL
78  explicit operator bool() const { return has(); }
92  bool has() const;
95  float get() const;
97  void set(float value);
99  void clear();
100 
102  private:
103  HebiCommandRef& internal_;
104  HebiCommandFloatField const field_;
105  };
106 
112  class HighResAngleField final {
113  public:
114 #ifndef DOXYGEN_OMIT_INTERNAL
115  HighResAngleField(HebiCommandRef& internal, HebiCommandHighResAngleField field);
116 #endif // DOXYGEN_OMIT_INTERNAL
117  explicit operator bool() const { return has(); }
131  bool has() const;
137  double get() const;
149  void get(int64_t* revolutions, float* radian_offset) const;
154  void set(double radians);
161  void set(int64_t revolutions, float radian_offset);
163  void clear();
164 
166  private:
167  HebiCommandRef& internal_;
168  HebiCommandHighResAngleField const field_;
169  };
170 
173  class NumberedFloatField final {
174  public:
175 #ifndef DOXYGEN_OMIT_INTERNAL
176  NumberedFloatField(HebiCommandRef& internal, HebiCommandNumberedFloatField field);
177 #endif // DOXYGEN_OMIT_INTERNAL
178  bool has(size_t fieldNumber) const;
189  float get(size_t fieldNumber) const;
195  void set(size_t fieldNumber, float value);
201  void clear(size_t fieldNumber);
202 
204  private:
205  HebiCommandRef& internal_;
206  HebiCommandNumberedFloatField const field_;
207  };
208 
210  class BoolField final {
211  public:
212 #ifndef DOXYGEN_OMIT_INTERNAL
213  BoolField(HebiCommandRef& internal, HebiCommandBoolField field);
214 #endif // DOXYGEN_OMIT_INTERNAL
215  bool has() const;
219  bool get() const;
221  void set(bool value);
223  void clear();
224 
226  private:
227  HebiCommandRef& internal_;
228  HebiCommandBoolField const field_;
229  };
230 
232  class StringField final {
233  public:
234 #ifndef DOXYGEN_OMIT_INTERNAL
235  StringField(HebiCommandPtr internal, HebiCommandStringField field);
236 #endif // DOXYGEN_OMIT_INTERNAL
237  explicit operator bool() const { return has(); }
251  bool has() const;
254  std::string get() const;
256  void set(const std::string& value);
258  void clear();
259 
261  private:
262  HebiCommandPtr const internal_;
263  HebiCommandStringField const field_;
264  };
265 
267  class FlagField final {
268  public:
269 #ifndef DOXYGEN_OMIT_INTERNAL
270  FlagField(HebiCommandRef& internal, HebiCommandFlagField field);
271 #endif // DOXYGEN_OMIT_INTERNAL
272  explicit operator bool() const { return has(); }
286  bool has() const;
288  void set();
290  void clear();
291 
293  private:
294  HebiCommandRef& internal_;
295  HebiCommandFlagField const field_;
296  };
297 
299  template<typename T>
300  class EnumField final {
301  public:
302 #ifndef DOXYGEN_OMIT_INTERNAL
303  EnumField(HebiCommandRef& internal, HebiCommandEnumField field) : internal_(internal), field_(field) {}
304 #endif // DOXYGEN_OMIT_INTERNAL
305  explicit operator bool() const { return has(); }
319  bool has() const {
320  return enumGetter(internal_, field_, nullptr) == HebiStatusSuccess;
321  }
324  T get() const {
325  int32_t ret{};
326  enumGetter(internal_, field_, &ret);
327  return static_cast<T>(ret);
328  }
330  void set(T _value) {
331  int32_t value = static_cast<int32_t>(_value);
332  hebiCommandSetEnum(internal_, field_, &value);
333  }
335  void clear() {
336  hebiCommandSetEnum(internal_, field_, nullptr);
337  }
338 
340  private:
341  HebiCommandRef& internal_;
342  HebiCommandEnumField const field_;
343  };
344 
346  class IoBank final {
347  public:
348 #ifndef DOXYGEN_OMIT_INTERNAL
349  IoBank(HebiCommandPtr internal, HebiCommandRef& internal_ref, HebiCommandIoPinBank bank);
350 #endif // DOXYGEN_OMIT_INTERNAL
351  bool hasInt(size_t pinNumber) const;
362  bool hasFloat(size_t pinNumber) const;
368  int64_t getInt(size_t pinNumber) const;
375  float getFloat(size_t pinNumber) const;
381  void setInt(size_t pinNumber, int64_t value);
387  void setFloat(size_t pinNumber, float value);
393  bool hasLabel(size_t pinNumber) const;
399  std::string getLabel(size_t pinNumber) const;
404  void setLabel(size_t pinNumber, const std::string&);
409  void clear(size_t pinNumber);
410 
412  private:
413  HebiCommandPtr internal_;
414  HebiCommandRef& internal_ref_;
415  HebiCommandIoPinBank const bank_;
416  };
418  class LedField final {
419  public:
420 #ifndef DOXYGEN_OMIT_INTERNAL
421  LedField(HebiCommandRef& internal, HebiCommandLedField field);
422 #endif // DOXYGEN_OMIT_INTERNAL
423  bool has() const;
438  Color get() const;
444  void set(const Color& color);
449  void clear();
450 
452  private:
453  HebiCommandRef& internal_;
454  HebiCommandLedField const field_;
455  };
456 
458  class Io final {
459  public:
460 #ifndef DOXYGEN_OMIT_INTERNAL
461  Io(HebiCommandPtr internal, HebiCommandRef& internal_ref)
462  : a_(internal, internal_ref, HebiCommandIoBankA),
463  b_(internal, internal_ref, HebiCommandIoBankB),
464  c_(internal, internal_ref, HebiCommandIoBankC),
465  d_(internal, internal_ref, HebiCommandIoBankD),
466  e_(internal, internal_ref, HebiCommandIoBankE),
467  f_(internal, internal_ref, HebiCommandIoBankF) {}
468 #endif // DOXYGEN_OMIT_INTERNAL
469 
470  // With all submessage and field getters: Note that the returned reference
471  // should not be used after the lifetime of this parent.
472 
473  // Subfields ----------------
474 
476  IoBank& a() { return a_; }
478  const IoBank& a() const { return a_; }
480  IoBank& b() { return b_; }
482  const IoBank& b() const { return b_; }
484  IoBank& c() { return c_; }
486  const IoBank& c() const { return c_; }
488  IoBank& d() { return d_; }
490  const IoBank& d() const { return d_; }
492  IoBank& e() { return e_; }
494  const IoBank& e() const { return e_; }
496  IoBank& f() { return f_; }
498  const IoBank& f() const { return f_; }
499 
501  private:
502  IoBank a_;
503  IoBank b_;
504  IoBank c_;
505  IoBank d_;
506  IoBank e_;
507  IoBank f_;
508  };
509 
511 
513  class Settings final {
514  protected:
516  class Actuator final {
517  public:
518 #ifndef DOXYGEN_OMIT_INTERNAL
519  Actuator(HebiCommandRef& internal)
520  : position_gains_(internal, HebiCommandFloatPositionKp, HebiCommandBoolPositionDOnError),
521  velocity_gains_(internal, HebiCommandFloatVelocityKp, HebiCommandBoolVelocityDOnError),
522  effort_gains_(internal, HebiCommandFloatEffortKp, HebiCommandBoolEffortDOnError),
523  spring_constant_(internal, HebiCommandFloatSpringConstant),
524  reference_position_(internal, HebiCommandFloatReferencePosition),
525  reference_effort_(internal, HebiCommandFloatReferenceEffort),
526  velocity_limit_min_(internal, HebiCommandFloatVelocityLimitMin),
527  velocity_limit_max_(internal, HebiCommandFloatVelocityLimitMax),
528  effort_limit_min_(internal, HebiCommandFloatEffortLimitMin),
529  effort_limit_max_(internal, HebiCommandFloatEffortLimitMax),
530  position_limit_min_(internal, HebiCommandHighResAnglePositionLimitMin),
531  position_limit_max_(internal, HebiCommandHighResAnglePositionLimitMax),
532  control_strategy_(internal, HebiCommandEnumControlStrategy),
533  mstop_strategy_(internal, HebiCommandEnumMstopStrategy),
534  min_position_limit_strategy_(internal, HebiCommandEnumMinPositionLimitStrategy),
535  max_position_limit_strategy_(internal, HebiCommandEnumMaxPositionLimitStrategy) {}
536 #endif // DOXYGEN_OMIT_INTERNAL
537 
538  // With all submessage and field getters: Note that the returned reference
539  // should not be used after the lifetime of this parent.
540 
541  // Submessages ----------------
542 
544  CommandGains& positionGains() { return position_gains_; }
546  const CommandGains& positionGains() const { return position_gains_; }
548  CommandGains& velocityGains() { return velocity_gains_; }
550  const CommandGains& velocityGains() const { return velocity_gains_; }
552  CommandGains& effortGains() { return effort_gains_; }
554  const CommandGains& effortGains() const { return effort_gains_; }
555 
556  // Subfields ----------------
557 
559  FloatField& springConstant() { return spring_constant_; }
561  const FloatField& springConstant() const { return spring_constant_; }
564  FloatField& referencePosition() { return reference_position_; }
567  const FloatField& referencePosition() const { return reference_position_; }
569  FloatField& referenceEffort() { return reference_effort_; }
571  const FloatField& referenceEffort() const { return reference_effort_; }
573  FloatField& velocityLimitMin() { return velocity_limit_min_; }
575  const FloatField& velocityLimitMin() const { return velocity_limit_min_; }
577  FloatField& velocityLimitMax() { return velocity_limit_max_; }
579  const FloatField& velocityLimitMax() const { return velocity_limit_max_; }
581  FloatField& effortLimitMin() { return effort_limit_min_; }
583  const FloatField& effortLimitMin() const { return effort_limit_min_; }
585  FloatField& effortLimitMax() { return effort_limit_max_; }
587  const FloatField& effortLimitMax() const { return effort_limit_max_; }
589  HighResAngleField& positionLimitMin() { return position_limit_min_; }
591  const HighResAngleField& positionLimitMin() const { return position_limit_min_; }
593  HighResAngleField& positionLimitMax() { return position_limit_max_; }
595  const HighResAngleField& positionLimitMax() const { return position_limit_max_; }
597  EnumField<ControlStrategy>& controlStrategy() { return control_strategy_; }
599  const EnumField<ControlStrategy>& controlStrategy() const { return control_strategy_; }
601  EnumField<MstopStrategy>& mstopStrategy() { return mstop_strategy_; }
603  const EnumField<MstopStrategy>& mstopStrategy() const { return mstop_strategy_; }
605  EnumField<PositionLimitStrategy>& minPositionLimitStrategy() { return min_position_limit_strategy_; }
607  const EnumField<PositionLimitStrategy>& minPositionLimitStrategy() const { return min_position_limit_strategy_; }
609  EnumField<PositionLimitStrategy>& maxPositionLimitStrategy() { return max_position_limit_strategy_; }
611  const EnumField<PositionLimitStrategy>& maxPositionLimitStrategy() const { return max_position_limit_strategy_; }
612 
614  private:
615  CommandGains position_gains_;
616  CommandGains velocity_gains_;
617  CommandGains effort_gains_;
618 
619  FloatField spring_constant_;
620  FloatField reference_position_;
621  FloatField reference_effort_;
622  FloatField velocity_limit_min_;
623  FloatField velocity_limit_max_;
624  FloatField effort_limit_min_;
625  FloatField effort_limit_max_;
626  HighResAngleField position_limit_min_;
627  HighResAngleField position_limit_max_;
628  EnumField<ControlStrategy> control_strategy_;
629  EnumField<MstopStrategy> mstop_strategy_;
630  EnumField<PositionLimitStrategy> min_position_limit_strategy_;
631  EnumField<PositionLimitStrategy> max_position_limit_strategy_;
632  };
633 
635  class Imu final {
636  public:
637 #ifndef DOXYGEN_OMIT_INTERNAL
638  Imu(HebiCommandRef& internal)
639  : internal_(internal), accel_includes_gravity_(internal, HebiCommandBoolAccelIncludesGravity) {}
640 #endif // DOXYGEN_OMIT_INTERNAL
641 
642  // With all submessage and field getters: Note that the returned reference
643  // should not be used after the lifetime of this parent.
644 
645  // Subfields ----------------
646 
648  BoolField& accelIncludesGravity() { return accel_includes_gravity_; }
650  const BoolField& accelIncludesGravity() const { return accel_includes_gravity_; }
651 
653  private:
654  const HebiCommandRef& internal_;
655 
656  BoolField accel_includes_gravity_;
657  };
658 
659  public:
660 #ifndef DOXYGEN_OMIT_INTERNAL
661  Settings(HebiCommandPtr internal_ptr, HebiCommandRef& internal)
662  : internal_(internal),
663  actuator_(internal),
664  imu_(internal),
665  name_(internal_ptr, HebiCommandStringName),
666  family_(internal_ptr, HebiCommandStringFamily),
667  save_current_settings_(internal, HebiCommandFlagSaveCurrentSettings) {}
668 #endif // DOXYGEN_OMIT_INTERNAL
669 
670  // With all submessage and field getters: Note that the returned reference
671  // should not be used after the lifetime of this parent.
672 
673  // Submessages ----------------
674 
676  Actuator& actuator() { return actuator_; }
678  const Actuator& actuator() const { return actuator_; }
680  Imu& imu() { return imu_; }
682  const Imu& imu() const { return imu_; }
683 
684  // Subfields ----------------
685 
688  StringField& name() { return name_; }
691  const StringField& name() const { return name_; }
694  StringField& family() { return family_; }
697  const StringField& family() const { return family_; }
699  FlagField& saveCurrentSettings() { return save_current_settings_; }
701  const FlagField& saveCurrentSettings() const { return save_current_settings_; }
702 
704 
705  private:
706  HebiCommandRef& internal_;
707 
708  Actuator actuator_;
709  Imu imu_;
710 
711  StringField name_;
712  StringField family_;
713  FlagField save_current_settings_;
714  };
715 
717  class Actuator final {
718  public:
719 #ifndef DOXYGEN_OMIT_INTERNAL
720  Actuator(HebiCommandRef& internal)
721  : internal_(internal),
722  velocity_(internal, HebiCommandFloatVelocity),
723  effort_(internal, HebiCommandFloatEffort),
724  position_(internal, HebiCommandHighResAnglePosition) {}
725 #endif // DOXYGEN_OMIT_INTERNAL
726 
727  // With all submessage and field getters: Note that the returned reference
728  // should not be used after the lifetime of this parent.
729 
730  // Subfields ----------------
731 
733  FloatField& velocity() { return velocity_; }
735  const FloatField& velocity() const { return velocity_; }
737  FloatField& effort() { return effort_; }
739  const FloatField& effort() const { return effort_; }
741  HighResAngleField& position() { return position_; }
743  const HighResAngleField& position() const { return position_; }
744 
746  private:
747  const HebiCommandRef& internal_;
748 
749  FloatField velocity_;
750  FloatField effort_;
751  HighResAngleField position_;
752  };
753 
754 private:
759  HebiCommandPtr internal_;
760  HebiCommandRef internal_ref_;
761 
762 public:
763 #ifndef DOXYGEN_OMIT_INTERNAL
764 
768  Command(HebiCommandPtr);
769 #endif // DOXYGEN_OMIT_INTERNAL
770 
773  Command(Command&& other);
774 
775  // With all submessage and field getters: Note that the returned reference
776  // should not be used after the lifetime of this parent.
777 
778  // Submessages -------------------------------------------------------------
779 
781  Io& io() { return io_; }
783  const Io& io() const { return io_; }
785  Settings& settings() { return settings_; }
787  const Settings& settings() const { return settings_; }
789  Actuator& actuator() { return actuator_; }
791  const Actuator& actuator() const { return actuator_; }
792 
793  // Subfields -------------------------------------------------------------
794 
795 #ifndef DOXYGEN_OMIT_INTERNAL
796  NumberedFloatField& debug() { return debug_; }
799  const NumberedFloatField& debug() const { return debug_; }
800 #endif // DOXYGEN_OMIT_INTERNAL
801  StringField& appendLog() { return append_log_; }
804  const StringField& appendLog() const { return append_log_; }
806  FlagField& reset() { return reset_; }
808  const FlagField& reset() const { return reset_; }
810  FlagField& boot() { return boot_; }
812  const FlagField& boot() const { return boot_; }
814  FlagField& stopBoot() { return stop_boot_; }
816  const FlagField& stopBoot() const { return stop_boot_; }
818  FlagField& clearLog() { return clear_log_; }
820  const FlagField& clearLog() const { return clear_log_; }
822  LedField& led() { return led_; }
824  const LedField& led() const { return led_; }
825 
830 
831  /* Disable move assigment operator. */
832  Command& operator=(Command&& other) = delete;
833 
834 private:
835  Io io_;
836  Settings settings_;
837  Actuator actuator_;
838 
839  NumberedFloatField debug_;
840  StringField append_log_;
841  FlagField reset_;
842  FlagField boot_;
843  FlagField stop_boot_;
844  FlagField clear_log_;
845  LedField led_;
846 };
847 
848 } // namespace hebi
const FloatField & referencePosition() const
Definition: command.hpp:567
void clear()
Removes any currently set value for this field.
Definition: command.cpp:108
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:220
bool has() const
True if (and only if) the field has a value.
Definition: command.hpp:319
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:478
IoBank & f()
I/O pin bank f (pins 1-8 available)
Definition: command.hpp:496
FlagField & reset()
Restart the module.
Definition: command.hpp:806
FlagField & saveCurrentSettings()
Indicates if the module should save the current values of all of its settings.
Definition: command.hpp:699
IoBank & d()
I/O pin bank d (pins 1-8 available)
Definition: command.hpp:488
const EnumField< PositionLimitStrategy > & minPositionLimitStrategy() const
The position limit strategy (at the minimum position) for the actuator.
Definition: command.hpp:607
MstopStrategy
Definition: command.hpp:51
const FloatField & effortLimitMin() const
The firmware safety limit for the minimum allowed effort.
Definition: command.hpp:583
const FloatField & velocityLimitMin() const
The firmware safety limit for the minimum allowed velocity.
Definition: command.hpp:575
HighResAngleField & positionLimitMax()
The firmware safety limit for the maximum allowed position.
Definition: command.hpp:593
#define HEBI_DISABLE_COPY(Class)
Definition: util.hpp:16
void clear()
Removes any currently set value for this field.
Definition: command.cpp:27
std::string getLabel(size_t pinNumber) const
If this numbered pin in this bank has a string label value, returns that value; otherwise returns an ...
Definition: command.cpp:180
A message field representable by a bool value.
Definition: command.hpp:210
Actuator & actuator()
Actuator-specific commands.
Definition: command.hpp:789
Actuator-specific commands.
Definition: command.hpp:717
void hebiCommandSetEnum(HebiCommandRef &command, HebiCommandEnumField field, const int32_t *value)
Definition: message_helpers.cpp:388
Io & io()
Any available digital or analog output pins on the device.
Definition: command.hpp:781
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:739
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:785
const Io & io() const
Any available digital or analog output pins on the device.
Definition: command.hpp:783
FloatField & springConstant()
The spring constant of the module.
Definition: command.hpp:559
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:581
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:346
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:810
Actuator & actuator()
Actuator-specific settings, such as controller gains.
Definition: command.hpp:676
const HighResAngleField & position() const
Position of the module output (post-spring), in radians.
Definition: command.hpp:743
const IoBank & d() const
I/O pin bank d (pins 1-8 available)
Definition: command.hpp:490
void setInt(size_t pinNumber, int64_t value)
Sets the particular pin to a integer value (representing a digital output).
Definition: command.cpp:168
StringField & family()
Definition: command.hpp:694
Command objects have various fields that can be set; when sent to the module, these fields control in...
Definition: command.hpp:33
const BoolField & accelIncludesGravity() const
Whether to include acceleration due to gravity in acceleration feedback.
Definition: command.hpp:650
IoBank & a()
I/O pin bank a (pins 1-8 available)
Definition: command.hpp:476
A message field representable by a std::string.
Definition: command.hpp:232
BoolField & accelIncludesGravity()
Whether to include acceleration due to gravity in acceleration feedback.
Definition: command.hpp:648
Definition: arm.cpp:5
bool hasLabel(size_t pinNumber) const
True if (and only if) the particular numbered pin in this bank has a string label set in this message...
Definition: command.cpp:176
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:117
void set()
Sets this flag.
Definition: command.cpp:142
A message field for interfacing with an LED.
Definition: command.hpp:418
const FlagField & clearLog() const
Clears the log message on the module.
Definition: command.hpp:820
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:587
The motor is not given power (equivalent to a 0 PWM value)
const StringField & name() const
Definition: command.hpp:691
CommandGains & effortGains()
Controller gains for the effort PID loop.
Definition: command.hpp:552
#define HEBI_DISABLE_COPY_MOVE(Class)
Definition: util.hpp:6
const FlagField & reset() const
Restart the module.
Definition: command.hpp:808
const IoBank & c() const
I/O pin bank c (pins 1-8 available)
Definition: command.hpp:486
IoBank & c()
I/O pin bank c (pins 1-8 available)
Definition: command.hpp:484
const CommandGains & effortGains() const
Controller gains for the effort PID loop.
Definition: command.hpp:554
HighResAngleField & position()
Position of the module output (post-spring), in radians.
Definition: command.hpp:741
const FloatField & springConstant() const
The spring constant of the module.
Definition: command.hpp:561
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:599
CommandGains & velocityGains()
Controller gains for the velocity PID loop.
Definition: command.hpp:548
const IoBank & b() const
I/O pin bank b (pins 1-8 available)
Definition: command.hpp:482
Actuator-specific settings, such as controller gains.
Definition: command.hpp:516
Module settings that are typically changed at a slower rate.
Definition: command.hpp:513
const CommandGains & positionGains() const
Controller gains for the position PID loop.
Definition: command.hpp:546
FloatField & referencePosition()
Definition: command.hpp:564
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:787
A two-state message field (either set/true or cleared/false).
Definition: command.hpp:267
void set(T _value)
Sets the field to a given value.
Definition: command.hpp:330
bool has() const
Returns true if the flag is set, false if it is cleared.
Definition: command.cpp:140
StringField & appendLog()
Appends to the current log message on the module.
Definition: command.hpp:802
const Actuator & actuator() const
Actuator-specific settings, such as controller gains.
Definition: command.hpp:678
IoBank & b()
I/O pin bank b (pins 1-8 available)
Definition: command.hpp:480
const IoBank & e() const
I/O pin bank e (pins 1-8 available)
Definition: command.hpp:494
A message field containing a numbered set of single-precision floating point values.
Definition: command.hpp:173
Triggering the M-Stop has no effect.
HebiStatusCode enumGetter(const RefT &ref, MetadataT &metadata, int field, int32_t *value)
Definition: message_helpers.cpp:298
const StringField & family() const
Definition: command.hpp:697
Color get() const
Returns the current LED command.
Definition: command.cpp:209
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:156
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:812
FloatField & effortLimitMax()
The firmware safety limit for the maximum allowed effort.
Definition: command.hpp:585
EnumField< ControlStrategy > & controlStrategy()
How the position, velocity, and effort PID loops are connected in order to control motor PWM.
Definition: command.hpp:597
const LedField & led() const
The module's LED.
Definition: command.hpp:824
HighResAngleField & positionLimitMin()
The firmware safety limit for the minimum allowed position.
Definition: command.hpp:589
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:162
FloatField & velocity()
Velocity of the module output (post-spring), in radians/second.
Definition: command.hpp:733
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:458
const HighResAngleField & positionLimitMin() const
The firmware safety limit for the minimum allowed position.
Definition: command.hpp:591
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:569
ControlStrategy
Definition: command.hpp:35
const EnumField< PositionLimitStrategy > & maxPositionLimitStrategy() const
The position limit strategy (at the maximum position) for the actuator.
Definition: command.hpp:611
const HighResAngleField & positionLimitMax() const
The firmware safety limit for the maximum allowed position.
Definition: command.hpp:595
const Imu & imu() const
IMU-specific settings.
Definition: command.hpp:682
const FloatField & referenceEffort() const
The internal effort reference offset (setting this matches the current effort to the given reference ...
Definition: command.hpp:571
const FlagField & saveCurrentSettings() const
Indicates if the module should save the current values of all of its settings.
Definition: command.hpp:701
void clear()
Removes any currently set value for this field.
Definition: command.hpp:335
IoBank & e()
I/O pin bank e (pins 1-8 available)
Definition: command.hpp:492
FlagField & clearLog()
Clears the log message on the module.
Definition: command.hpp:818
EnumField< PositionLimitStrategy > & maxPositionLimitStrategy()
The position limit strategy (at the maximum position) for the actuator.
Definition: command.hpp:609
const EnumField< MstopStrategy > & mstopStrategy() const
The motion stop strategy for the actuator.
Definition: command.hpp:603
T get() const
If the field has a value, returns that value; otherwise, returns a default.
Definition: command.hpp:324
void clear()
Removes any currently set value for this field, so that the module maintains its previous state of LE...
Definition: command.cpp:224
Command(Command &&other)
Move constructor (necessary for containment in STL template classes)
Definition: command.cpp:228
A message field for an angle measurement which does not lose precision at very high angles.
Definition: command.hpp:112
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:680
const FlagField & stopBoot() const
Stop the module from automatically booting into application.
Definition: command.hpp:816
void clear()
Removes any currently set value for this field.
Definition: command.cpp:135
EnumField< MstopStrategy > & mstopStrategy()
The motion stop strategy for the actuator.
Definition: command.hpp:601
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:113
void set(bool value)
Sets the field to a given value.
Definition: command.cpp:103
const FloatField & velocity() const
Velocity of the module output (post-spring), in radians/second.
Definition: command.hpp:735
const Actuator & actuator() const
Actuator-specific commands.
Definition: command.hpp:791
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:577
const StringField & appendLog() const
Appends to the current log message on the module.
Definition: command.hpp:804
const FloatField & velocityLimitMax() const
The firmware safety limit for the maximum allowed velocity.
Definition: command.hpp:579
IMU-specific settings.
Definition: command.hpp:635
StringField & name()
Definition: command.hpp:688
LedField & led()
The module's LED.
Definition: command.hpp:822
void setFloat(size_t pinNumber, float value)
Sets the particular pin to a floating point value (representing a PWM output).
Definition: command.cpp:172
void setLabel(size_t pinNumber, const std::string &)
Sets the string label for a particular pin.
Definition: command.cpp:192
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:205
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:152
const CommandGains & velocityGains() const
Controller gains for the velocity PID loop.
Definition: command.hpp:550
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:148
const IoBank & f() const
I/O pin bank f (pins 1-8 available)
Definition: command.hpp:498
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:544
A message field representable by a single-precision floating point value.
Definition: command.hpp:73
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:144
Command & operator=(Command &&other)=delete
PositionLimitStrategy
Definition: command.hpp:60
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:573
void clear(size_t pinNumber)
Removes any currently set value for this pin.
Definition: command.cpp:198
void set(const std::string &value)
Sets the field to a given value.
Definition: command.cpp:129
EnumField< PositionLimitStrategy > & minPositionLimitStrategy()
The position limit strategy (at the minimum position) for the actuator.
Definition: command.hpp:605
FlagField & stopBoot()
Stop the module from automatically booting into application.
Definition: command.hpp:814
A message field representable by an enum of a given type.
Definition: command.hpp:300
FloatField & effort()
Effort at the module output; units vary (e.g., N * m for rotational joints and N for linear stages).
Definition: command.hpp:737