Open JayHerpin opened 3 months ago
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.
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.
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