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

How can I represent Multidimensional array in msg format

asked 2013-08-19 00:05:09 -0600

micheal gravatar image

updated 2014-04-20 14:09:44 -0600

ngrennan gravatar image

If i have something like

int  mein[NUM][4];

in C++. How do I represent it in msg format. Should it be something like

uint8[][4] mein

Also as NUM is defined in my C++ file and can vary according to certain parameters. Should I just allocate it dynamically in msg format or I should give it a certain value or define NUM in msg format. Do you think there would be any disadvantage if I just allocate it dynamically meaning like uint8[][4] mein.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
5

answered 2013-08-19 01:22:16 -0600

Josch gravatar image

updated 2017-03-03 18:34:09 -0600

130s gravatar image

Hi michael,

you can probably use the std_msgs/ByteMultiArray. You can define a MultiArrayLayout which considers the NUM size. Examples are given in the linked documentations.

I am not really used to C++, so I can't really help you with the allocation question.

edit flag offensive delete link more

Question Tools

2 followers

Stats

Asked: 2013-08-19 00:05:09 -0600

Seen: 2,995 times

Last updated: Mar 03 '17