ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
1

How is a std_msgs/msg/ByteMultiArray message published via CLI?

asked 2022-09-10 13:17:09 -0500

Cadmus gravatar image

I can see how a std_msgs/msg/Byte message is published via CLI, in fact, there are two ways to do this. (see https://answers.ros.org/question/3752...)

And I know how other MultiArray messages are published via CLI. (see https://answers.ros.org/question/1890...)

But how do you do that for a std_msgs/msg/ByteMultiArray? I have tried:

bash ros2 topic pub -1 /whatever std_msgs/msg/ByteMultiArray "{data: [{3}, {4}]}"

and

bash ros2 topic pub -1 /whatever std_msgs/msg/ByteMultiArray "{data: [0x03, 0x04]}"

But both comes back with:

Failed to populate field: The 'data' field must be a set or sequence and each value of type 'bytes'

Other info: - Ubuntu 20 - galactic

edit retag flag offensive close merge delete

Comments

Trying all the usual patterns I could think of, I similarly wasn't able to get this to work from the CLI, so perhaps its a bug, and it may merit a Github issue (or perhaps I wasn't creative enough with my syntax).

As an aside, please note the deprecation warning:

This was originally provided as an example message. It is deprecated as of Foxy. It is recommended to create your own semantically meaningful message.

shonigmann gravatar image shonigmann  ( 2022-09-10 14:15:28 -0500 )edit
1

I am using std_msgs/msg/ByteMultiArray because its something that everyone can try. The actual thing I'm trying to do is to pub a custom message with a byte[] field

Cadmus gravatar image Cadmus  ( 2022-09-12 03:37:16 -0500 )edit
Cadmus gravatar image Cadmus  ( 2022-09-12 03:50:02 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
1

answered 2022-09-21 00:20:49 -0500

Cadmus gravatar image

Confirmed that there was no way of doing this. PR to fix issue is here: https://github.com/ros2/rosidl_python...

It appears that in the future we will be able to do:

ros2 topic pub -1 /whatever std_msgs/msg/ByteMultiArray "{data: [1, 2, 3]}"

edit flag offensive delete link more

Question Tools

2 followers

Stats

Asked: 2022-09-10 13:17:09 -0500

Seen: 533 times

Last updated: Sep 21 '22