Comments (7)
@BLuedtke I had just a quick look at the linked response queue and if I understand it correct, there is 1 queue per node.
Example: If you set an aspect on 2 accessories on the same node (almost simultaneously). The first aspect takes very long to complete, and the second is very short. The "final" execution state of the second aspect is delivered before the "final" execution state of the first aspect.
If I get it right then the evaluation is currently not correct, right? You should be able to test it with 2 macros (1st with multiple steps of delay, 2nd with only a short delay).
I'm not sure if moving the entry is the solution. If you move the entry (because you got the wait message) and then an error happens during execution (Murphy ...), the node will send an error response immediately, before the other entry is received. Now the entry is in the wrong position.
Maybe I didn't get the problem right, but maybe this examples help you.
from libbidib.
@BLuedtke The expected wait time is sometimes a guess. I have seen nodes that send weird wait time values ...
... and I'm pretty sure the error response is sent immediately :-)
from libbidib.
A perfect solution probably does not exist because the BiDiB boards themselves do not track requests with their respective feedback. We can only make an educated guess on what feedback we expect for each request type.
from libbidib.
Maybe you can adjust the logic:
You can evaluate the bit 7
and bit 0
of the EVALUATE
parameter of MSG_ACCESSORY_STATE
. If both bits are 0
the "last" message of normal handling was received and you can remove the entry.
If bit 7
is 1
the "last" message of error handling is received and you can remove the entry.
from libbidib.
Yeah, that works for knowing when the "last" reply of type MSG_ACCESSORY_STATE
is received. Thanks for the input!
However, this does not get around the queue problem: A response to a different command may be expected between the first and second MSG_ACCESSORY_STATE
response. If we do not pop the head of the response queue after the first MSG_ACCESSORY_STATE
, the response to the unrelated command would be compared to the "wrong" response queue entry. However, there might be some tricks to get around that.
Edit: One workaround just came to my mind. In the response queue entries we do save the "creation time". Now, when receiving the first message of MSG_ACCESSORY_STATE
, this message tells us how long we'll have to wait. In the example, that was 0.3 seconds. If we could manipulate the queue, we could move the response queue entry for MSG_ACCESSORY_STATE
backwards when receiving the first reply, moving it until its (creationtime + wait time) is later than the creationtime of the previous response queue entry. That would also have to be done when new messages are added to the response queue afterwards.
from libbidib.
I'm not sure if moving the entry is the solution. If you move the entry (because you got the wait message) and then an error happens during execution (Murphy ...), the node will send an error response immediately, before the other entry is received. Now the entry is in the wrong position.
I'm not sure if the error response would be sent immediately. Based on the spec, I'd expect to receive a message with the appropriate error code after the wait time of the first message. Of course, if something such as a short circuit occurs, we can not rely on the rest of the messages being received as we expect. They would time out after roughly 3 seconds.
from libbidib.
Interesting. With our use of the Fichtelbahn control boards, the wait time seems to be directly related to how we configure the servo motor PWM settings with the BiDiB Wizard. But definitely good to know about the error being sent immediately.
I think a bigger overhaul of the implementation of response tracing in our source is needed eventually. Both the current datatypes and functions for parsing are unsuitable for modification and/or rather hard to read.
from libbidib.
Related Issues (17)
- Locomotive Orientation HOT 2
- Documentation for Physical Tests HOT 2
- Complete the Track Coverage of the Physical Test HOT 3
- Update Processing of BiDiB Feedback HOT 1
- Support Kehrschleifenmodul HOT 1
- Question about orientation vs direction HOT 4
- Feature Request: Make Install Target, Pkgconfig, and Switch to En-/Disable Building Tests
- "No train configured for..." message when placing train on tracks in right orientation HOT 3
- Phantom Trains Detected HOT 20
- Add Uninstall-Target to match the Install-Target HOT 1
- Commit the pthread_rwlock_rdlock Changes? HOT 1
- Inconsistent paranthesis in malloc size arg
- Node Stall Ready check does not perform search in stall queue as intended HOT 2
- Incorrect signals-dcc parameter calculation
- bidib_state_reset does not correctly reset "detected train speed"
- Flush in batch instead of byte-by-byte HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from libbidib.