Skip to content

Read a drive value before the bus is running, plus master/slave robustness - #233

Draft
JenniferBuehler wants to merge 16 commits into
ICube-Robotics:jazzyfrom
JenniferBuehler:feat/read-before-startup
Draft

Read a drive value before the bus is running, plus master/slave robustness#233
JenniferBuehler wants to merge 16 commits into
ICube-Robotics:jazzyfrom
JenniferBuehler:feat/read-before-startup

Conversation

@JenniferBuehler

Copy link
Copy Markdown
Contributor

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

  • Split bus startup: new 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-calls configureBus() first if needed.
  • New funciton readSlaveSdo(): a blocking SDO read that is safe to call in the configured-but-not-active window (see last point).
    • Internal configureBusLocked() and activateBusLocked() helpers to avoid recursive mutex locking.

Other refinements

  • EcMaster releases 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.
  • Status values printed in hex for readable diagnostics.
  • generic_ec_cia402_drive gains a 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).

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