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

beeeeck's profile - activity

2019-06-12 12:57:00 -0500 received badge  Student (source)
2016-07-18 04:12:18 -0500 received badge  Famous Question (source)
2016-05-19 09:04:35 -0500 received badge  Notable Question (source)
2016-05-19 01:52:39 -0500 answered a question How to publish a 2 dimensional array of known values

Thank you very much for the response. I found a much simpler way to do it though. I just converted the array into a matrix and then published the matrix like this:

Mat matrixarray = Mat(11,20,CV_32FC1,deptharray);


where the method to publish the array looks like this:

void GetDiffImg::PubDepthArray(Mat depthArray){

    cv_bridge::CvImage diffImgMsg;
    diffImgMsg.encoding  = sensor_msgs::image_encodings::TYPE_32FC1;
    diffImgMsg.image    = depthArray;

2016-05-19 01:49:36 -0500 received badge  Scholar (source)
2016-05-19 01:49:28 -0500 received badge  Supporter (source)
2016-05-13 04:46:25 -0500 received badge  Popular Question (source)
2016-05-10 04:22:42 -0500 asked a question How to publish a 2 dimensional array of known values


I'm stuck at my program to publish a 2 dimensional array. The array kinda looks like this:

int deptharray[4][5] = { {0, 0, 0, 0}, {0, average11, average21, average31, average41}, {0, average12, average22, average32, average42}, 0, average13, average23, average33, average43}, }; I also read several posts about how to publish an int32MultiArray but unfortunately none of my attemps to publish this array of known values worked. All examples that I have seen have unknown sizes and then use the push_back function in a for loop. I'd be really glad if you could help me. Thank you very much