Motion Master 6.0.0-alpha.86
Next-generation motion control software
Loading...
Searching...
No Matches
cia402.h File Reference

Pure CiA402 (CANopen drive profile, ETG.6010) vocabulary — object indices, control/status word bit layout, the device state machine, and operation modes. More...

#include <cstdint>
#include <optional>
#include <string_view>
Include dependency graph for cia402.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  mm::node::cia402::StandardOperationMode
 One row of the standard operation-mode table — a mode, the 0x6502 bit that advertises it, and the two names the profile gives it. More...
 
struct  mm::node::cia402::FsaTransition
 The next step of a walk toward a target state. More...
 

Namespaces

namespace  mm
 
namespace  mm::node
 
namespace  mm::node::cia402
 

Enumerations

enum  mm::node::cia402::Object : uint16_t {
  mm::node::cia402::kErrorCode = 0x603F , mm::node::cia402::kControlword = 0x6040 , mm::node::cia402::kStatusword = 0x6041 , mm::node::cia402::kQuickStopOptionCode = 0x605A ,
  mm::node::cia402::kModeOfOperation = 0x6060 , mm::node::cia402::kModeOfOperationDisplay = 0x6061 , mm::node::cia402::kPositionDemandValue = 0x6062 , mm::node::cia402::kPositionActualValue = 0x6064 ,
  mm::node::cia402::kFollowingErrorWindow = 0x6065 , mm::node::cia402::kFollowingErrorTimeout = 0x6066 , mm::node::cia402::kPositionWindow = 0x6067 , mm::node::cia402::kPositionWindowTime = 0x6068 ,
  mm::node::cia402::kVelocityDemandValue = 0x606B , mm::node::cia402::kVelocityActualValue = 0x606C , mm::node::cia402::kVelocityWindow = 0x606D , mm::node::cia402::kVelocityWindowTime = 0x606E ,
  mm::node::cia402::kVelocityThreshold = 0x606F , mm::node::cia402::kVelocityThresholdTime = 0x6070 , mm::node::cia402::kTargetTorque = 0x6071 , mm::node::cia402::kMaxTorque = 0x6072 ,
  mm::node::cia402::kMaxCurrent = 0x6073 , mm::node::cia402::kTorqueDemand = 0x6074 , mm::node::cia402::kMotorRatedCurrent = 0x6075 , mm::node::cia402::kMotorRatedTorque = 0x6076 ,
  mm::node::cia402::kTorqueActualValue = 0x6077 , mm::node::cia402::kDcLinkCircuitVoltage = 0x6079 , mm::node::cia402::kTargetPosition = 0x607A , mm::node::cia402::kPositionRangeLimit = 0x607B ,
  mm::node::cia402::kHomeOffset = 0x607C , mm::node::cia402::kSoftwarePositionLimit = 0x607D , mm::node::cia402::kPolarity = 0x607E , mm::node::cia402::kMaxMotorSpeed = 0x6080 ,
  mm::node::cia402::kProfileVelocity = 0x6081 , mm::node::cia402::kProfileAcceleration = 0x6083 , mm::node::cia402::kProfileDeceleration = 0x6084 , mm::node::cia402::kQuickStopDeceleration = 0x6085 ,
  mm::node::cia402::kMotionProfileType = 0x6086 , mm::node::cia402::kTorqueSlope = 0x6087 , mm::node::cia402::kTorqueProfileType = 0x6088 , mm::node::cia402::kGearRatio = 0x6091 ,
  mm::node::cia402::kFeedConstant = 0x6092 , mm::node::cia402::kHomingMethod = 0x6098 , mm::node::cia402::kHomingSpeeds = 0x6099 , mm::node::cia402::kHomingAcceleration = 0x609A ,
  mm::node::cia402::kSiUnitVelocity = 0x60A9 , mm::node::cia402::kVelocityOffset = 0x60B1 , mm::node::cia402::kTorqueOffset = 0x60B2 , mm::node::cia402::kTouchProbeFunction = 0x60B8 ,
  mm::node::cia402::kTouchProbeStatus = 0x60B9 , mm::node::cia402::kTouchProbe1PositiveEdge = 0x60BA , mm::node::cia402::kTouchProbe1NegativeEdge = 0x60BB , mm::node::cia402::kTouchProbeTimeStamp1PositiveValue = 0x60D1 ,
  mm::node::cia402::kTouchProbeTimeStamp1NegativeValue = 0x60D2 , mm::node::cia402::kPositioningOptionCode = 0x60F2 , mm::node::cia402::kFollowingErrorActualValue = 0x60F4 , mm::node::cia402::kControlEffort = 0x60FA ,
  mm::node::cia402::kPositionDemandInternalValue = 0x60FC , mm::node::cia402::kDigitalInputs = 0x60FD , mm::node::cia402::kDigitalOutputs = 0x60FE , mm::node::cia402::kTargetVelocity = 0x60FF ,
  mm::node::cia402::kSupportedDriveModes = 0x6502
}
 Standard CiA402 object dictionary indices used by the drive profile, ordered by index. More...
 
enum class  mm::node::cia402::OperationMode : int8_t {
  mm::node::cia402::kNoMode = 0 , mm::node::cia402::kProfilePosition = 1 , mm::node::cia402::kVelocity = 2 , mm::node::cia402::kProfileVelocity = 3 ,
  mm::node::cia402::kProfileTorque = 4 , mm::node::cia402::kHoming = 6 , mm::node::cia402::kInterpolatedPosition = 7 , mm::node::cia402::kCyclicSyncPosition = 8 ,
  mm::node::cia402::kCyclicSyncVelocity = 9 , mm::node::cia402::kCyclicSyncTorque = 10 , mm::node::cia402::kCyclicSyncTorqueCommutationAngle = 11
}
 CiA402 operation modes (object 0x6060 / 0x6061 values). More...
 
enum class  mm::node::cia402::State : uint8_t {
  mm::node::cia402::kNotReadyToSwitchOn , mm::node::cia402::kSwitchOnDisabled , mm::node::cia402::kReadyToSwitchOn , mm::node::cia402::kSwitchedOn ,
  mm::node::cia402::kOperationEnabled , mm::node::cia402::kQuickStopActive , mm::node::cia402::kFaultReactionActive , mm::node::cia402::kFault
}
 States of the CiA402 device control state machine (decoded from the statusword). More...
 
enum  mm::node::cia402::Command : uint16_t {
  mm::node::cia402::kCmdShutdown = 0x0006 , mm::node::cia402::kCmdSwitchOn = 0x0007 , mm::node::cia402::kCmdEnableOperation = 0x000F , mm::node::cia402::kCmdDisableVoltage = 0x0000 ,
  mm::node::cia402::kCmdQuickStop = 0x0002 , mm::node::cia402::kCmdFaultReset = 0x0080
}
 Canonical controlword command-bit patterns (the value of the bits in kCommandMask). More...
 
enum class  mm::node::cia402::FsaAction : uint8_t { mm::node::cia402::kArrived , mm::node::cia402::kCommand , mm::node::cia402::kWait , mm::node::cia402::kUnreachable }
 What a master should do next, having observed one state and wanting another. More...
 

Functions

constexpr std::optional< OperationModemm::node::cia402::toOperationMode (int value)
 Maps a raw mode value (as written to 0x6060 / read from 0x6061) to a known operation mode. Rejects values outside the standard set so an API boundary can 400 an unknown mode.
 
constexpr State mm::node::cia402::decodeState (uint16_t statusword)
 Decodes the CiA402 state machine state from a statusword (0x6041) value.
 
constexpr bool mm::node::cia402::isFaulted (uint16_t statusword)
 Whether the statusword's fault bit (bit 3) is set, gated to the faulted states.
 
constexpr std::string_view mm::node::cia402::toString (State state)
 Human-readable name of a state (for logging / JSON). Never returns nullptr.
 
constexpr std::string_view mm::node::cia402::toString (OperationMode mode)
 Human-readable name of an operation mode (for logging / JSON). Never nullptr.
 
constexpr bool mm::node::cia402::quickStopHolds (int16_t optionCode)
 Whether a quick stop configured with optionCode leaves the drive in Quick Stop Active, or passes through it into Switch On Disabled.
 
constexpr std::optional< Statemm::node::cia402::parseState (std::string_view token)
 Parses a state name as toString spells it. std::nullopt for anything else.
 
constexpr bool mm::node::cia402::isCommandableState (State state)
 Whether a master can ask a drive to reach state.
 
constexpr FsaTransition mm::node::cia402::nextFsaTransition (State from, State target, bool allowQuickStopOverride)
 One step of the walk from from toward target — the CiA402 state machine as a next-hop table.
 

Variables

constexpr uint16_t mm::node::cia402::kCommandMask = 0x008F
 Controlword (0x6040) command-bit mask — the state-machine bits a transition touches.
 
constexpr StandardOperationMode mm::node::cia402::kStandardOperationModes []
 Every standard operation mode, with its 0x6502 bit — ETG.6010 §6.8.1, Figure 15.
 
constexpr int mm::node::cia402::kFirstManufacturerDriveModeBit = 16
 The first bit of 0x6502 that the profile leaves to the vendor (ETG.6010 Figure 15).
 

Detailed Description

Pure CiA402 (CANopen drive profile, ETG.6010) vocabulary — object indices, control/status word bit layout, the device state machine, and operation modes.

This header is deliberately free of any dependency on Device: it is the protocol definition, decoupled from the transport, so the bit-twiddling can be unit-tested in isolation and reused by both Cia402Drive (the borrowed view) and any cyclic task that composes a controlword by hand. The behaviour that actually touches the bus lives in cia402_drive.h.