-
Notifications
You must be signed in to change notification settings - Fork 62
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
Subscribed C messages can't be recorded #64
Comments
Howdy Benjamin, thanks for bringing up this issue. I haven't dug into recorders and read functors in 2+ years and will have to dig into this again. What you discuss above reads correct. If the ReadFunctor reads from the C-msg payload, and does not use the payload pointer, then this would be incorrect behavior. I'll look at this and if your fix works out. |
Howdy Benjamin, I looked at making your proposed change, but this led to several issues.
Thus, I'm going to leave the behavior as it has been. If you re-direct a module to write to a stand-alone C-wrapped message, then you need to setup a recorder on the stand along message, not the original C-module output message. I'm going to update the documentation to make it clear that the |
Hello HP, Thanks for your prompt response and investigation. The solution I envisioned indeed had a few sides effects. I think there's an easier fix though. I've copied/pasted the relevant lines of msg_C.cpp.in.
I think that adding the following line before
(Or, an equivalent call to memcpy). will solve the issue of zeroed-out records for subscribed C messages. Note that the above proposed fix should have no impact on self-author C messages. Recorded subscribed C messages are typically module input messages, and as such are read in during the module's Update(). One just has to ensure that the module's Update() is called before the recorder's for the recorded payload to indeed be up to date. Could this do the trick ? |
Mm, interesting idea. In essence, the read command on the message would copy over the target message content into the local message container. Let me try this and see if I run into issues. |
I'm not seeing the expected behavior be adding that line. See attached python test script. I use the dummy BSK module, redirect the writing of the module output message to an external message If you are making a C-msg object the author of another C-msg, then I would simply add the recorder to the target message, not the original message? |
Hello HP, I think there was a misunderstanding on what I was trying to achieve here. Attached is a snippet demonstrating the successful recording of a C-module's input message content. Here is the template C-message read function I am using
If the
If the line is uncommented, then the output changes to
which is the expected behaviour. I'm in the process of recompiling BSK and running the unit tests so that I can make sure that this didn't break anything, but I think this fix addresses the issue I raised. |
Happy New Year Benjamin, thanks for the sample script. I was miss-understanding what you were trying to do. I agree with your solution to allow a |
…build hotfix - Add centerOfBrightness to the list of excluded targets
It appears that the mechanism by which wrapped C-messages can be recorded is limited to the case where such C messages are self authors. Indeed, the recorder's creation only reads from the
payload
field of the message structure :Consider
msg_C.h
This definition comes in play when a recorder associated to this C message is created
It is my understanding that the pointer
payloadPointer
on the line precedingthis -> readMessage()
actually points to thepayload
field of the message definition structure, and not to thepayloadPointer
field. This if fine for self-author messages that are written to, sincepayloadPointer == &payload
is true for self-author messages. Recorders work just fine in this case.However, this is no longer the case for subscribed C messages as their
payload
field is never written to. So creating a recorder for such a subscribed C message and hoping for the recorder to pick up whatever was written in the upstream message fails : the recorder will always record a zero payload (the content of the message'spayload
field).I think a way around would be to replace the call to the ReadFunctor constructor by the following (note the pointer that is passed to the constructor of the ReadFunctor, which once de-referenced should be equal to the payloadPointer field of the message structure)
The question as to how the Recorder constructor can detect that it is dealing with a Subscribed C message is still open though.
What are you thoughts about this ?
The text was updated successfully, but these errors were encountered: