cruise-automation / rosbag.js

ROS bag file reader for JavaScript 👜
Apache License 2.0
188 stars 43 forks source link

parsingMessageDefinition fails for "JSON" incompatible ros message #56

Closed surajhpatil closed 4 years ago

surajhpatil commented 4 years ago

Following rosMessage is being passed to rosbags parsingMessageDefinition function,

bool Alive=True
bool Dead=False

time stamp
string robot_name
bool heartbeat_alive
string error_msg

The parsingMessageDefinition function fails (at line 116) while parsing the above message, because the boolean True and False are not compatible with standard JSON true and false.

jtbandes commented 4 years ago

Thanks for the report. Would you be willing to make a PR to fix this, and update the tests? I think it's appropriate to add a special case that checks for True and False.

It looks like the ROS Python library which parses message definitions supports any Python literal, because it uses ast.literal_eval, which would only include True/False and not true/false: https://github.com/ros/genmsg/blob/1ad8e136cd6311c6af12256fc39362334ca23988/src/genmsg/msg_loader.py#L184-L185

surajhpatil commented 4 years ago

Hey.. yes, would love to submit a pr for this. Will check with test too :+1: