Skip to main content
Version: 1.0.13

ecfacade::Axis

High-level motion handle a PLC/application programmer uses, analogous to a TwinCAT "NC axis". More...

#include <axis.hpp>

Inherits from DeviceFacade

Public Functions

Name
std::uint16_tstatusword() const
voidsetDriveMode(ecdev::DriveOpMode mode)
Select the cyclic operating mode (CSP / CSV / CST) this axis runs; the CiA402 profile writes 0x6060 to match.
voidresetFault()
Clear a latched drive fault (one-shot).
voidmoveTo(std::int32_t counts)
Command an absolute target position in encoder counts (CSP).
voidmoveAtVelocity(std::int32_t counts_per_sec)
Command a target velocity in encoder counts/s (CSV).
ecdev::IMotionProfile *motionProfile() const
Escape hatch for advanced callers that need the underlying motion contract.
std::int32_tmodeDisplay() const
Drive-reported modes-of-operation display (0x6061; 8=CSP, 9=CSV, 10=CST); 0 if unmapped.
boolisFaulted() const
boolisEnabled() const
voidenable()
Request the drive to power up and hold position.
voiddisable()
Request the drive to power down to a de-energised resting state.
std::int32_tcommandedPosition() const
voidapplyTorque(std::int32_t per_mille_rated)
Command a target torque in per-mille of rated torque (CST).
std::int32_tactualVelocity() const
std::int32_tactualTorque() const
Drive-reported actual torque (0x6077, per-mille of rated); 0 if the profile doesn't map it.
std::int32_tactualPosition() const
Axis(ecdev::IMotionProfile * motion, std::string name, ecdev::IEthercatDevice * device)

Detailed Description

class ecfacade::Axis;

High-level motion handle a PLC/application programmer uses, analogous to a TwinCAT "NC axis".

An [Axis](/lxmaster/api/classes/Axis) is a thin, safe wrapper over an [ecdev::IMotionProfile](/lxmaster/api/classes/IMotionProfile). The application never sees CiA402 controlwords, PDO offsets, the ENI, or the backend: it commands positions and reads back status in engineering-relevant terms. The same [Axis](/lxmaster/api/classes/Axis) works for any drive family whose profile implements IMotionProfile, so swapping a CiA402 servo for a different drive class does not change application code.

All methods are safe to call from the application thread while the RT cycle runs (the backing profile uses lock-free state). Exception: [setDriveMode()](/lxmaster/api/classes/Axis#function-setdrivemode) and the inherited configure() must only be called between EcNetwork::prepare() and EcNetwork::start().

Public Functions Documentation

function statusword

std::uint16_t statusword() const

function setDriveMode

void setDriveMode(
ecdev::DriveOpMode mode
)

Select the cyclic operating mode (CSP / CSV / CST) this axis runs; the CiA402 profile writes 0x6060 to match.

Call before start() to choose the initial mode, or while running to switch live – a live switch takes effect only when the ENI maps 0x6060 into the RxPDO (eni_gen does this for CiA402 drives). RT-safe.

function resetFault

void resetFault()

Clear a latched drive fault (one-shot).

function moveTo

void moveTo(
std::int32_t counts
)

Command an absolute target position in encoder counts (CSP).

function moveAtVelocity

void moveAtVelocity(
std::int32_t counts_per_sec
)

Command a target velocity in encoder counts/s (CSV).

function motionProfile

ecdev::IMotionProfile * motionProfile() const

Escape hatch for advanced callers that need the underlying motion contract.

function modeDisplay

std::int32_t modeDisplay() const

Drive-reported modes-of-operation display (0x6061; 8=CSP, 9=CSV, 10=CST); 0 if unmapped.

function isFaulted

bool isFaulted() const

function isEnabled

bool isEnabled() const

function enable

void enable()

Request the drive to power up and hold position.

function disable

void disable()

Request the drive to power down to a de-energised resting state.

function commandedPosition

std::int32_t commandedPosition() const

function applyTorque

void applyTorque(
std::int32_t per_mille_rated
)

Command a target torque in per-mille of rated torque (CST).

function actualVelocity

std::int32_t actualVelocity() const

function actualTorque

std::int32_t actualTorque() const

Drive-reported actual torque (0x6077, per-mille of rated); 0 if the profile doesn't map it.

function actualPosition

std::int32_t actualPosition() const

function Axis

Axis(
ecdev::IMotionProfile * motion,
std::string name,
ecdev::IEthercatDevice * device
)

Updated on 2026-07-04 at 22:59:44 +0000