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

how to publish an Eigen::Vector3f& in ROS

asked 2013-10-22 09:16:22 -0600

this post is marked as community wiki

This post is a wiki. Anyone with karma >75 is welcome to improve it.

Im using a PCL code and the information I need is in a Eigen::Vector3f&, how to i publish this information in ROS. What is the type of the publisher? Thanks

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2013-10-22 22:26:53 -0600

BennyRe gravatar image

updated 2013-10-29 04:19:26 -0600

You could use geometry_msgs/Vector3Stamped

$ rosmsg show geometry_msgs/Vector3Stamped 
std_msgs/Header header
  uint32 seq
  time stamp
  string frame_id
geometry_msgs/Vector3 vector
  float64 x
  float64 y
  float64 z

You can browse messages with

rosmsg list

Publishing this as a topic is good described in the publisher and subscriber tutorial:

edit flag offensive delete link more


@BennyRe how do i publish such a topic, i can manage to make it work. i have a n.advertise<std_msgs::float32> how do i change it to the vector? thanks

ctguell gravatar image ctguell  ( 2013-10-29 04:09:58 -0600 )edit

@BennyRe thanks also is there any standard array message? thanks

ctguell gravatar image ctguell  ( 2013-10-29 04:21:52 -0600 )edit

Do you mean an array of Vector3s?

BennyRe gravatar image BennyRe  ( 2013-10-29 05:16:16 -0600 )edit

@BennyRe no just a 2x1 array of floats

ctguell gravatar image ctguell  ( 2013-10-29 05:23:48 -0600 )edit

A quick look at rosmsg list shows you the message std_msgs/Float32MultiArray

BennyRe gravatar image BennyRe  ( 2013-10-29 05:27:28 -0600 )edit

Question Tools

1 follower


Asked: 2013-10-22 09:16:22 -0600

Seen: 2,121 times

Last updated: Oct 29 '13