0
$\begingroup$

Rosanswers logo

When i want to publish msg like this:

Header header
  uint32 seq
  time stamp
  string frame_id
Point point
  float64 x
  float64 y
  float64 z

i can use the following cmd:

rostopic pub pt geometry_msgs/PointStamped '{stamp: now, frame_id: base_link}' '[1.0, 2.0, 3.0]'

or rostopic pub pt geometry_msgs/PointStamped '{stamp: now, frame_id: base_link}' '[1.0, 2.0, 3.0]'

what command should i use to publish msgs with array members like:

std_msgs/Header header
string[] joint_names
trajectory_msgs/MultiDOFJointTrajectoryPoint[] points 
       geometry_msgs/Transform[] transforms
       geometry_msgs/Twist[] velocities
       geometry_msgs/Twist[] accelerations
       duration time_from_start

Originally posted by peigong on ROS Answers with karma: 11 on 2017-08-28

Post score: 0

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

You can do it just as you filled the Point. For instance, if you want to fill the joint_names of a MultiDofJointTrajectory:

rostopic pub mdjt trajectory_msgs/MultiDOFJointTrajectory  '{joint_names:[name1, name2]}'

have a look at this answer. It is a bit clunky (especially when the vectors you are trying to fill aren't simple types), so it's probably useful to play around a bit in a text editor. For a slightly more intricate example:

rostopic pub mdjt trajectory_msgs/MultiDOFJointTrajectory  '{joint_names:[name1, name2, name3], points:[{time_from_start: {secs: 1, nsecs: 100}}, {time_from_start: {secs: 100, nsecs: 300}}]}'

Good luck.


Originally posted by rbbg with karma: 1823 on 2017-08-28

This answer was ACCEPTED on the original site

Post score: 0


Original comments

Comment by peigong on 2017-08-28:
Thank you for your kind reply.

it works.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.