Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix msg printer for arrays #57

Open
wants to merge 1 commit into
base: noetic-devel
Choose a base branch
from
Open

Conversation

v4hn
Copy link

@v4hn v4hn commented Oct 14, 2024

I put this patch here for visibility. @rhaschke pushed it to the ROS-O fork last year.

Robert: Maybe you can comment with an example for completeness?
I believe this is related to message parsing in the context of MTC properties, right?

@rhaschke
Copy link

Printing messages via the ostream operator << doesn't yield valid yaml in roscpp (while it does in rospy). For example, given these simple messages:

main.msg:

uint32[] ints
sub[] subs

sub.msg:

uint32  i
float32 f

yields the following output for std::cout << msg in ROS Noetic:

  ints[]
    ints[0]: 1
    ints[1]: 2
    ints[2]: 3
  subs[]
    subs[0]: 
      i: 0
      f: 0
    subs[1]: 
      i: 0
      f: 0

while it should look like this (to be compatible with rospy/yaml and realized by this PR in ROS One):

  ints: [1, 2, 3]
  subs: 
    -
      i: 0
      f: 0
    -
      i: 0
      f: 0

I remember having seen even worse formatting, but I can't reproduce that quickly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants