- Configuring LinuxCNC
- Advanced Configuration
- EtherCAT
- Separating CiA402 Logic from EtherCAT (lcec): Modular Adapter + Drive Stub Valid
Separating CiA402 Logic from EtherCAT (lcec): Modular Adapter + Drive Stub Valid
- Marcos DC
-
Topic Author
- Offline
- Senior Member
-
Less
More
- Posts: 61
- Thank you received: 34
04 Mar 2026 23:18 - 04 Mar 2026 23:39 #343873
by Marcos DC
Replied by Marcos DC on topic Separating CiA402 Logic from EtherCAT (lcec): Modular Adapter + Drive Stub Valid
Thanks for the feedback. Just to clarify an important point that I may not have emphasized clearly:
All components in the current tests run in the same servo-thread at 1 kHz, with a fixed execution order using addf. For example:
safety → pds_manager → procedure (UT) → controlword composer → driver interface
Because of this, execution is deterministic. In HAL this effectively becomes a sequential call chain within the same realtime cycle.
Also, there is only one writer for the final 6040 controlword, produced by the controlword composer, which avoids the typical “multiple writers” problem that often causes ambiguous state transitions.
In HAL, race conditions are caused by multiple threads or multiple writers, not by the number of components.
Regarding gantry and coupling: I agree that final squaring and coordinated homing logic belongs in the motion/kinematics layer. If a coupler is introduced on the HAL side it would only serve a limited purpose — handling safe decouple/recouple situations when the drive performs internal motion (for example CiA402 homing) to avoid command/feedback jumps. It would not replace motion’s gantry or homing logic.
Interestingly, the recent HOME_ABSOLUTE_ENCODER fix in motion (PR #3774) also highlights a similar concern about maintaining internal consistency when offsets are applied during homing. In that patch the motion code re-normalizes pos_cmd, pos_fb, free_tp.curr_pos, and motor_offset to avoid accumulated offsets during re-homing. Conceptually this looks similar to a recoupling step inside the motion layer to keep controller and physical states aligned.
The goal here is not to duplicate motion functionality, but simply to keep CiA402 semantics independent from the transport layer (LCEC/EtherCAT) while maintaining a deterministic controlword path.
All components in the current tests run in the same servo-thread at 1 kHz, with a fixed execution order using addf. For example:
safety → pds_manager → procedure (UT) → controlword composer → driver interface
Because of this, execution is deterministic. In HAL this effectively becomes a sequential call chain within the same realtime cycle.
Also, there is only one writer for the final 6040 controlword, produced by the controlword composer, which avoids the typical “multiple writers” problem that often causes ambiguous state transitions.
In HAL, race conditions are caused by multiple threads or multiple writers, not by the number of components.
Regarding gantry and coupling: I agree that final squaring and coordinated homing logic belongs in the motion/kinematics layer. If a coupler is introduced on the HAL side it would only serve a limited purpose — handling safe decouple/recouple situations when the drive performs internal motion (for example CiA402 homing) to avoid command/feedback jumps. It would not replace motion’s gantry or homing logic.
Interestingly, the recent HOME_ABSOLUTE_ENCODER fix in motion (PR #3774) also highlights a similar concern about maintaining internal consistency when offsets are applied during homing. In that patch the motion code re-normalizes pos_cmd, pos_fb, free_tp.curr_pos, and motor_offset to avoid accumulated offsets during re-homing. Conceptually this looks similar to a recoupling step inside the motion layer to keep controller and physical states aligned.
The goal here is not to duplicate motion functionality, but simply to keep CiA402 semantics independent from the transport layer (LCEC/EtherCAT) while maintaining a deterministic controlword path.
Last edit: 04 Mar 2026 23:39 by Marcos DC.
Please Log in or Create an account to join the conversation.
- Marcos DC
-
Topic Author
- Offline
- Senior Member
-
Less
More
- Posts: 61
- Thank you received: 34
04 Mar 2026 23:48 #343874
by Marcos DC
Replied by Marcos DC on topic Separating CiA402 Logic from EtherCAT (lcec): Modular Adapter + Drive Stub Valid
Small clarification regarding the README
After reading the feedback I realized that one part of the README may have been ambiguous, especially the section mentioning “Gantry Support” and gantry_manager.comp.
To clarify the intent of the project:
The goal of this repository is not to introduce a new motion or gantry control layer in HAL. Final gantry squaring, coordinated homing and axis relationships are expected to remain in the motion / kinematics layer (e.g. trivkins) as usual.
The purpose of the HAL components in this project is limited to:
separating CiA402 semantics from the transport layer (LCEC / EtherCAT)
providing a deterministic controlword composition path
adding safety gating
optionally handling decouple/recouple situations when a drive performs internal motion (for example CiA402 homing), to avoid command/feedback discontinuities
So any future “coupler” component would only handle safe transition and coupling of drive states, not replace motion-level gantry logic.
I will update the README to make this clearer.
After reading the feedback I realized that one part of the README may have been ambiguous, especially the section mentioning “Gantry Support” and gantry_manager.comp.
To clarify the intent of the project:
The goal of this repository is not to introduce a new motion or gantry control layer in HAL. Final gantry squaring, coordinated homing and axis relationships are expected to remain in the motion / kinematics layer (e.g. trivkins) as usual.
The purpose of the HAL components in this project is limited to:
separating CiA402 semantics from the transport layer (LCEC / EtherCAT)
providing a deterministic controlword composition path
adding safety gating
optionally handling decouple/recouple situations when a drive performs internal motion (for example CiA402 homing), to avoid command/feedback discontinuities
So any future “coupler” component would only handle safe transition and coupling of drive states, not replace motion-level gantry logic.
I will update the README to make this clearer.
Please Log in or Create an account to join the conversation.
- Configuring LinuxCNC
- Advanced Configuration
- EtherCAT
- Separating CiA402 Logic from EtherCAT (lcec): Modular Adapter + Drive Stub Valid
Time to create page: 0.164 seconds