Unquoted string constants in custom msgs
See original GitHub issueDescription
Hi, I have been trying to use foxglove with my drone based system running mavros
. One of the key msgs is the State message which contains a number of constants as allowed by the ROS2 interface definition:
std_msgs/Header header
bool connected
bool armed
bool guided
bool manual_input
string mode
uint8 system_status
string MODE_APM_PLANE_MANUAL = MANUAL
string MODE_APM_PLANE_CIRCLE = CIRCLE
string MODE_APM_PLANE_STABILIZE = STABILIZE
string MODE_APM_PLANE_TRAINING = TRAINING
...
When I run a mavros node and a rosbridge_suite (on port 55555) node with foxglove connected, the connection appears to fail:
With the following error:
Error: Syntax error at line 1 col 32:
string MODE_APM_PLANE_MANUAL = MANUAL
^
Unexpected fieldOrType token: "MANUAL". Instead, I was expecting to see one of the following:
A doubleQuotedString token based on:
doubleQuotedString → ● %doubleQuotedString
stringConstantValue$subexpression$1 → ● doubleQuotedString
stringConstantValue → ● stringConstantValue$subexpression$1
main → _ stringType __ constantField _ assignment _ ● stringConstantValue _ main$ebnf$11
A singleQuotedString token based on:
singleQuotedString → ● %singleQuotedString
stringConstantValue$subexpression$1 → ● singleQuotedString
stringConstantValue → ● stringConstantValue$subexpression$1
main → _ stringType __ constantField _ assignment _ ● stringConstantValue _ main$ebnf$11
at u.feed (file:///opt/Foxglove%20Studio/resources/app.asar/renderer/main.js:176:1209)
at file:///opt/Foxglove%20Studio/resources/app.asar/renderer/main.js:183:504
at Array.forEach (<anonymous>)
at b (file:///opt/Foxglove%20Studio/resources/app.asar/renderer/main.js:183:397)
at file:///opt/Foxglove%20Studio/resources/app.asar/renderer/main.js:183:122
at Array.forEach (<anonymous>)
at g (file:///opt/Foxglove%20Studio/resources/app.asar/renderer/main.js:183:63)
at K._requestTopics (file:///opt/Foxglove%20Studio/resources/app.asar/renderer/9773.js:1:2933)
I guess this means that the constant does not adhear to the foxglove parser, or that the mavros State.msg
does not adhear to ros2 agreed formats. I do not think this is an issue from my side, although I might have easily overlooked something.
This issue also appears to stop the discovery of new topics as well (previously subscribed topics continue to be updated), which is perhaps the larger issue.
Would anyone be able to offer suggestions or fixes? Note that I am not a maintainer of mavros so I cannot actively change their source!
While i’m here, separate note: It actually took me a long time to find the above error message as it was not clear that you could click on the Failed to fetch topics from rosbridge
. I would like to suggest that errors are just displayed somewhere!
- Version: 20.1
- OS: Ubuntu Linux 20.04, ROS2 foxy
Steps To Reproduce
- Create a message with a constant in it, e.g.:
string my_message
string MYCONSTANT = THISISMYCONSTANTSTRING
- Create a publisher which publishes this message
- Start up rosbridge_suite and connect foxglove over websockets as per the instructions
- Foxglove UI should shown an error as per the image above.
Expected Behavior Message is parsed successfully with no errors being thrown. OR if msg is erroneous for the error to be logged and for the discovery process to continue so other topics can be monitored.
Actual Behavior Message with constant is not parsed successfully and an error is triggered as above. The discovery of new topics is stopped.
Issue Analytics
- State:
- Created 2 years ago
- Reactions:1
- Comments:6 (2 by maintainers)
Top GitHub Comments
v0.21.0 will be out later today!
#13 is a separate issue concerning round-trip preservation of
True
andFalse
literals for booleans. It’s a lesser concern, whereas not supporting unquoted string constants appears to be tripping up multiple people so we’ll get this fixed shortly.