1 #ifndef _HKXPOSCONTROL_H
2 #define _HKXPOSCONTROL_H
32 const String _className;
71 uint8_t updateStatus();
78 void errorPrint(
const String& message){
if(_print._errorMessages){_print.
errorPrint(_className + message);}};
85 void warningPrint(
const String& message){
if(_print._errorMessages){_print.
warningPrint(_className + message);}};
92 void infoPrint(
const String& message){
if(_print._errorMessages){_print.
infoPrint(_className + message);}};
119 boolean tryConnect();
180 boolean isConnected()
const {
return this->
_connected;};
187 int16_t positionRelativeToAbsolute(int16_t positionRelative)
const {
return positionRelative +
_zeroPosition;};
194 int16_t positionAbsoluteToRelative(int16_t positionAbsolute)
const {
return positionAbsolute -
_zeroPosition;};
216 void setLEDControlVariable(
hkxLEDControl newLEDControl){this->_ledControl = newLEDControl;};
236 this->updateStatus();
328 uint8_t
setLoad(uint16_t newDeadZone, uint8_t newSaturatorOffset,
const uint32_t& newSaturatorSlope, int8_t newPWMOffset, uint8_t newMinPWM, uint16_t newMaxPWM);
359 uint8_t
setTorqueLEDControl(HkxMaybe<hkxTorqueControl> newTorqueControl, HkxMaybe<hkxLEDControl> newLEDControl);
410 uint8_t
movePosition(int16_t destinationAngle, uint16_t playTime, HkxMaybe<hkxLEDControl> LEDControl,
bool waitStop);
442 uint8_t
getBehaviour(HkxMaybe<uint16_t> inputVoltage, HkxMaybe<uint16_t> temperature, HkxMaybe<int16_t> position, HkxMaybe<int16_t> velocity, HkxMaybe<uint16_t> PWM, HkxMaybe<int16_t> goalPosition, HkxMaybe<int16_t> trajectoryPosition, HkxMaybe<int16_t> trajectoryVelocity);
463 #endif // _HKXPOSCONTROL_H
uint8_t reboot()
Reboot servo.
Definition: HkxPosControl.cpp:361
uint8_t getBehaviour(HkxMaybe< uint16_t > inputVoltage, HkxMaybe< uint16_t > temperature, HkxMaybe< int16_t > position, HkxMaybe< int16_t > velocity, HkxMaybe< uint16_t > PWM, HkxMaybe< int16_t > goalPosition, HkxMaybe< int16_t > trajectoryPosition, HkxMaybe< int16_t > trajectoryVelocity)
Get the servo behaviour.
Definition: HkxPosControl.cpp:310
uint16_t _saturatorSlope
Definition: HkxPosControl.h:43
void warningPrint(const String &message) const
Print warning.
Definition: HkxCommunication.h:394
uint8_t _id
Definition: HkxPosControl.h:37
uint8_t _saturatorOffset
Definition: HkxPosControl.h:41
void errorPrint(const String &message) const
Print error.
Definition: HkxCommunication.h:381
uint8_t getID() const
Get the ID.
Definition: HkxPosControl.h:135
uint8_t _deadZone
Definition: HkxPosControl.h:39
boolean isInPosition()
Check if the servo arrived.
Definition: HkxPosControl.h:235
Status management of the Arduino library for HerkuleX servo (DRS-0101 and DRS-0201 models) ...
uint16_t _minPosition
Definition: HkxPosControl.h:51
hkxTorqueControl
Torque control.
Definition: HkxCommunication.h:127
Class to manage the communication.
Definition: HkxCommunication.h:634
Class to manage the status of the servos.
Definition: HkxStatus.h:55
uint8_t clearStatus()
Clear the status.
Definition: HkxPosControl.cpp:119
hkxTorqueControl getTorqueControl() const
Get torque control.
Definition: HkxPosControl.h:149
hkxLEDControl getLEDControl() const
Get LED control.
Definition: HkxPosControl.h:163
uint8_t setTorqueLEDControl(HkxMaybe< hkxTorqueControl > newTorqueControl, HkxMaybe< hkxLEDControl > newLEDControl)
Set torque actuation and LED colour.
Definition: HkxPosControl.cpp:181
boolean _connected
Definition: HkxPosControl.h:29
HkxCommunication & _herkXCom
Definition: HkxPosControl.h:25
boolean isDetail(uint8_t mask) const
Check for details.
Definition: HkxStatus.h:118
uint8_t setCurrentPositionTo(int16_t currentPosition)
Set current position.
Definition: HkxPosControl.cpp:226
uint16_t _maxPWM
Definition: HkxPosControl.h:49
Class to drive one servo in position control mode.
Definition: HkxPosControl.h:22
hkxTorqueControl _torqueControl
Definition: HkxPosControl.h:55
hkxLEDControl
LED control.
Definition: HkxCommunication.h:146
hkxLEDControl _ledControl
Definition: HkxPosControl.h:57
int16_t _zeroPosition
Definition: HkxPosControl.h:35
uint8_t getStatus(HkxStatus &statusED, boolean update)
Get the status.
Definition: HkxPosControl.cpp:96
HkxPosControl(uint8_t ID, HkxCommunication &herkXCom, HkxPrint &print)
Constructor.
Definition: HkxPosControl.cpp:13
uint16_t _maxPosition
Definition: HkxPosControl.h:53
Class to manage the print of the messages.
Definition: HkxCommunication.h:278
void infoPrint(const String &message) const
Print info.
Definition: HkxCommunication.h:407
HkxPrint & _print
Definition: HkxPosControl.h:27
uint8_t setLoad(uint16_t newDeadZone, uint8_t newSaturatorOffset, const uint32_t &newSaturatorSlope, int8_t newPWMOffset, uint8_t newMinPWM, uint16_t newMaxPWM)
Set load control parameters.
Definition: HkxPosControl.cpp:137
const uint8_t HKX_STAT_INPOSITION_FLAG
Definition: HkxStatus.h:35
uint8_t _minPWM
Definition: HkxPosControl.h:47
HkxStatus _statusED
Definition: HkxPosControl.h:59
Communication management of the Arduino library for HerkuleX servo (DRS-0101 and DRS-0201 models) ...
uint8_t movePosition(int16_t destinationAngle, uint16_t playTime, HkxMaybe< hkxLEDControl > LEDControl, bool waitStop)
Move position.
Definition: HkxPosControl.cpp:260
int8_t _pwmOffset
Definition: HkxPosControl.h:45