Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

NaNs not handled correctly when in an array #916

Open
JayHerpin opened this issue Mar 27, 2024 · 1 comment
Open

NaNs not handled correctly when in an array #916

JayHerpin opened this issue Mar 27, 2024 · 1 comment
Labels

Comments

@JayHerpin
Copy link

I've seen that there is explicit handling for NaN's in the json messages, but this seems not to be extended to NaNs within arrays.

  • Library Version: 1.3.2-1jammy.20240213.165624
  • ROS Version: Iron
  • Platform / OS: Ubuntu 22.04

Steps To Reproduce

Run command:

ros2 topic pub /fix sensor_msgs/msg/NavSatFix "{latitude : .nan, longitude : .nan, altitude : .nan, status : {status : -1, service : 1}, position_covariance : [.nan, .nan, .nan, .nan, .nan, .nan, .nan, .nan, .nan]}"

to publish problematic data

Subscribe to topic /fix from nodejs or similar

Expected Behavior
All NaN values in the encoded json message should be encoded as :Null

Actual Behavior

As you can see, while the non-array members are encoded correctly, the values within the array are not

image

@JayHerpin JayHerpin added the bug label Mar 27, 2024
@RamiCMT
Copy link

RamiCMT commented Apr 1, 2024

This has been causing problems for roslibjs as well.

If I have a serial GPS node publishing data without proper reception, missing values encoded as NaN cause roslibjs' subscriber's JSON.parse() to throw an error.

Screenshot from 2024-04-01 14-09-20

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants