-
Notifications
You must be signed in to change notification settings - Fork 72
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
add "rosx_introspection" to support JSON encoding #307
add "rosx_introspection" to support JSON encoding #307
Conversation
I know that CI is failing. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested locally and it works nicely. Diff is also minimal 👍
IMPORTANT: the JSON parser support missing fields (in that case, default values will be used).
Is this something that we could theoretically disable? When the client sends garbage, e.g. { data: "garbage" }
a ROS message is still published with the default values, which is somewhat unexpected.
Co-authored-by: Hans-Joachim Krauch <achim-k@users.noreply.github.com>
Well, that was a feature 😅 |
Could you explain more about your use case where this is unexpected? |
I think it's great, but it would be nice if one could enable/disable it via a ROS parameter if that is easily doable. If it's too much work then I think it's fine to keep it. Alternatively, another solution would be to raise an error if the JSON object contains fields that do not appear in the ROS message. This would then still work for a empty JSON object but not for a |
Conflict fixed and Linter happy. I believe you can test it on your side and consider merging |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have checked out this branch locally and tried publishing a couple of messages but it does not behave correctly and often publishes messages with the default values, see screencast below.
For testing this, I have compiled it with serverOptions.supportedEncodings = {"json"};
and connected to the server with app.foxglove.dev with a Publish panel and a Raw message panel.
Screencast.from.23.07.2024.14.36.00.webm
0611fb8
to
fb00ebc
Compare
As a side note, there was a typo in your JSOn message definition (field "nanosec", not "nsec"). I found the problem and it has been fixed in rosx_introspection 1.0.2 I also added a workaround in my latest commit, plus some other minor changes. About your suggested changes in the mutex, I believe the current one is correct. |
I just pushed a few more commits to add unit tests and to initialize JSOn parsers only when a client channel is advertised. Before this was done for all published topics on the system. This was also the reason for the mutex confusion. Changes looks good now and can be merged. Not sure why the
Indeed. This is some peculiarity with how Foxglove handles header stamps. We will have to fix this on Foxglove side. |
Description
This is an alternative to #288 using rosx_introspection instead.
Note that this requires the latest changes in the main branch, more specifically: facontidavide/rosx_introspection@b4c5a0d
rosx_introspection will be release soon on all the ROS2 distros and, potentially, Noetic too. This will allow us to add this functionality to the ROS1 bridge too, in a follow-up PR.
IMPORTANT: the JSON parser support missing fields (in that case, default values will be used).