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

Raha's profile - activity

2022-04-12 06:41:35 -0500 received badge  Famous Question (source)
2018-07-13 04:54:10 -0500 marked best answer Subscribing to a topic whenever it publishes without affecting the execution of program

Hello,

I'm writing a project with C++ in ROS indigo installed in Ubuntu.

In my project, I do some processes in one node and publish the result data and in an other node, want to subscribe to this data and use it in order to do further works. My problem is that, the first node currently works much more slower than the second node. The result is that the second node waits for the data publishing by the first one. I want to write the second node in a way that it continue working with the last data received and whenever a new data published, use the new one.

I tried to use subscribe and callback method described in ROS tutorials, but the program waits for publishing the data from first node.

Any idea to manage it?

Thanks.

2018-07-13 04:54:10 -0500 received badge  Scholar (source)
2018-07-13 04:53:56 -0500 commented answer Subscribing to a topic whenever it publishes without affecting the execution of program

OK, by adding ros::spinOnce(); in the while loop, it worked as I need. Thanks a lot.

2018-07-13 04:04:05 -0500 commented answer Subscribing to a topic whenever it publishes without affecting the execution of program

I also tried to add the subscriber in the while loop, but it didn't help too

2018-07-13 04:03:55 -0500 commented answer Subscribing to a topic whenever it publishes without affecting the execution of program

dear Peteblackerthe3rd, Thanks for your answer. You are right about my project. That is exactly what I wanted to explai

2018-07-13 03:44:07 -0500 commented question Subscribing to a topic whenever it publishes without affecting the execution of program

Thanks for your answer. I think you mean the way that proposed by PeterBlackerThe3rd. As I commented there, it does not

2018-07-13 03:40:30 -0500 commented answer Subscribing to a topic whenever it publishes without affecting the execution of program

dear Peteblackerthe3rd, Thanks for your answer. You are right about my project. That is exactly what I wanted to explai

2018-07-13 03:39:50 -0500 commented answer Subscribing to a topic whenever it publishes without affecting the execution of program

dear Peteblackerthe3rd, Thanks for your answer. You are right about my project. That is exactly what I wanted to explai

2018-07-13 02:52:12 -0500 received badge  Notable Question (source)
2018-07-11 10:15:55 -0500 received badge  Supporter (source)
2018-07-11 09:45:19 -0500 received badge  Popular Question (source)
2018-07-11 05:15:41 -0500 asked a question Subscribing to a topic whenever it publishes without affecting the execution of program

Subscribing to a topic whenever it publishes without affecting the execution of program Hello, I'm writing a project wi