YARP CiA-402 EtherCAT Device 0.6.0
YARP device plugin for EtherCAT CiA-402 drives
Loading...
Searching...
No Matches
CiA402::StateMachine Class Reference

#include <CiA402StateMachine.h>

Classes

struct  Command
 Command structure. More...
 
struct  Impl
 

Public Member Functions

 StateMachine ()
 Constructor.
 
 ~StateMachine ()
 Destructor.
 
void reset ()
 Resets the internal state machine.
 
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.
 
int8_t getActiveOpMode () const noexcept
 
Command faultReset () noexcept
 Generates a fault reset command.
 

Static Public Member Functions

static bool isOpEnabled (uint16_t sw)
 
static bool isFault (uint16_t sw)
 
static bool isFaultReactionActive (uint16_t sw)
 
static bool isQuickStopActive (uint16_t sw)
 
static bool isOperationEnabled (uint16_t sw)
 
static bool isSwitchedOn (uint16_t sw)
 

Detailed Description

Definition at line 104 of file CiA402StateMachine.h.

Constructor & Destructor Documentation

◆ StateMachine()

CiA402::StateMachine::StateMachine ( )

Constructor.

Initializes the CiA-402 state machine for a single EtherCAT drive.

Definition at line 22 of file CiA402StateMachine.cpp.

◆ ~StateMachine()

CiA402::StateMachine::~StateMachine ( )
default

Destructor.

Cleans up the resources used by the state machine.

Member Function Documentation

◆ faultReset()

CiA402::StateMachine::Command CiA402::StateMachine::faultReset ( )
noexcept

Generates a fault reset command.

This function generates a command to reset the fault state of the drive.

Returns
Command structure containing the control word and operation mode for fault reset.

Immediate Fault reset (equivalent to requesting VOCAB_CM_FORCE_IDLE).

Definition at line 133 of file CiA402StateMachine.cpp.

◆ getActiveOpMode()

int8_t CiA402::StateMachine::getActiveOpMode ( ) const
noexcept

Definition at line 35 of file CiA402StateMachine.cpp.

◆ isFault()

static bool CiA402::StateMachine::isFault ( uint16_t sw)
inlinestatic

Check if the drive is in a fault state.

Parameters
swStatus word.
Returns
true if the drive is in a fault state, false otherwise.

Definition at line 181 of file CiA402StateMachine.h.

◆ isFaultReactionActive()

static bool CiA402::StateMachine::isFaultReactionActive ( uint16_t sw)
inlinestatic

Check if the fault reaction is active.

Parameters
swStatus word.
Returns
true if the fault reaction is active, false otherwise.

Definition at line 191 of file CiA402StateMachine.h.

◆ isOpEnabled()

static bool CiA402::StateMachine::isOpEnabled ( uint16_t sw)
inlinestatic

Check if the operation is enabled.

Parameters
swStatus word.
Returns
true if the operation is enabled, false otherwise.

Definition at line 171 of file CiA402StateMachine.h.

◆ isOperationEnabled()

static bool CiA402::StateMachine::isOperationEnabled ( uint16_t sw)
inlinestatic

Check if the drive is switched on.

Parameters
swStatus word.
Returns
true if the drive is switched on, false otherwise.

Definition at line 211 of file CiA402StateMachine.h.

◆ isQuickStopActive()

static bool CiA402::StateMachine::isQuickStopActive ( uint16_t sw)
inlinestatic

Check if the drive is not ready to switch on.

Parameters
swStatus word.
Returns
true if the drive is not ready to switch on, false otherwise.

Definition at line 201 of file CiA402StateMachine.h.

◆ isSwitchedOn()

static bool CiA402::StateMachine::isSwitchedOn ( uint16_t sw)
inlinestatic

Check if the drive is switched on.

Parameters
swStatus word.
Returns
true if the drive is switched on, false otherwise.

Definition at line 221 of file CiA402StateMachine.h.

◆ reset()

void CiA402::StateMachine::reset ( )

Resets the internal state machine.

Call this after power-on or after a drive fault to reinitialize the state machine.

Definition at line 29 of file CiA402StateMachine.cpp.

◆ update()

CiA402::StateMachine::Command CiA402::StateMachine::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.

This function should be called cyclically. It determines the correct control word and (optionally) the operation mode to send, based on the current statusword and opModeDisplay.

Parameters
statuswordValue read from TxPDO.Statusword.
opModeDisplayValue read from TxPDO.OpModeDisplay (object 0x6061).
opReqRequested operation mode (object 0x6060).
hwInhibitHardware inhibit state (true if inhibited, false otherwise).
Returns
Command structure containing the control word, operation mode, and a flag indicating if the opMode should be written.

Definition at line 40 of file CiA402StateMachine.cpp.


The documentation for this class was generated from the following files: