HerkuleXLib  1.1
Arduino library to drive HerkuleX DRS-0101 and DRS-0201
/home/benoit/sketchbook/libraries/HerkuleXLib/HkxContRotation.h
Go to the documentation of this file.
1 #ifndef _HKXCONTROTATION_H
2 #define _HKXCONTROTATION_H
3 
13 #include "Arduino.h"
14 #include "HkxCommunication.h"
15 #include "HkxStatus.h"
16 
23 private:
29  boolean _connected;
32  const String _className;
35  uint8_t _id;
42 
53  uint8_t updateStatus();
54 
60  void errorPrint(const String& message){if(_print._errorMessages){_print.errorPrint(_className + message);}};
61 
67  void warningPrint(const String& message){if(_print._errorMessages){_print.warningPrint(_className + message);}};
68 
74  void infoPrint(const String& message){if(_print._errorMessages){_print.infoPrint(_className + message);}};
77 public:
92  HkxContRotation(uint8_t ID, HkxCommunication& herkXCom, HkxPrint& print);
93 
102  boolean tryConnect();
118  uint8_t getID() const {return this->_id;};
119 
133 
146  hkxLEDControl getLEDControl() const {return this->_ledControl;};
147 
154  HkxCommunication& getCommunication() const {return this->_herkXCom;};
155 
163  boolean isConnected() const {return this->_connected;};
164 
171  void setLEDControlVariable(hkxLEDControl newLEDControl){this->_ledControl = newLEDControl;};
190  boolean isStopped(){
191  this->updateStatus();
192  return !this->_statusED.isDetail(HKX_STAT_MOVING_FLAG);
193  };
194 
219  uint8_t getStatus(HkxStatus& statusED, boolean update);
220 
241  uint8_t clearStatus();
242 
272  uint8_t setTorqueLEDControl(HkxMaybe<hkxTorqueControl> newTorqueControl, HkxMaybe<hkxLEDControl> newLEDControl);
273 
301  uint8_t moveRotation(int16_t pwm, HkxMaybe<uint16_t> playTime, HkxMaybe<hkxLEDControl> LEDControl);
302 
329  uint8_t getBehaviour(HkxMaybe<uint16_t> inputVoltage, HkxMaybe<uint16_t> temperature, HkxMaybe<int16_t> velocity, HkxMaybe<int16_t> PWM);
330 
347  uint8_t reboot();
348 };
349 
350 #endif // _HKXCONTROTATION_H
351 
352 
353 
boolean _connected
Definition: HkxContRotation.h:29
uint8_t moveRotation(int16_t pwm, HkxMaybe< uint16_t > playTime, HkxMaybe< hkxLEDControl > LEDControl)
Move continuous rotation.
Definition: HkxContRotation.cpp:171
HkxPrint & _print
Definition: HkxContRotation.h:27
uint8_t getBehaviour(HkxMaybe< uint16_t > inputVoltage, HkxMaybe< uint16_t > temperature, HkxMaybe< int16_t > velocity, HkxMaybe< int16_t > PWM)
Get the servo behaviour.
Definition: HkxContRotation.cpp:220
void warningPrint(const String &message) const
Print warning.
Definition: HkxCommunication.h:394
HkxStatus _statusED
Definition: HkxContRotation.h:41
Class to drive one servo in continuous rotation mode.
Definition: HkxContRotation.h:22
hkxLEDControl _ledControl
Definition: HkxContRotation.h:39
void errorPrint(const String &message) const
Print error.
Definition: HkxCommunication.h:381
HkxContRotation(uint8_t ID, HkxCommunication &herkXCom, HkxPrint &print)
Constructor.
Definition: HkxContRotation.cpp:13
Status management of the Arduino library for HerkuleX servo (DRS-0101 and DRS-0201 models) ...
hkxTorqueControl
Torque control.
Definition: HkxCommunication.h:127
boolean isStopped()
Check if the servo stopped.
Definition: HkxContRotation.h:190
Class to manage the communication.
Definition: HkxCommunication.h:634
Class to manage the status of the servos.
Definition: HkxStatus.h:55
hkxTorqueControl getTorqueControl() const
Get torque control.
Definition: HkxContRotation.h:132
boolean isDetail(uint8_t mask) const
Check for details.
Definition: HkxStatus.h:118
uint8_t _id
Definition: HkxContRotation.h:35
hkxLEDControl
LED control.
Definition: HkxCommunication.h:146
uint8_t getStatus(HkxStatus &statusED, boolean update)
Get the status.
Definition: HkxContRotation.cpp:86
const uint8_t HKX_STAT_MOVING_FLAG
Definition: HkxStatus.h:33
Class to manage the print of the messages.
Definition: HkxCommunication.h:278
void infoPrint(const String &message) const
Print info.
Definition: HkxCommunication.h:407
uint8_t reboot()
Reboot servo.
Definition: HkxContRotation.cpp:259
hkxTorqueControl _torqueControl
Definition: HkxContRotation.h:37
uint8_t clearStatus()
Clear the status.
Definition: HkxContRotation.cpp:109
HkxCommunication & _herkXCom
Definition: HkxContRotation.h:25
hkxLEDControl getLEDControl() const
Get LED control.
Definition: HkxContRotation.h:146
uint8_t setTorqueLEDControl(HkxMaybe< hkxTorqueControl > newTorqueControl, HkxMaybe< hkxLEDControl > newLEDControl)
Set torque actuation and LED colour.
Definition: HkxContRotation.cpp:126
Communication management of the Arduino library for HerkuleX servo (DRS-0101 and DRS-0201 models) ...
uint8_t getID() const
Get the ID.
Definition: HkxContRotation.h:118