How to publish/subscribe when a specific event occurs

asked 2021-06-03 19:02:26 -0500

secrisa11 gravatar image

Hello everyone. I'm a ROS beginner.

I would like to publish/subscribe a ROS Topic when a specific event occurs

For example,

when -20 < angle < 20, I want to publish motor speed msg.

Is there any good way?

edit retag flag offensive close merge delete


The question does not have enough details. Where all in your code is angle updated? Every time angle is updated, the "obvious way" is to check for that condition and if true publish. However, without more info, it's difficult to see why the "obvious way" might not work.

abhishek47 gravatar image abhishek47  ( 2021-06-04 04:47:03 -0500 )edit