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

do some mathematical calculation and algorithms on dynamic data

asked 2015-06-06 22:28:23 -0500

Fi gravatar image

Hi all I have some dynamic data in ROS. I want to put them in an array or in a pointer and do realtime calculation on this data? Is there anybody help me?

edit retag flag offensive close merge delete

Comments

Can you please give more details about what you have done and what you have to do?

Javier V. Gómez gravatar image Javier V. Gómez  ( 2015-06-08 01:41:44 -0500 )edit

I have some data from tactile sensors that will be changed during the execution. I want to read them continuously and then make some calculation on this data real-time and then send the some instruction to robot. For example: if (x>100) move right 1cm! x: amount of tactile sensor

Fi gravatar image Fi  ( 2015-06-09 10:37:13 -0500 )edit

And what have you done so far? Because a simple publisher-subscriber scheme should be enough (if the computations over the array are not too expensive) Check the tutorials, all you should do is to include your computation in the subscriber callback.

Javier V. Gómez gravatar image Javier V. Gómez  ( 2015-06-09 10:54:52 -0500 )edit

I am not expert in ROS! The calculation in this step is not high but it will be high in next steps. which section of tutorial? publisher?http://wiki.ros.org/roscpp/Overview/Publishers%20and%20Subscribers

Fi gravatar image Fi  ( 2015-06-09 11:24:30 -0500 )edit

Well, first of all, if you are not experienced in ROS, I recommend to go through all the beginner tutorials: http://wiki.ros.org/ROS/Tutorials And more specifically http://wiki.ros.org/ROS/Tutorials/Wri... and adapt this to your needs.

Javier V. Gómez gravatar image Javier V. Gómez  ( 2015-06-09 12:11:01 -0500 )edit

In the future you would need something a bit more complex, like create your own spin thread and carry out expensive computations outside callbacks,

Javier V. Gómez gravatar image Javier V. Gómez  ( 2015-06-09 12:12:48 -0500 )edit

Thanks Javi; Whould you please let me know the calculation of how amount of data can be done by a single publisher and subscribers? and what I should do for more computation?

Fi gravatar image Fi  ( 2015-06-18 16:35:30 -0500 )edit

I'm not sure I completely understand your question, but I think you are not understanding how ROS works. Publishers and subcribers are a mean to communicate among programs. Each program can do whatever you want it to do, they are just regular C++ programs.

Javier V. Gómez gravatar image Javier V. Gómez  ( 2015-06-19 01:46:37 -0500 )edit

1 Answer

Sort by » oldest newest most voted
0

answered 2015-06-19 15:03:54 -0500

Fi gravatar image

updated 2015-06-19 15:05:09 -0500

Thanks Javi I understand publisher and subscriber. What is my problem is related to send a 2D matrix as messages. I saw the multiarray definition as a msg but I do not understand the application of it. Can I define matrix[i][j] as a msg by multiarrays or not? If yes, how? Do some calculation on each element of 2D matrix in a nested loop (outer loop :rowlength, inner loop:coloumlength) on a 2D matrix is my question p.s. for (i=0;i<rowlength;i++) for="" (j="1;j&lt;coloumlength,j++)" mat[i][j]="do" some="" calculation="" on="" each="" element="" of="" it="" i="" never="" see="" the="" nested="" loop="" in="" ros.<="" p="">

edit flag offensive delete link more

Comments

1

Please don't use answers to ask a question. If you'd like to provide additional information, edit your original question. When inserting code snippets you should either highlight the code and click the button with "101010" on it or press Ctrl+k. This will result in nicely formatted code.

jarvisschultz gravatar image jarvisschultz  ( 2015-06-20 11:17:04 -0500 )edit
1

Also, hopefully my answer to your other question no helps you get started.

jarvisschultz gravatar image jarvisschultz  ( 2015-06-20 11:18:36 -0500 )edit

Question Tools

1 follower

Stats

Asked: 2015-06-06 22:28:23 -0500

Seen: 421 times

Last updated: Jun 19 '15