26#ifndef YARP_DEV_CIA402_STATE_MACHINE_H
27#define YARP_DEV_CIA402_STATE_MACHINE_H
55 const uint16_t x = sw & 0x006F;
56 const uint16_t y = sw & 0x004F;
83 return "SwitchOnDisabled";
85 return "ReadyToSwitchOn";
89 return "OperationEnabled";
91 return "QuickStopActive";
93 return "FaultReaction";
153 Command update(uint16_t statusword, int8_t opModeDisplay, int8_t opReq,
bool hwInhibit);
173 return (sw & 0x0004) != 0;
static bool isOperationEnabled(uint16_t sw)
Command update(uint16_t statusword, int8_t opModeDisplay, int8_t opReq, bool hwInhibit)
Computes the next control word and operation mode to send to the drive.
static bool isQuickStopActive(uint16_t sw)
static bool isOpEnabled(uint16_t sw)
~StateMachine()
Destructor.
static bool isFault(uint16_t sw)
void reset()
Resets the internal state machine.
Command faultReset() noexcept
Generates a fault reset command.
static bool isSwitchedOn(uint16_t sw)
static bool isFaultReactionActive(uint16_t sw)
int8_t getActiveOpMode() const noexcept
StateMachine()
Constructor.
static constexpr State sw_to_state(uint16_t sw)
static constexpr std::string_view state_to_string(State s)
bool writeOpMode
Flag indicating if the operation mode should be written.
int8_t opMode
Operation mode to send to the drive.
uint16_t controlword
Control word to send to the drive.