Motion Master 6.0.0-alpha.50
Next-generation motion control software
Loading...
Searching...
No Matches
mm::node::cia402 Namespace Reference

Enumerations

enum  Object : uint16_t {
  kControlword = 0x6040 , kStatusword = 0x6041 , kModeOfOperation = 0x6060 , kModeOfOperationDisplay = 0x6061 ,
  kTargetPosition = 0x607A , kTargetVelocity = 0x60FF , kTargetTorque = 0x6071 , kPositionActualValue = 0x6064 ,
  kVelocityActualValue = 0x606C , kTorqueActualValue = 0x6077
}
 Standard CiA402 object dictionary indices used by the drive profile. More...
 
enum class  OperationMode : int8_t {
  kNoMode = 0 , kProfilePosition = 1 , kProfileVelocity = 3 , kProfileTorque = 4 ,
  kHoming = 6 , kCyclicSyncPosition = 8 , kCyclicSyncVelocity = 9 , kCyclicSyncTorque = 10
}
 CiA402 operation modes (object 0x6060 / 0x6061 values). More...
 
enum class  State : uint8_t {
  kNotReadyToSwitchOn , kSwitchOnDisabled , kReadyToSwitchOn , kSwitchedOn ,
  kOperationEnabled , kQuickStopActive , kFaultReactionActive , kFault
}
 States of the CiA402 device control state machine (decoded from the statusword). More...
 
enum  Command : uint16_t {
  kCmdShutdown = 0x0006 , kCmdSwitchOn = 0x0007 , kCmdEnableOperation = 0x000F , kCmdDisableVoltage = 0x0000 ,
  kCmdQuickStop = 0x0002 , kCmdFaultReset = 0x0080
}
 Canonical controlword command-bit patterns (the value of the bits in kCommandMask). More...
 

Functions

constexpr State decodeState (uint16_t statusword)
 Decodes the CiA402 state machine state from a statusword (0x6041) value.
 
constexpr bool isFaulted (uint16_t statusword)
 Whether the statusword's fault bit (bit 3) is set, gated to the faulted states.
 
constexpr std::string_view toString (State state)
 Human-readable name of a state (for logging / JSON). Never returns nullptr.
 
constexpr std::string_view toString (OperationMode mode)
 Human-readable name of an operation mode (for logging / JSON). Never nullptr.
 

Variables

constexpr uint16_t kCommandMask = 0x008F
 Controlword (0x6040) command-bit mask — the state-machine bits a transition touches.
 

Enumeration Type Documentation

◆ Command

enum mm::node::cia402::Command : uint16_t

Canonical controlword command-bit patterns (the value of the bits in kCommandMask).

Enumerator
kCmdShutdown 

→ ReadyToSwitchOn (enable voltage + no quick stop).

kCmdSwitchOn 

→ SwitchedOn (also "disable operation" from OperationEnabled).

kCmdEnableOperation 

→ OperationEnabled.

kCmdDisableVoltage 

→ SwitchOnDisabled.

kCmdQuickStop 

→ QuickStopActive.

kCmdFaultReset 

Rising edge of bit 7 clears a fault.

◆ Object

enum mm::node::cia402::Object : uint16_t

Standard CiA402 object dictionary indices used by the drive profile.

Subindex is always 0 for these (they are simple objects), so callers pass 0.

Enumerator
kControlword 

UNSIGNED16, RxPDO — commands the state machine.

kStatusword 

UNSIGNED16, TxPDO — reports the state machine.

kModeOfOperation 

INTEGER8, RxPDO — requested operation mode.

kModeOfOperationDisplay 

INTEGER8, TxPDO — active operation mode.

kTargetPosition 

INTEGER32, RxPDO — CSP/PP setpoint.

kTargetVelocity 

INTEGER32, RxPDO — CSV/PV setpoint.

kTargetTorque 

INTEGER16, RxPDO — CST/PT setpoint (per-mille of rated).

kPositionActualValue 

INTEGER32, TxPDO — actual position.

kVelocityActualValue 

INTEGER32, TxPDO — actual velocity.

kTorqueActualValue 

INTEGER16, TxPDO — actual torque.

◆ OperationMode

enum class mm::node::cia402::OperationMode : int8_t
strong

CiA402 operation modes (object 0x6060 / 0x6061 values).

Enumerator
kNoMode 

No mode assigned.

kProfilePosition 

PP — trapezoidal point-to-point positioning.

kProfileVelocity 

PV — profiled velocity.

kProfileTorque 

PT — profiled torque.

kHoming 

HM — reference/homing run.

kCyclicSyncPosition 

CSP — interpolated cyclic position (the common SOMANET mode).

kCyclicSyncVelocity 

CSV — interpolated cyclic velocity.

kCyclicSyncTorque 

CST — interpolated cyclic torque.

◆ State

enum class mm::node::cia402::State : uint8_t
strong

States of the CiA402 device control state machine (decoded from the statusword).

Enumerator
kNotReadyToSwitchOn 

Drive initialising; no clear state yet.

kSwitchOnDisabled 

Powered, holding; the resting state after init.

kReadyToSwitchOn 

Shutdown command accepted.

kSwitchedOn 

Switch-on command accepted; power stage on, no motion.

kOperationEnabled 

Fully enabled; setpoints are followed.

kQuickStopActive 

Quick stop in progress.

kFaultReactionActive 

A fault is being reacted to (e.g. controlled stop).

kFault 

Faulted and stopped; needs a fault reset.

Function Documentation

◆ decodeState()

constexpr State mm::node::cia402::decodeState ( uint16_t  statusword)
constexpr

Decodes the CiA402 state machine state from a statusword (0x6041) value.

Pure function of the statusword's defined bits; uses the ETG.6010 mask/match table. An unrecognised pattern maps to State::kNotReadyToSwitchOn (the "no clear state" bucket).

◆ isFaulted()

constexpr bool mm::node::cia402::isFaulted ( uint16_t  statusword)
constexpr

Whether the statusword's fault bit (bit 3) is set, gated to the faulted states.

◆ toString() [1/2]

constexpr std::string_view mm::node::cia402::toString ( OperationMode  mode)
constexpr

Human-readable name of an operation mode (for logging / JSON). Never nullptr.

◆ toString() [2/2]

constexpr std::string_view mm::node::cia402::toString ( State  state)
constexpr

Human-readable name of a state (for logging / JSON). Never returns nullptr.

Variable Documentation

◆ kCommandMask

constexpr uint16_t mm::node::cia402::kCommandMask = 0x008F
constexpr

Controlword (0x6040) command-bit mask — the state-machine bits a transition touches.

Bits 0 (switch on), 1 (enable voltage), 2 (quick stop), 3 (enable operation), 7 (fault reset). All other bits — mode-specific 4..6, halt 8, and manufacturer 9.. — are preserved across a transition by a read-modify-write masked with this value.