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

Revision history [back]

click to hide/show revision 1
initial version

Hi Ferr; I read your code but I do not completely understand how to work with Multiarray for showing a 2D matrix (m*n) Would you please read what is my problem and help me?

Hi all; As I understand, the 2D matrix in the ROS in not available until now and for this reasn, a definition of a msg that its variable is a msg of 1D should be done. But, I would like to know how I can implement the following code: 1-define a 2D matrix named mat[m][n]; (m*n)

I write the following messages: array 2d.msg and array 1d.msg. Is it a problem in my definition?

array2d.msg array 1d[] mat;

array 1d.msg int8[] a;

2- Implementation of 2 nested for loop The one of simple code for do some mathematical calculation on matrix is presented in the following:

for (i=starti; i<m, i++)="" <br=""> for (j=starti; j<n, j++)="" {mat[i][j]="mat[i+1][j]+2;}&lt;/p">

Clearly, what I want to do is to do some mathematical functions on elements of matrix named mat. I write the simplest code of mathematical calculation in the previous lines. It is your kindness if you translate these lines to ROS code to give an idea to how to implement mathematical calculation with elements of 2D matrix.

Thanks for your help;

Fi