Skip to main content
Version: 1.1.1

ecdev::CiA406EncoderProfile

CiA 406 (encoder) profile. More...

#include <cia406_encoder_profile.hpp>

Inherits from ecdev::IDeviceProfile, ecdev::IEncoderProfile, IDeviceLifecycle

Public Functions

Name
virtual std::int32_tvelocity() const override
Latest velocity value, if the sensor maps one (otherwise 0).
virtual std::uint16_tstatus() const override
Raw status/operating-status word, if mapped (otherwise 0).
virtual voidreadInputs(const ProcessImage & image, bool wkc_valid, bool operational) override
Read input PDO values captured this cycle.
virtual const char *profileName() const override
Stable identifier for diagnostics (e.g.
virtual std::int32_tposition() const override
Latest position value (counts) from the sensor.
virtual std::stringconfigurePreOp(ISlaveServices & svc, ProcessImage & image) override
Perform CoE / SDO configuration while the slave is in PRE_OP (bus not cycling).
virtual IEncoderProfile *asEncoder() override
Query whether this profile exposes position/velocity encoder readings.

Additional inherited members

Public Functions inherited from ecdev::IDeviceProfile

Name
~IDeviceProfile() override =default
virtual voidwriteOutputs(ProcessImage & image, std::uint64_t cycle_count)
Write output PDO values for this cycle.
virtual voidresolveTopology(const ProcessImage & image)
Resolve the static channel/PDO topology from the ENI-derived process image.
virtual voidprimeOutputs(ProcessImage & image)
Prime output PDO bytes to safe values immediately before the bus enters SAFE_OP (outputs start being transmitted).
virtual std::stringprepareSafeOp(ISlaveServices & svc, ProcessImage & image)
Final configuration step before OPERATIONAL: the slave is in SAFE_OP and the PDO IOmap is live but outputs are not yet driven.
virtual voidcaptureExitDiagnostics(ISlaveServices & svc)
End-of-run hook called after the RT thread has joined; safe to perform SDO reads.
virtual IMotionProfile *asMotion()
Query whether this profile drives a motion (servo) axis.
virtual IIoProfile *asIo()
Query whether this profile exposes digital/analog I/O channels.

Public Functions inherited from ecdev::IEncoderProfile

Name
virtual~IEncoderProfile() =default

Detailed Description

class ecdev::CiA406EncoderProfile;

CiA 406 (encoder) profile.

Reads the position value (0x6004) and optional velocity/status into a lock-free snapshot exposed via [IEncoderProfile](/lxmaster/api/classes/IEncoderProfile) (wrapped by the Encoder facade). A read-only device class – another data point that the plugin model is not motion-specific.

Extending it: this class is intentionally NOT final. To add vendor/extra PDO variables (objects the ENI maps beyond the standard CiA406 set), subclass it, override the relevant lifecycle method (typically readInputs, and optionally configurePreOp), and CHAIN to the base (CiA406EncoderProfile::readInputs(...)) before doing your own work. Resolve your extra objects with ProcessImage::resolve(index, sub) and publish them to application threads through your own lock-free state (atomics). Encoder keeps working unchanged because the subclass inherits this profile's [asEncoder()](/lxmaster/api/classes/CiA406EncoderProfile#function-asencoder). The application reaches the subclass via ecfacade::DeviceFacade::deviceProfile().

Public Functions Documentation

function velocity

inline virtual std::int32_t velocity() const override

Latest velocity value, if the sensor maps one (otherwise 0).

Reimplements: ecdev::IEncoderProfile::velocity

function status

inline virtual std::uint16_t status() const override

Raw status/operating-status word, if mapped (otherwise 0).

Reimplements: ecdev::IEncoderProfile::status

function readInputs

virtual void readInputs(
const ProcessImage & image,
bool wkc_valid,
bool operational
) override

Read input PDO values captured this cycle.

Parameters:

  • image Live PDO byte map for this slave's input objects.
  • wkc_valid False when the work counter dropped this cycle — the slave may not have responded and input data may be stale.
  • operational False during the OP-entry cooldown cycles after the master enters OPERATIONAL. Motion commands should be suppressed until this is true.

Reimplements: ecdev::IDeviceProfile::readInputs

Called on the RT cyclic thread every cycle while OPERATIONAL. Profiles should guard state updates on wkc_valid and operational to avoid acting on stale data.

function profileName

inline virtual const char * profileName() const override

Stable identifier for diagnostics (e.g.

Return: A null-terminated string literal naming this profile class. Must be stable for the lifetime of the profile object (a string literal in practice).

Reimplements: ecdev::IDeviceProfile::profileName

"CiA402-drive").

function position

inline virtual std::int32_t position() const override

Latest position value (counts) from the sensor.

Reimplements: ecdev::IEncoderProfile::position

function configurePreOp

virtual std::string configurePreOp(
ISlaveServices & svc,
ProcessImage & image
) override

Perform CoE / SDO configuration while the slave is in PRE_OP (bus not cycling).

Parameters:

  • svc Slave services handle for SDO reads/writes and register access.
  • image Process image for this slave; resolve PDO entry handles here for later cyclic use.

Return: Empty string on success; a non-empty human-readable reason string aborts bring-up.

Reimplements: ecdev::IDeviceProfile::configurePreOp

Resolve process-image handles (PDO objects) for use in the cyclic path. Called on the bring-up thread; never on the RT thread.

function asEncoder

inline virtual IEncoderProfile * asEncoder() override

Query whether this profile exposes position/velocity encoder readings.

Return: A non-null IEncoderProfile* if so (used to back an Encoder facade handle), or null if this profile does not implement the encoder contract.

Reimplements: ecdev::IDeviceProfile::asEncoder


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