peek - Finding location of models after specified time
I want to find the estimated position of a model after a time X. So, I basically want gazebo to run the simulation for time X and give back the ModelState after it runs it for time X.
I am currently using the ROS Service /gazebo/get_model_state
and /gazebo/pause_physics
with /gazebo/unpause_physics
to:
unpause -> wait for time X -> pause -> query model state
But this is giving inaccurate results. I guess because the "wait for time X" is bad. I need it to give the same positions repeatably.
How do I do something like what I want ?
EDIT: This is the algorithm I wish to run:
- Launch file is run, Node1 and gazebo started. Gazebo is paused initially.
- Node1 sets some motor velocities
- Gazebo is unpaused. As soon as 1 sec passes in simulation time, gazebo pauses and give back the state of the model
- Node1 finds the new motor velocities to set, and it publishes that.
- Goto step 3