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

I'm not sure i understand your problem, the two last sentences before your code are not really clear.

Your problem is that you don't want to send a correction message on every callback if the error is to big? You want to limit the number of published velocity messages?

Then don't send the message in the callback, use the callback to calculate the position error and send the message in the main program, so then you can control the number or rate of messages you send.

I'm not sure i understand OK, so I misunderstood your problem, the two last sentences before your code are not really clear.problem.

Your problem is that you don't want function flyToTarget has a never ending while loop, it will not return to send a correction message on every the callback if and the error is to big? You want to limit callback doesn't finish. Get rid of the number of published velocity messages?

Then don't send the message loop in the callback, use you could move the callback to calculate the position error and send the message in the ros loop into your main program, so then you can control the number or rate of messages you send. function. Then publish only a single /cmd_vel per callback.