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

Publish Float64MultiArray from command line - ROS2

asked 2021-08-03 09:21:20 -0600

AndyZe gravatar image

updated 2021-08-03 09:28:15 -0600

I can't seem to figure this out:

ros2 topic pub /gripper_controller/commands std_msgs/msg/Float64MultiArray lay [TAB COMPLETE]

Now the message is auto-populated like this. I just change the data field:

ros2 topic pub /gripper_controller/commands std_msgs/msg/Float64MultiArray layout:\
\ \ dim:\ []\
\ \ data_offset:\ 0\
data:\ [0.2]\

^ When I try that, the error is:

yaml.scanner.ScannerError: mapping values are not allowed here in "<unicode string="">", line 1, column 13: layout: dim: [] data_offset: 0data: [0.2]

Similar issues if I use the rqt message publisher.

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
0

answered 2021-08-03 09:32:56 -0600

AndyZe gravatar image

Ah, found an example in ros2_control_demos:

ros2 topic pub /gripper_controller/commands std_msgs/msg/Float64MultiArray "data:
- 0.1"
edit flag offensive delete link more
0

answered 2022-05-17 19:17:47 -0600

updated 2022-05-17 19:18:00 -0600

I was not able reproduce with @AndyZe's answer since I had 12 joints. what worked for me was ;

ros2 topic pub /joint_trajectory_controller/commands std_msgs/msg/Float64MultiArray "{data: [0,0,0,0,0,0,0,0,0,0,0,2],layout: {dim:[], data_offset: 1"}}

Tested with ROS2 Foxy

edit flag offensive delete link more

Question Tools

2 followers

Stats

Asked: 2021-08-03 09:21:20 -0600

Seen: 2,576 times

Last updated: May 17 '22