Fix msg printer for arrays
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?
Related to https://github.com/ros-o/roscpp_core/commits/obese-devel/ (https://github.com/ros-o/roscpp_core/commit/bdb975df0ef48c66c0327cf7d10fda8b1857491f, https://github.com/ros-o/roscpp_core/commit/fe4988788f0bf12b8128bcb6f0eb0fe3707bb6ed, https://github.com/ros-o/roscpp_core/commit/cae00b47f0d6cdbd7712fd4b4e223d49f784c8f0)
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.
@sloretz: Why did you force-pushed noetic-devel back to kinetic-devel and then re-released as 0.7.1 ??? This is actually the reason for the conflicts in CHANGELOG.rst and package.xml, which I didn't touch originally.
To maintain the release history (including 0.7.0 released by Geoffrey in Sep 2022), I suggest that you revert your force-push. Alternatively, I will rebase my commit onto 0.7.1. Please tell me, how to proceed.
I will rebase my commit onto 0.7.1. Please tell me, how to proceed.
Oops. Please rebase onto 0.7.1.
I remember doing something unusual with a couple repositories, but I forget why. I vaguely remember thinking tags had been created on the wrong commit and never bloom-released, but gencpp 0.7.0 was released into Noetic https://github.com/ros/rosdistro/pull/34663 . I agree I shouldn't have done that here.
@sloretz: I rebased, but using a new branch (I don't want to disrupt the ROS-O release). Please close this PR here and use #58 instead.
Closing in favor of #58