gazebosim / gazebo-classic

Gazebo classic. For the latest version, see https://github.com/gazebosim/gz-sim
http://classic.gazebosim.org/
Other
1.2k stars 484 forks source link

Model class uses clock time to wait for sensors, not simulation time #2082

Open osrf-migration opened 8 years ago

osrf-migration commented 8 years ago

Original report (archived issue) by Peter Mitrano (Bitbucket: peter_mitrano).


There's a "feature" in the Model class where it waits 5 seconds for sensors to be initialized, but it's using wall clock time. That means models will inconsistently fail to load if simulation slows down (IE, the same model works on your desktop but fails on your laptop. Vey frustrating!). I propose to use gazebo clock time instead to account for slower simulations, since I believe sensors being initialized is a function of that.

I plan to make the patch for this, but I need someone to point me in the right direction. In this case, how should I access gazebo simulation time within gazebo? Subscribing to time seems like the wrong way. Is there something within gazebo (common::Time?) to do this easily?

osrf-migration commented 8 years ago

Original comment by Peter Mitrano (Bitbucket: peter_mitrano).


Also, this is a "proposal", so feel free to say it's not the correct approach

osrf-migration commented 7 years ago

Original comment by Louise Poubel (Bitbucket: chapulina, GitHub: chapulina).


osrf-migration commented 7 years ago

Original comment by Steve Peters (Bitbucket: Steven Peters, GitHub: scpeters).


Can you point to the code where it's using wall clock time? If you have a world pointer, you can use world->GetSimTime() to get a common::Time object.

osrf-migration commented 7 years ago

Original comment by Peter Mitrano (Bitbucket: peter_mitrano).


I believe I was referring to this section of code, which seems to wait 100 ms in clock time for 50 iterations.

https://github.com/osrf/gazebo/blob/8719bf7ac4f1fa98a5499e9c5698509c0c8256b1/gazebo/physics/Model.cc#L1146