Ask Your Question
1

Why doesn't std_msgs::Float32MultiArray have a Header field?

asked 2017-01-13 17:52:31 -0500

galv gravatar image

Some messages (e.g., sensor_msgs::PointCloud2) have Header fields, while many others don't.

In particular, why don't float32 multiarrays (or any other std_msg/ messages) have header fields? Why was the decision made to only selectively provide header fields. How am I supposed to track the timing of messages without header fields, since the header contains the timestamp?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2017-01-14 10:00:48 -0500

mgruhler gravatar image

From the ROS wiki:

Standard ROS Messages including common message types representing primitive data types and other basic message constructs, such as multiarrays.

...

std_msgs contains wrappers for ROS primitive types, which are documented in the msg specification. It also contains the Empty type, which is useful for sending an empty signal. However, these types do not convey semantic meaning about their contents: every message simply has a field called "data". Therefore, while the messages in this package can be useful for quick prototyping, they are not intended for "long-term" usage.

As such, they are simply not intended to have a header. Headers are added for all the messages with semantic meaning where this makes sense. This goes especially for sensor_msgs, as it is obvious a sensor reading needs to contain the header.

You can and should create your own message with semantic meaning that can hold whatever your require. See also this related discussion on discourse that just popped up recently.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2017-01-13 17:52:31 -0500

Seen: 412 times

Last updated: Jan 14 '17