Closed shoeffner closed 4 years ago
Hello @shoeffner,
Please go over the issue #78, where the limitation of de-/serialization of NaN values has already been discussed. You can particularly try this suggestion regarding the use of nullable class members to be able to bring messages with null values into Unity (because rosbridge convertes NaN values to null values while serializing the message since this commit which are then not deserialized to non-nullable class members causing the callback function of the subscriber to be never called).
I hope this helps. Any improvement suggestions are welcomed regarding the limitation of de-/serialization of NaN values.
Thanks, I didn't find #78. Indeed, a warning would have been nice (maybe even a one off thing) explaining that it is application dependent how to handle nan values and that the values are dropped silently. The problem I had was basically that I didn't see the issue nor is there a way to trivially solve it on the unity side.
If course, it could be some setting somewhere how to handle nan values, but I think the warning might be the simplest solution.
On Tue, Aug 11, 2020, 18:04 Berkay Alp Cakal notifications@github.com wrote:
Hello @shoeffner https://github.com/shoeffner,
Please go over the issue #78 https://github.com/siemens/ros-sharp/issues/78, where the limitation of de-/serialization of NaN values has already been discussed. You can particularly try this suggestion https://github.com/siemens/ros-sharp/issues/78#issuecomment-457105744 regarding the use of nullable class members to be able to bring messages with null values into Unity (because rosbridge convertes NaN values to null values while serializing the message since this commit https://github.com/RobotWebTools/rosbridge_suite/commit/44495be0956dd6c6202b959bc97935715b4a0917#diff-8844e002e306884d690c34b324d23326 which are then not deserialized to non-nullable class members causing the callback function of the subscriber to be never called).
I hope this helps. Any improvement suggestions are welcomed regarding the limitation of de-/serialization of NaN values.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/siemens/ros-sharp/issues/334#issuecomment-672052278, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAOAODY5RRIJWJX77NMXIPLSAFTZRANCNFSM4P3BH5MA .
Hi @shoeffner .
We thought about how to handle NaN and Null values several times. Up to now I did not find a nice general answer:
rosbridge_suite
converts NaN values to Null values before communicating them.Serializers can handle Null values differently. You could for example also implement an ISerializer that fills Null values with default values.
For the ´MicrosoftSerializer` for example you can adjust Null value handling in this Method.
Thanks @MartinBischoff, I also handle NaN in ROS at the moment, but implementing a custom serializer might also be a good idea in the future. Thank you!
I found a bug!
[x] I am using the latest ROS# version available here on the master branch.
[x] I am adding all required information, code and data files, screenshots and log files so that you can reproduce the problem.
My OS is: macOS Catalina 10.15.5 (19F101)
My Unity Version is: 2019.3.14f1
My ROS Distribution is: melodic (dockerized)
My Build Target Platform is: run from editor
Here is my bug description: sensor_msgs/JointState messages are dropped/ignored silently when they contain NaN values. Possibly happens to other messages as well.
For the JointState this is a low-priority issue, as I built a helper node to drop nan-values before they get to Unity.
Perform the following steps reproduce the bug:
If you have a NAO available:
roslaunch naoqi_driver naoqi_driver.launch nao_ip:=${NAO_IP} roscore_ip:=${ROSCORE_IP} network_interface:=eth0
, it's from the naoqi_driver -- for me that's a docker container in a compose setup, see below.If you don't have a NAO available:
Observed results:
Only the odom messages are transferred correctly (the NAO changes its base_link properly), but other joints are not correct.
Expected results:
The NAO should move properly, or there should be a warning that the messages containing "nan" values are dropped.
I found out that the issue that some values reported from the naoqi_driver appear to be NaN, especially in the
position
andvelocity
arrays. If I send a custom message viarostopic pub
, the robot behaves correctly. As a fix, I built a ROS node which drops NaN parts of JointState messages and republishes them. This fixes it and the NAO behaves correctly. Also, the dropping must already occur somewhere in the RosBridgeClient, as the JointStateSubscriber never receives those message (ReceiveMessage is never called).Relevant Code:
This node subscribes to the
/joint_states
from naoqi, drops all nan-values and publishes the resulting messages on/joint_states/no_nan
:I am running the following stack -- if you need more details, you can check out my repository (https://github.com/shoeffner/ease_naoqi_dlu). In commit https://github.com/shoeffner/ease_naoqi_dlu/commit/57b62e46447e1ae939617d32b5de4dc954a98f68 the issue exists, by commit https://github.com/shoeffner/ease_naoqi_dlu/commit/d3a2ada4c868ed88df50c123d6634d4312f15425 it's fixed – the following commit updates the version of ros-sharp, which has the same issue.