0
$\begingroup$

Rosanswers logo

Hey guys,

I have a very frustrating problem using Ros Hydro on ubuntu 12.04. I have a Gazebo Simulation posting telemetry data and I use this in a node to create a tf-tree for the simulation.

Now I tried to combine my tf-tree with some static transform publishers and noticed that my transform from the c++ node which subscribes to the telemetry is using wall time. The statics transform publishers are using simulation time.

I searched the web, set use_sim_time to true and tried some other things but ros::Time::now() in my c++ code always returns wall time, while the static transform publisher use simulation time! This makes it impossible to use the transform together.

use_sime_time is set before launching any nodes, but my node launches before the /clock topic is available, looking into this next.


Originally posted by proprentnerl on ROS Answers with karma: 26 on 2014-07-22

Post score: 1

$\endgroup$

2 Answers 2

0
$\begingroup$

Rosanswers logo

Are you setting use_sim_time before starting the node in questions? Can you check if your node subscribes to the /clock topic?

Please update your question with this information.


Originally posted by demmeln with karma: 4306 on 2014-07-22

This answer was NOT ACCEPTED on the original site

Post score: 1


Original comments

Comment by proprentnerl on 2014-07-22:
Yes use_sim_time is set before starting the node, it seems that my node starts before the /clock topic is available and than continues to use wall time instead of switching to simulation time. I will try waiting for the /clock topic before calling ros::Time::now() in my node.

Comment by ahendrix on 2014-07-22:
I believe ros::Time has an explicit method to wait for the simulated clock to be initialized.

Comment by ahendrix on 2014-07-22:
See ros::Time::waitForValid()

Comment by Martin Günther on 2014-07-23:
@proprentnerl: I don't think your theory is correct. If use_sim_time is set, ros::Time::now() will return 0 until it receives the first /clock message, not walltime. This is also the condition that waitForValid() checks for, so that won't fix your problem.

Comment by Martin Günther on 2014-07-23:
The rospy implementation of tf has some horrible hacks (and bugs) involving walltime, but you mentioned using roscpp, so my guess is that @demmeln is right: your node is started before use_sim_time is set.

$\endgroup$
0
$\begingroup$

Rosanswers logo

Problem solved.

use_sim_time was needed but lead to another problem. The main node was waiting for a service from a python node... when using use_sim_time the main node wouldn't detect the service as long as the /clock service was nit published... Our main node starts the simulation with the /clock service, so doing this first before waiting for the python node service fixed the problem... It seems that python nodes become unresponsive when use_sim_time is activated but no /clock topic is published even when they don't need ans ros::Time functions.


Originally posted by proprentnerl with karma: 26 on 2014-07-23

This answer was ACCEPTED on the original site

Post score: 0

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.