3 #ifndef __DRIVE_STATUS_MACHINE_HPP__
4 #define __DRIVE_STATUS_MACHINE_HPP__
11 #include "PdoProtocol.hpp"
12 #include "StateObserver.hpp"
67 : rpdo(rpdo), stateObserver(timeout)
72 { this->rpdo = rpdo; }
109 mutable std::mutex stateMutex;
Representation of a CiA 402 state machine controller.
Definition: DriveStatusMachine.hpp:61
void reset()
Reset internally stored state.
Definition: DriveStatusMachine.cpp:163
DriveStatusMachine(ReceivePdo *rpdo, double timeout)
Constructor, registers RPDO handle.
Definition: DriveStatusMachine.hpp:66
word_t controlword() const
Retrieve stored controlword.
Definition: DriveStatusMachine.cpp:169
bool awaitState(DriveState goalState)
Await until drive reaches given state, with timeout.
Definition: DriveStatusMachine.cpp:234
DriveState getCurrentState() const
Parse stored bit representation of a statusword into a DriveState enumerator.
Definition: DriveStatusMachine.cpp:193
static DriveState parseStatusword(std::uint16_t statusword)
Parse bit representation into a DriveState enumerator.
Definition: DriveStatusMachine.cpp:244
std::bitset< 16 > word_t
Fixed-size sequence of 16 bits.
Definition: DriveStatusMachine.hpp:63
bool requestState(DriveState goalState)
Request given drive state via object 6040h (blocking), update stored controlword.
Definition: DriveStatusMachine.cpp:207
bool requestTransition(DriveTransition transition)
Request given drive transition via object 6040h (blocking), update stored controlword.
Definition: DriveStatusMachine.cpp:198
void configureRpdo(ReceivePdo *rpdo)
Configure RPDO handle.
Definition: DriveStatusMachine.hpp:71
bool update(std::uint16_t statusword)
Notify observers on a drive state change, if applicable.
Definition: DriveStatusMachine.cpp:144
word_t statusword() const
Retrieve stored statusword.
Definition: DriveStatusMachine.cpp:187
Representation of RPDO protocol.
Definition: PdoProtocol.hpp:178
Data-free state observer.
Definition: StateObserver.hpp:75
DriveTransition
CiA 402 drive transitions (associated to controlword).
Definition: DriveStatusMachine.hpp:38
DriveState
CiA 402 drive states (associated to statusword).
Definition: DriveStatusMachine.hpp:22
@ SWITCH_ON
Switch on command (xxxx.xxxx.0xxx.0111)
@ QUICK_STOP
Quick stop command (xxxx.xxxx.0xxx.x01x)
@ DISABLE_OPERATION
Disable operation command, alias for DriveTransition::SWITCH_ON.
@ FAULT_RESET
Reset fault command (xxxx.xxxx.1xxx.xxxx)
@ ENABLE_OPERATION
Enable operation command (xxxx.xxxx.0xxx.1111)
@ SHUTDOWN
Shutdown command (xxxx.xxxx.0xxx.x110)
@ DISABLE_VOLTAGE
Disable voltage command (xxxx.xxxx.0xxx.xx0x)
@ SWITCHED_ON
Switched on (operation disabled) state.
@ FAULT_REACTION_ACTIVE
Fault reaction active state.
@ QUICK_STOP_ACTIVE
Quick stop active state.
@ READY_TO_SWITCH_ON
Ready to switch on state.
@ OPERATION_ENABLED
Operation enabled state.
@ SWITCH_ON_DISABLED
Switch on disabled state.
@ NOT_READY_TO_SWITCH_ON
Not ready to switch on state.
The main, catch-all namespace for Robotics Lab UC3M.
Definition: groups.dox:6