question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Unquoted string constants in custom msgs

See original GitHub issue

Description 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: image

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

  1. Create a message with a constant in it, e.g.:
string my_message
string MYCONSTANT = THISISMYCONSTANTSTRING
  1. Create a publisher which publishes this message
  2. Start up rosbridge_suite and connect foxglove over websockets as per the instructions
  3. 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:closed
  • Created 2 years ago
  • Reactions:1
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
jtbandescommented, Nov 1, 2021

v0.21.0 will be out later today!

1reaction
jhurlimancommented, Oct 27, 2021

#13 is a separate issue concerning round-trip preservation of True and False 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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

error handling - Return Result with unquoted string
It will print the error using Display formatting. There's nothing special about main() 's built-in error handling, so you're not losing anything ...
Read more >
Strings get converted to unquoted strings in scss & css #462
Hey, I noticed that all strings end up being unquoted, for example: textCase: ... Will show up in the css file as: --body-text-case:...
Read more >
Unquoted attribute values in HTML and CSS/JS selectors
So, a valid unquoted attribute value in CSS is any string of text that is not the empty string, is not just a...
Read more >
10.2 Exceptions - Racket Documentation
An unquoted-printing string is especially useful with raise-arguments-error to serve as a field “value” that causes literal text to be printed as the...
Read more >
Strings - Puppet
Strings are unstructured text fragments of any length. They're a common and useful data type. Strings can interpolate other values, and can use...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found