Skip to content

Master Abstraction hardening + fix missing deps - #239

Merged
mcbed merged 4 commits into
mainfrom
feat/master_abstraction-plus-hardening
Aug 31, 2026
Merged

Master Abstraction hardening + fix missing deps#239
mcbed merged 4 commits into
mainfrom
feat/master_abstraction-plus-hardening

Conversation

@mcbed

@mcbed mcbed commented Aug 19, 2026

Copy link
Copy Markdown
Member
  • SDO upload (the pre-rewrite EcMaster could only download/write SDOs, never read one) —
    new.
  • Public master/domain/slave state getters (the state was already tracked internally for
    logging; exposing it as a queryable API is new).
  • targetPositionPassthrough() on EcCiA402Drive — the underlying logic existed pre-rewrite,
    but only inline, hardcoded; extracting it into an overridable virtual hook a vendor subclass
    can extend is new.
  • Release the master in EtherlabMaster's destructor — this one is a restore: the
    pre-rewrite EcMaster did this (ecrt_release_master()), the rewrite dropped it, leaking
    the kernel device on shutdown.
  • ethercat_master_etherlab runtime dependency in package.xml — packaging fix.

mcbed added 4 commits August 18, 2026 13:21
…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.
Comment thread ethercat_driver/package.xml
Comment thread ethercat_interface/include/ethercat_interface/ec_master_base.hpp
Comment thread ethercat_interface/include/ethercat_interface/ec_master_base.hpp
@pzanne

pzanne commented Aug 27, 2026

Copy link
Copy Markdown
Member

ok for me

@pzanne pzanne left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok for me

@mcbed
mcbed merged commit c1b45ee into main Aug 31, 2026
1 check passed
@mcbed
mcbed deleted the feat/master_abstraction-plus-hardening branch August 31, 2026 14:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants