Go to the documentation of this file.
42 std::initializer_list<std::pair<std::string_view, entry>>);
75 static constexpr
const int8_t
PP_mode = 1;
76 static constexpr
const int8_t
PV_mode = 3;
77 static constexpr
const int8_t
PT_mode = 4;
79 static constexpr
const int8_t
IP_mode = 7;
134 CIA402Device(uint16_t& control_word, uint16_t& status_word,
135 int8_t& mode_set, int8_t& mode_read);
258 void pause(
bool doit);
350 std::function<
bool()> check_quick_stop);
386 uint16_t& status_word, int8_t& mode_set,
398 uint16_t* status_word, int8_t* mode_set,
410 uint8_t* status_word_addr,
411 uint8_t* mode_set_addr,
412 uint8_t* mode_read_addr);
static constexpr const uint16_t quick_stop_active_code
Definition: cia402_device.h:69
int8_t current_control_mode() const
Utility function for implementing the control_mode() function of derived classes.
bool voltage_enabled() const
Tell whether device is powered with high voltage.
bool set_point_defined_
Definition: cia402_device.h:461
bool active_
Definition: cia402_device.h:452
@ not_ready_to_switch_on
Definition: cia402_device.h:90
void finish()
Put the sensojoint is a safe, configuration possible, state.
static std::string_view control_mode_to_str(int8_t)
convert the control mode into a human readable information
static constexpr const int8_t PP_mode
Profile position.
Definition: cia402_device.h:75
@ fault_reset_op
Command to active state transition 15.
Definition: cia402_device.h:112
virtual bool position_mode() const
static constexpr const uint16_t not_ready_to_switch_on_code
Definition: cia402_device.h:64
void set_quick_stop_reaction(std::function< void()> reaction)
Set the quick stop reaction function called when a quick stop procedure starts.
static void set_control_word(uint16_t &controlword, control_t ctrl)
Set the control word of a CiA402 device according to the desired control state.
std::function< bool()> leaving_enabled_requires_quick_stop_
Definition: cia402_device.h:467
Header file for SlaveDevice class.
int8_t * mode_set_
Definition: cia402_device.h:464
bool go_back_to_monitor_mode_
Definition: cia402_device.h:454
@ operation_enabled
Definition: cia402_device.h:94
@ ACCEPTED_SET_POINT
Definition: cia402_device.h:458
std::function< void()> quick_stop_reaction_
Definition: cia402_device.h:466
bool fault_alert() const
Tell whether device reports an error.
virtual bool profile_mode() const
@ unknown_state
Definition: cia402_device.h:89
int8_t * mode_read_
Definition: cia402_device.h:465
static constexpr const uint16_t fault_code
Definition: cia402_device.h:71
control_t
Possible control over a CiA402 device state machine.
Definition: cia402_device.h:104
void initialize_state_variables(uint16_t &control_word, uint16_t &status_word, int8_t &mode_set, int8_t &mode_read)
Set the variables used to control the state machine.
~CIA402ObjectDictionary()=default
bool active() const
Tell whether the sensojoint is active (is running or will run commands) or not (is or will be in a sa...
static constexpr const int8_t CST_mode
Cyclic synchronous torque.
Definition: cia402_device.h:82
uint16_t * control_word_
Definition: cia402_device.h:462
@ enable_op
Command to active state transition 4, 16.
Definition: cia402_device.h:111
void set_entering_enable_reaction(std::function< bool()> reaction)
Set the reaction function called when device enters the operation enabled state.
@ fault_reaction_active
Definition: cia402_device.h:96
@ switched_on
Definition: cia402_device.h:93
bool is_configurable() const
Tell whether the sensojoint can be immediately configured.
bool paused_
Definition: cia402_device.h:453
virtual bool position_mode_queried() const
static constexpr const uint16_t get_modes_of_operation_addr
Definition: cia402_device.h:61
A container of static functions and types used to ease implementation of CiA 402 devices.
Definition: cia402_device.h:55
SetPointCtrl setpoint_management_
Definition: cia402_device.h:460
Definition: cia402_device.h:32
static constexpr const int8_t PV_mode
Profile velocity.
Definition: cia402_device.h:76
static constexpr const uint16_t switch_on_disabled_code
Definition: cia402_device.h:65
void pause(bool doit)
State transition is paused/unpaused.
static constexpr const int8_t monitor_mode
Definition: cia402_device.h:74
static constexpr const uint16_t set_modes_of_operation_addr
Definition: cia402_device.h:60
std::string_view operation_state_str() const
get string representation of current state of the device.
@ switch_on_and_enable_op
Command to active state transition 3, 4.
Definition: cia402_device.h:107
virtual bool velocity_mode() const
void set_operation_state(control_t state)
Function used to change the state of device.
void device_state_termination()
Performs operations supposed to put the device in a safe state.
Main header file for CoE utilities.
bool motion_halted() const
Tell whether motion generated by a profile mode is halted.
bool warning_alert() const
Tell whether device reports a warning.
virtual bool cyclic_mode_queried() const
state_t
Possible state of a CiA402 device state machine.
Definition: cia402_device.h:88
virtual bool velocity_mode_queried() const
bool paused() const
Tell whether the device state transition is paused.
bool manage_new_setpoint()
Make the controller manage a new setpoint (e.g. value of target position). Only in profile mode.
static constexpr const uint16_t ready_to_switch_on_code
Definition: cia402_device.h:66
@ switch_on
Command to active state transition 3.
Definition: cia402_device.h:106
static constexpr const uint16_t operation_enabled_code
Definition: cia402_device.h:68
void set_entering_switchon_reaction(std::function< void()> reaction)
Set the reaction function called when device enters the switched on state.
@ quickstop
Command to active state transition 11.
Definition: cia402_device.h:109
std::function< void()> entering_switch_on_reaction_
Definition: cia402_device.h:469
static constexpr const uint16_t controlword_addr
Definition: cia402_device.h:58
void startup()
Make sensojoint controlable and control mode cannot be changed.
uint16_t * status_word_
Definition: cia402_device.h:463
static constexpr const int8_t IP_mode
Profile interpolated.
Definition: cia402_device.h:79
state_t operation_state() const
get current state of the device.
Definition: cia402_device.h:34
bool internal_limit() const
In profile modes tell whether there is an internal limit has been reached.
@ disable_voltage
Command to active state transition 7, 9, 10, 12.
Definition: cia402_device.h:108
@ disable_op
Command to active state transition 5.
Definition: cia402_device.h:110
static constexpr const int8_t PT_mode
Profile torque.
Definition: cia402_device.h:77
@ SET_POINT_SET
Definition: cia402_device.h:457
static const std::map< int8_t, std::string_view > std_control_mode_str
Definition: cia402_device.h:444
void acknowledge_fault()
Acknowledge fault and reset faulty status.
void reset_fault()
Reset fault so that the device can start again.
virtual bool cyclic_mode() const
bool target_reached() const
Tell whether the target given by a profile mode has been reached.
static constexpr const uint16_t switched_on_code
Definition: cia402_device.h:67
@ quick_stop_active
Definition: cia402_device.h:95
@ READY_TO_ACCEPT
Definition: cia402_device.h:456
void managed_set_point()
Ask the device to take into account the new set point given. Only in profile position modes.
virtual bool torque_mode_queried() const
SetPointCtrl
Definition: cia402_device.h:455
static constexpr const uint16_t statusword_addr
Definition: cia402_device.h:59
@ shutdown
Command to active state transition 2, 6, 8.
Definition: cia402_device.h:105
static constexpr const int8_t HOMING_mode
Homing.
Definition: cia402_device.h:78
virtual bool torque_mode() const
void device_state_initialization()
Performs operations supposed to put the device in a safe state.
void halt_motion(bool choice)
Halt motor axle, only in profile mode.
virtual bool profile_mode_queried() const
bool new_setpoint_following() const
Tell whether a new set point is tracked. Only in profile position mode.
static constexpr const int8_t CSP_mode
Cyclic synchronous position.
Definition: cia402_device.h:80
@ switch_on_disabled
Definition: cia402_device.h:91
void set_entering_disabled_reaction(std::function< void()> reaction)
Set the reaction function called when device enters the switched on disabled state.
static std::string_view operation_state_to_str(state_t)
convert the operation state into a human readable information
std::function< void()> entering_switch_on_disabled_reaction_
Definition: cia402_device.h:470
std::function< bool()> entering_enable_reaction_
Definition: cia402_device.h:468
void set_leaving_enable_requires_quick_stop(std::function< bool()> check_quick_stop)
Set the check function called when device leaves the operation enabled state.
bool process_state()
Perform adequate operations depending on state.
This class define an EtherCAT unit device.
Definition: slave_device.h:53
static constexpr const uint16_t fault_reaction_active_code
Definition: cia402_device.h:70
@ faulty
Definition: cia402_device.h:97
void quick_stop()
Launch the quick stop procedure.
represent the CoE dictionnary of a device
Definition: coe_utilities.h:67
@ ready_to_switch_on
Definition: cia402_device.h:92
static constexpr const int8_t CSV_mode
Cyclic synchronous velocity.
Definition: cia402_device.h:81
static const std::map< state_t, std::string_view > device_state_decode_
Definition: cia402_device.h:115