-
Notifications
You must be signed in to change notification settings - Fork 46
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix Startup Crash Caused by Read() and Write() on Un-activated Ethercat #120
Fix Startup Crash Caused by Read() and Write() on Un-activated Ethercat #120
Conversation
Many thanks for your report and your PR. |
af7a7e4
to
2e99cc6
Compare
I have looked into writing a test for this, I think it would have to be hardware in the loop. There doesn't seem to be existing software-only tests that start a hardware_interface. I have started looking into if this is possible with the etherlab codebase. |
We have work in progress towards unit testing:
But I was not counting on those to create the unit test I had in mind. I am planning to mock anything to make the ethercat_driver achieve «inactive» state (pass In the meantime, I will merge your PR (you can expect the merge to be done by the end of the week). The problem, you had, shows however a bigger problem of our design. It shows that our design does not follow the hardware interface lifecycle (https://control.ros.org/master/_images/hardware_interface_lifecycle.png) Read and write calls are legit after the on_configure stage, just «no movement» should happen. Since for the moment we have neither the concept of a «motion enabled» nor the concept of a «motion disabled» state for our ethercat slaves, it seemed more «simple» to setup the ethercat communication in the Our proposal is to have something that emulate a For the generic slave interface, we could add a new parameter to the channels providing values for the writes in the inactive mode:
As it will break the existing mode of operation, however being more respectful of the ros2 control specifications, we will increment the major version of the lib, making it an api breaking change. |
On our system (multiple CiA 402 motor drivers), we have found there are frequent crashes (at least 25% of the time) at startup caused by accesses to the
domain_info_
map before it is populated. We traced this to ros2_control calling theread()
andwrite()
functions on the ethercat interface beforeon_activate()
completed. This PR is our fix for this, which applies:at()
instead of direct access for thedomain_info_
map so it will throw an exception on out-of-bounds access instead of undefined behavior.I'm happy to re-write this as the team sees fit, or drop this if it is unhelpful.