Skip to main content
Version: 1.1.1

ecdev::IMotionProfile

Facade-facing contract for a motion (drive) device. More...

#include <motion_profile.hpp>

Inherited by ecdev::CiA402DriveProfile

Public Functions

Name
virtual~IMotionProfile() =default
virtual std::int32_ttargetPosition() const =0
Last target position commanded to the drive (encoder counts).
virtual std::uint16_tstatusword() const =0
Raw DS402 statusword (CiA402 0x6041).
virtual voidsetTargetVelocity(std::int32_t counts_per_sec) =0
Command a CSV target velocity.
virtual voidsetTargetTorque(std::int32_t per_mille_rated) =0
Command a CST target torque.
virtual voidsetTargetPosition(std::int32_t counts) =0
Command a CSP target position.
virtual voidsetOperatingMode(DriveOpMode mode)
Select the cyclic operating mode (CSP / CSV / CST).
virtual voidsetAutoFaultRecover(bool enable)
Set the CiA402 auto fault-reset/recover behaviour.
virtual voidrequestFaultReset() =0
One-shot fault-reset edge (acted on only while the drive reports Fault).
virtual voidrequestEnable() =0
Request the drive walk to Operation Enabled (cancels a prior disable request).
virtual voidrequestDisable() =0
Request the drive walk back to a de-energised resting state.
virtual std::int32_tmodeDisplay() const
Drive's modes-of-operation display (CiA402 0x6061; 8=CSP, 9=CSV, 10=CST).
virtual boolisOperationEnabled() const =0
True when the DS402 state machine is in the Operation Enabled state.
virtual boolisFault() const =0
True when the drive reports a latched fault (DS402 Fault state, statusword bit 3).
virtual std::int32_tactualVelocity() const =0
Actual velocity reported by the drive (encoder counts/s, CiA402 0x606C).
virtual std::int32_tactualTorque() const
Drive's reported actual torque (CiA402 0x6077, per-mille of rated).
virtual std::int32_tactualPosition() const =0
Actual position reported by the drive (encoder counts, CiA402 0x6064).

Detailed Description

class ecdev::IMotionProfile;

Facade-facing contract for a motion (drive) device.

This is the ONLY surface the Axis facade depends on – it knows nothing about CiA402 controlwords, the backend, or the ENI. Any drive profile (CiA402 today, others later) implements it so the same Axis works across drive families.

All methods are safe to call from an application thread concurrently with the RT cycle: the implementation backs them with lock-free state.

Pre-start configuration (call between prepare() and start()): setOperatingMode() / setAutoFaultRecover() are not thread-safe with the RT cycle; call them only after prepare() and before start(). Default no-ops make non-CiA402 profiles unaffected.

Public Functions Documentation

function ~IMotionProfile

virtual ~IMotionProfile() =default

function targetPosition

virtual std::int32_t targetPosition() const =0

Last target position commanded to the drive (encoder counts).

Reimplemented by: ecdev::CiA402DriveProfile::targetPosition

RT-safe.

function statusword

virtual std::uint16_t statusword() const =0

Raw DS402 statusword (CiA402 0x6041).

Reimplemented by: ecdev::CiA402DriveProfile::statusword

RT-safe.

function setTargetVelocity

virtual void setTargetVelocity(
std::int32_t counts_per_sec
) =0

Command a CSV target velocity.

Parameters:

  • counts_per_sec Target velocity in encoder counts per second (CiA402 0x60FF).

Reimplemented by: ecdev::CiA402DriveProfile::setTargetVelocity

Only honoured by a profile running in CSV mode.

function setTargetTorque

virtual void setTargetTorque(
std::int32_t per_mille_rated
) =0

Command a CST target torque.

Parameters:

  • per_mille_rated Target torque in per-mille of rated torque (CiA402 0x6071).

Reimplemented by: ecdev::CiA402DriveProfile::setTargetTorque

Only honoured by a profile running in CST mode.

function setTargetPosition

virtual void setTargetPosition(
std::int32_t counts
) =0

Command a CSP target position.

Parameters:

  • counts Target position in encoder counts (CiA402 0x607A).

Reimplemented by: ecdev::CiA402DriveProfile::setTargetPosition

Implicitly leaves "hold actual" mode.

function setOperatingMode

inline virtual void setOperatingMode(
DriveOpMode mode
)

Select the cyclic operating mode (CSP / CSV / CST).

Parameters:

  • mode The desired cyclic operating mode.

Reimplemented by: ecdev::CiA402DriveProfile::setOperatingMode

Call before start() to choose the initial mode, or while running to switch live. A live switch takes effect only when the ENI maps modes-of-operation (0x6060) into the RxPDO (eni_gen does this for CiA402 drives); otherwise the drive runs the mode set via SDO at PRE_OP and a later call has no cyclic effect. RT-safe. Default no-op so non-CiA402 profiles are unaffected.

function setAutoFaultRecover

inline virtual void setAutoFaultRecover(
bool enable
)

Set the CiA402 auto fault-reset/recover behaviour.

Parameters:

  • enable true to automatically reset and re-enable after a mid-run fault; false (default) to treat faults as terminal stops.

Reimplemented by: ecdev::CiA402DriveProfile::setAutoFaultRecover

Call between prepare() and start(); not RT-safe.

function requestFaultReset

virtual void requestFaultReset() =0

One-shot fault-reset edge (acted on only while the drive reports Fault).

Reimplemented by: ecdev::CiA402DriveProfile::requestFaultReset

function requestEnable

virtual void requestEnable() =0

Request the drive walk to Operation Enabled (cancels a prior disable request).

Reimplemented by: ecdev::CiA402DriveProfile::requestEnable

function requestDisable

virtual void requestDisable() =0

Request the drive walk back to a de-energised resting state.

Reimplemented by: ecdev::CiA402DriveProfile::requestDisable

function modeDisplay

inline virtual std::int32_t modeDisplay() const

Drive's modes-of-operation display (CiA402 0x6061; 8=CSP, 9=CSV, 10=CST).

Reimplemented by: ecdev::CiA402DriveProfile::modeDisplay

0 if unmapped.

function isOperationEnabled

virtual bool isOperationEnabled() const =0

True when the DS402 state machine is in the Operation Enabled state.

Reimplemented by: ecdev::CiA402DriveProfile::isOperationEnabled

RT-safe.

function isFault

virtual bool isFault() const =0

True when the drive reports a latched fault (DS402 Fault state, statusword bit 3).

Reimplemented by: ecdev::CiA402DriveProfile::isFault

RT-safe.

function actualVelocity

virtual std::int32_t actualVelocity() const =0

Actual velocity reported by the drive (encoder counts/s, CiA402 0x606C).

Reimplemented by: ecdev::CiA402DriveProfile::actualVelocity

Returns 0 if the drive does not map this object. RT-safe.

function actualTorque

inline virtual std::int32_t actualTorque() const

Drive's reported actual torque (CiA402 0x6077, per-mille of rated).

Reimplemented by: ecdev::CiA402DriveProfile::actualTorque

0 if the profile does not map it. Diagnostic only.

function actualPosition

virtual std::int32_t actualPosition() const =0

Actual position reported by the drive (encoder counts, CiA402 0x6064).

Reimplemented by: ecdev::CiA402DriveProfile::actualPosition

RT-safe.


Updated on 2026-07-13 at 20:44:41 +0000