Using Float32MultiArray with RosSerial
Hi All,
I'm using an OpenCR board by robotis. It is an STM32 based micro.
I have been going through their example of using rosserial to publish data to a host machine and have been successful in doing that for floats.
I am struggling to figure out how to use Float32MultiArrays with Rosserial. When I attempt to read the topic I'm publishing .. I get nothing. The ros serial server actually complains about the system bing out of sync. I suspect I have issues initialising my multi array
currently the way I'm setting up my array looks like this
I intend to have 4 elements in my array val 1 , val 2 , val3 , spare , <--- all are float32
my_status_msg.layout.dim = (std_msgs::MultiArrayDimension *) malloc(sizeof(std_msgs::MultiArrayDimension));
my_status_msg.layout.dim[0].label = dim0_label;
my_status_msg.layout.dim[0].size = 4;
my_status_msg.layout.dim[0].stride = 1*4;
my_status_msg.layout.data_offset = 0;
my_status_msg.data = (std_msgs::Float32MultiArray::_data_type*)malloc(sizeof(std_msgs::Float32MultiArray::_data_type));
why is it so difficult to get arrays working in rosserial. There is hardly any complete examples in my search.