Master Abstraction hardening + fix missing deps - #239
Merged
Conversation
…e identity check to the master abstraction The master abstraction (EcMasterBase/EtherlabMaster) dropped several capabilities EcMaster had before the split: a blocking CoE SDO upload (read), public getters for master/domain/slave state, an is_valid() guard, and add_slave()'s vendor/product identity verification against what's actually on the bus. All are restored here at the EcMasterBase interface (as backend-agnostic types with no ecrt.h/IgH dependency) and implemented in EtherlabMaster: - EcMasterBase gains is_valid(), upload_slave_sdo(), get_master_state()/get_domain_state()/get_slave_states(), backed by new portable EcMasterStateInfo/EcDomainStateInfo/EcSlaveStateInfo structs (no ecrt_master_state_t/ec_domain_state_t leakage, so a future non-IgH master plugin isn't tied to these types). - EtherlabMaster::upload_slave_sdo() refuses (logs an error, returns -1) if called while activated_ — this is a blocking mailbox round-trip and must only run during the configure phase (after configure_slaves(), before start()), never while the cyclic process-data loop is running. - EtherlabMaster::add_slave() again refuses to configure a slave whose vendor/product doesn't match what's actually on the bus at that ring position (alias-0 slaves only, addressed by absolute position), instead of silently leaving it unconfigured. - EthercatBusManager's masterState()/domainState()/slaveStates()/ readSlaveSdo() are wired to the new methods; their declared return types (ec_master_state_t/ec_domain_state_t, with no <ecrt.h> in reach from this header) would not have compiled otherwise. Also fixes a pre-existing bug (bus_config_.master_id doesn't exist; the field is master_iface) and drops a dead, already-commented-out SDO config block superseded by EtherlabMaster::configure_slaves().
…hex status logging - Adopts the process_data(int index, ...) rename cleanly (removes the two commented-out old-signature leftovers from the rebase). - Restores targetPositionPassthrough(): extracts the hardcoded "override 0x607a unless CSP" check into an overridable virtual, so a vendor subclass can extend which modes pass the target position through (e.g. an impedance mode that also uses 0x607a as an equilibrium setpoint) without duplicating process_data(). - Logs status_word in hex (matches how it's read/reported everywhere else) instead of decimal.
…driver EthercatBusConfig::master_plugin defaults to "ethercat_master/EtherlabMaster", pluginlib-loaded at runtime, but nothing declared that this package needs to be installed/sourced for the default to resolve.
Port of 771e984 (never carried into EtherlabMaster when it superseded EcMaster). Without ecrt_release_master() the kernel device stays locked after the process exits, preventing re-initialization on restart without unloading the kernel module — critical in multi-master setups.
tpoignonec
reviewed
Aug 25, 2026
Member
|
ok for me |
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.
EcMastercould only download/write SDOs, never read one) —new.
logging; exposing it as a queryable API is new).
targetPositionPassthrough()onEcCiA402Drive— the underlying logic existed pre-rewrite,but only inline, hardcoded; extracting it into an overridable virtual hook a vendor subclass
can extend is new.
EtherlabMaster's destructor — this one is a restore: thepre-rewrite
EcMasterdid this (ecrt_release_master()), the rewrite dropped it, leakingthe kernel device on shutdown.
ethercat_master_etherlabruntime dependency inpackage.xml— packaging fix.