parsingMessageDefinition fails for "JSON" incompatible ros message
surajhpatil opened this issue · comments
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
.
- This issue occurred while loading a bag file into webviz.
- In the webviz itself, it is being called in bagConnectionsHelper.js, where the
messageDefinition
is being passed to theparseMessageDefinition
function - Theoretically, the input content should be sanitized before processing.
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
Hey.. yes, would love to submit a pr for this.
Will check with test too 👍