-
Notifications
You must be signed in to change notification settings - Fork 7
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
Drop hardcoded/arbitrary delays in SDO reads #159
Comments
Interesting lecture: https://stackoverflow.com/q/62814. Edit 1: all semaphores used across our code are of the binary type ( Edit 2: the exclusion system proposed here should be actually of the binary type ( |
|
For future reference, the dual semaphore construct is only used in two places: ref1, ref2. |
Perhaps this SO answer is closer to my original intent: https://stackoverflow.com/a/47614705. |
We had to increase tenfold the hardcoded 1 ms delay in order to correctly fetch the actual motion status from the iPOS:
The default value was causing trouble in our teo-self-presentation demo due to |
Idea: TPDOs can be configured to emit messages at fixed intervals, and send them with higher frequencies in case the drive state which is being watched changes; see 3.6, TxPDOs mapping example (asynchronous transmission) and 10.3, Cyclic Synchronous Position Mode example (synchronous). |
WIP at #209.
To be discussed at #223. |
Idea: implement a map of binary semaphores ( PS see this SO answer regarding the differences between a mutually exclusion semaphore ( |
Ready at fec00cf. All SDO read requests now poll an available semaphore and block until the response arrives or a timeout occurs. Additionally, most SDO writes await an acknowledge signal from the driver. |
Assuming only one active connection can be handled by a single SDO channel, there is no need to poll anything. Commit 29b3e1e simplified things a bit. |
This same semaphore-wait-with-timeout thingy proved useful for non-SDO thingies. Look for a StateObserver.hpp file in 972f875. Now, it is possible to signal an event to a observer in a more generic manner: no context data, context data is an integer-type (be it an array of |
Issue #160 allowed simultaneous SDO requests to occur. Commit fd5dd7d guards against this and reports "overrun" errors whenever the current SDO client's observer registers a response/confirmation message a different SDO client was supposed to receive from a previously issued request/indication. The SDO handshake has been made foolproof with a triple check: object index and object subindex must match, and command specifier bits must agree with the expected upload/download protocol. |
Current CAN bus communications rely on blocking read operations with a hardcoded 1 ms delay. Following the schema of CanBusControlboard::ThreadImpl, the read loop behaves like this:
On the CAN node side, requests for data retrieval apply the same time value for delays while read operations loop constantly on another thread, as shown above (hopefully expecting that the next incoming message would refer to the exact same information previously requested):
yarp-devices/libraries/YarpPlugins/TechnosoftIpos/IPositionControl2RawImpl.cpp
Lines 283 to 296 in f2f659e
Another approach was taken in icub-main's sharedCan device. It employs a pair of closely cooperating semaphores (look for
waitReadMutex
andsynchroMutex
), which are mutually exclusive (one of them initially set to zero), and non-blocking read calls. Seems cleaner, perhaps even more efficient.In addition, advantage could be taken of the new message buffering feature coming soon in #122. For the time being, these buffers will start with a size of 1.
The text was updated successfully, but these errors were encountered: