Read a drive value before the bus is running, plus master/slave robustness - #233
Draft
JenniferBuehler wants to merge 16 commits into
Draft
Read a drive value before the bus is running, plus master/slave robustness#233JenniferBuehler wants to merge 16 commits into
JenniferBuehler wants to merge 16 commits into
Conversation
Call ecrt_release_master() in ~EcMaster() to properly release the kernel EtherCAT master device. Without this, the master remains locked after the process exits, preventing re-initialization on restart without unloading the kernel module. This is especially critical in multi-master setups where multiple EcMaster instances coexist.
…parsed by ros2_control
…splitting bus startup into a "configure-but-don't-run-yet" step and exposing an SDO read that's safe to call in that window.
Draft
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds the ability to read from a drive over SDO before the EtherCAT bus goes operational. This happens by splitting bus startup into a "configure but don't run yet" phase and a separate "activate" phase. Also adds robustness to master creation and slave registration.
Main feature: read-before-startup
configureBus()brings the bus to the configured/PRE-OP state (where blocking SDO access is valid) without going operational.activateBus()still takes it to OP and now auto-callsconfigureBus()first if needed.readSlaveSdo(): a blocking SDO read that is safe to call in the configured-but-not-active window (see last point).configureBusLocked()andactivateBusLocked()helpers to avoid recursive mutex locking.Other refinements
EcMasterreleases the master in its destructor (ecrt_release_master), so the master can be re-requested cleanly after teardown.EcMaster::isValid()as new function, and an explicit error if the master isn't created properly.addSlave()now returns success/failure and errors clearly when a slave can't be added.virtual targetPositionPassthrough()so that subclasses can override whether target-position passthrough happens (used by vendor drives that need target position passed through in non-CSP modes).