ros::Rate::sleep() equivalent in rosserial

asked 2020-02-21 08:18:49 -0500

broomstick gravatar image

I am building a rosserial application.

I would like to use a construct such as the following

ros::Rate loop_rate(30);

while (ros::ok())

rate.h does not appear to be included in rosserial. With ros, I can effectively achieve the same thing using ros::Duration, which also has a sleep function. While duration.h exists in rosserial, it does not appear to have a sleep function...

Is there an equivalent of ros::Rate or ros::Duration in rosserial which allows me to set a looping frequency in this way?

The best equivalent I can find is something like the following:

while (1)

This is not exactly equivalent, though, as it sleeps for a constant time, whereas ros::Rate::sleep and ros::Duration::sleep only sleep for the remaining time in the cycle.

edit retag flag offensive close merge delete