|
Motion Master 6.0.0-alpha.86
Next-generation motion control software
|
Namespaces | |
| namespace | objects |
Classes | |
| struct | FsaTransition |
| The next step of a walk toward a target state. More... | |
| struct | 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... | |
Functions | |
| constexpr std::optional< OperationMode > | 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 | 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. | |
| constexpr bool | 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< State > | parseState (std::string_view token) |
Parses a state name as toString spells it. std::nullopt for anything else. | |
| constexpr bool | isCommandableState (State state) |
Whether a master can ask a drive to reach state. | |
| constexpr FsaTransition | 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 | kCommandMask = 0x008F |
| Controlword (0x6040) command-bit mask — the state-machine bits a transition touches. | |
| constexpr StandardOperationMode | kStandardOperationModes [] |
| Every standard operation mode, with its 0x6502 bit — ETG.6010 §6.8.1, Figure 15. | |
| constexpr int | kFirstManufacturerDriveModeBit = 16 |
| The first bit of 0x6502 that the profile leaves to the vendor (ETG.6010 Figure 15). | |
| enum mm::node::cia402::Command : uint16_t |
Canonical controlword command-bit patterns (the value of the bits in kCommandMask).
|
strong |
What a master should do next, having observed one state and wanting another.
| Enumerator | |
|---|---|
| kArrived | Already there; nothing to issue. |
| kCommand | Issue |
| kWait | The drive is mid-transition on its own; issue nothing and look again. |
| kUnreachable | No path exists — only when the target is not a |
| enum mm::node::cia402::Object : uint16_t |
Standard CiA402 object dictionary indices used by the drive profile, ordered by index.
Simple VAR objects are addressed at subindex 0; the two-element ARRAY objects (0x607B, 0x607D, 0x6091, 0x6092, 0x6099, 0x60FE) at sub-entries 1..2.
|
strong |
CiA402 operation modes (object 0x6060 / 0x6061 values).
Every mode the profile defines, whether or not this codebase can drive one: the set is what a device's 0x6502 capability field is read against, so a mode missing here would be a supported mode nothing could name. Mode 5 is absent because the profile reserves it — there is no mode 5. Vendors define their own modes in the negative half, which is a manufacturer vocabulary and therefore lives with the vendor (somanet::OperationMode), not here.
|
strong |
States of the CiA402 device control state machine (decoded from the 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).
|
constexpr |
Whether a master can ask a drive to reach state.
Three of the eight cannot be asked for, and each for its own reason: kNotReadyToSwitchOn and kFaultReactionActive are passed through automatically by the drive and have no command that enters them, and kFault is entered by something going wrong rather than by being requested.
|
constexpr |
Whether the statusword's fault bit (bit 3) is set, gated to the faulted states.
|
constexpr |
One step of the walk from from toward target — the CiA402 state machine as a next-hop table.
A table rather than a search, because the graph is eight states and fits on a page, and because the interesting part is not the pathfinding but the handful of states that behave unlike the rest. Iterating it is what produces a multi-hop walk: each call answers only "what now", so a caller re-reads the drive between steps and never assumes a command took effect.
The graph is ETG.6010 §5.1 Figure 2, checked against the SOMANET firmware's own get_next_state. Four rows are worth knowing:
kFault — every target begins with a fault reset, which reaches kSwitchOnDisabled (transition 15) and only if the cause is gone; the firmware refuses while the error is still reported, so a caller must not read a reset as progress.kFaultReactionActive and kNotReadyToSwitchOn — no command enters or leaves them; the drive moves on by itself (transitions 14 and 1), so the answer is to wait.kQuickStopActive — leaving downward is kCmdDisableVoltage (transition 12), and leaving upward to kOperationEnabled is transition 16, which IEC 61800-7-201 calls not recommended and this firmware implements as "forced". It is offered only when allowQuickStopOverride, so that overriding a deliberate stop is a decision a caller makes rather than a side effect of asking to be enabled.kReadyToSwitchOn → kSwitchedOn** uses kCmdSwitchOn rather than the combined kCmdEnableOperation that ETG.6010 permits: the firmware answers both by moving one state, so the plain command reaches the same place while leaving the intermediate state observable.| from | The state just read from the drive. |
| target | Where the caller wants it. See isCommandableState. |
| allowQuickStopOverride | Whether transition 16 may be used. |
|
constexpr |
Parses a state name as toString spells it. std::nullopt for anything else.
|
constexpr |
Whether a quick stop configured with optionCode leaves the drive in Quick Stop Active, or passes through it into Switch On Disabled.
The distinction is why targeting Quick Stop Active is not simply "issue quick stop and wait". The profile's codes 0-4 all end the quick stop in Switch On Disabled — 0 disables the drive outright and 1-4 ramp down first — so on a drive configured that way Quick Stop Active is a state it passes through, sometimes for microseconds. Codes 5-8 ramp down the same ways but stay there. Only that 5-8 band holds, which is what this answers.
A vendor may define values above 8, and one that does need not hold. SOMANET implements a sparse subset — 0, 2, 6 and 9 — of which 9 is its own: "transit into active short circuit and then into switch on disabled", so it passes through like 0 and 2 while shorting the motor phases on the way. It is outside the holding band and therefore already answered correctly, but the reason is that the band is closed, not that unknown values default to passing through.
Values this function cannot place are treated as passing through for a separate reason: a caller told the drive landed somewhere else recovers, where one waiting for a state that never comes only times out.
|
constexpr |
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.
std::nullopt if value is not a recognised operation mode.
|
constexpr |
Human-readable name of an operation mode (for logging / JSON). Never nullptr.
|
constexpr |
Human-readable name of a state (for logging / JSON). Never returns nullptr.
|
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.
|
inlineconstexpr |
The first bit of 0x6502 that the profile leaves to the vendor (ETG.6010 Figure 15).
|
inlineconstexpr |
Every standard operation mode, with its 0x6502 bit — ETG.6010 §6.8.1, Figure 15.
The bit is listed rather than computed, though bit = value - 1 holds for all ten of them. The arithmetic is a coincidence of how the profile happened to allocate the field, not a rule it states, and a future mode that broke it would break silently. Reserved positions (bit 4, and 11-15) are simply absent, as is the manufacturer half (bits 16-31), which no standard table can name.