Process blocking when using rosbags and rate sleep [closed]
Hi !
I'm launching a rosbag file from a launch. At the start of the launch I have:
<param name="/use_sim_time" value="True"/>
then I call the rosbag as:
<node pkg="rosbag" type="rosbag" name="rosbag"
args="play --clock /home/andreu/rosbags/platformLaserFME.bag" />`
Finnally I call the node that I'm debugging:
<node pkg="localization3d_node" type="localization3d_node"
name="localization3d_node"
args="" output="screen"/>`
In my node localization3d_node, the mainThread() is just as follows:
{
this->myStuff();
this->loop_rate_.sleep();
}
where loop_rate_
is a ros::Rate
type variable.
And at the localization3d_node constructor I set:
this->loop_rate_ = 5;//in [Hz]
So, the issue appears at execution: my node gets blocked since it executes the myStuff() function only once and then it stops sleeping for ever.
Observation: I recorded the rosbag also with the clock topic, so I don't see any difference in terms of published topics when I call rosbag play with/without the --clock option.
The question is: what I'm doing wrong to block my process ?
Thanks for your answers !!
Andreu