Gazebo Simulation Time Seems To Be Tied to Framerate? [Gazebo 7.0]
Hello,
I have a gazebo plugin where I simulate an ackerman motion model for a xacro robot. That is, I calculated forces and velocities based on steering inputs. Furthermore, I send steering and velocity values to a ros node to calculate a motion model.
This all works fine. However, when calculating the detaTime interval in the ros node I have to divide by a factor of 30. i.e. dt = (current time - last time)/ 30
Im thinking this is the gazebo framerate as it is around 30 fps. But even when only spawning the gazebo server (without the GUI) I still have to use this factor.
Where does this factor come from? Has anybody has similar issues?
Asked by marc1990 on 2018-05-20 11:47:23 UTC
Answers
There seems to be a confusion between framerate (how many visual frames are rendered per second) and real-time-factor (how many seconds of simulation time are elapsed for each second of "real" (wall) time).
The framerate of Gazebo's graphical interface should have no impact on the simulation time you get at your ROS nodes.
For your ROS nodes to use simulation time, you can set the use_sim_time parameter on your ROS launch file (which defaults to true). Then use ROS time to calculate your deltaTime
.
Asked by chapulina on 2018-05-21 10:17:55 UTC
Comments
I do that already. Its just the factor of thirty has to come from somewhere. Maybe its Rviz or maybe im publishing to the wrong frame?
Asked by marc1990 on 2018-05-21 17:20:31 UTC
It's hard to tell what you mean with the division by 30, why are you dividing by 30?
Asked by chapulina on 2018-05-21 17:22:33 UTC
If I dont divide by thirty my motion estimations are off by a factor of 30. i.e. my delta times seems to be off by a factor of thirty
Asked by marc1990 on 2018-05-21 17:27:28 UTC
Seems is issue is more related to ROS frequency that gazebo
Asked by marc1990 on 2018-05-25 14:02:26 UTC
Comments
I'm new to Gazebo. As per my limited knowledge, Gazebo has it's own internal time clock, which is scaled according to the framerate and performance of the computer. That is where the scale factor in the bottom of the window comes from. It shows the time relative to real time, at which the sim is running.
Asked by varunvp on 2018-05-21 01:14:59 UTC
Are you using ros::time and not the normal time library? Simulation time is definitely not tied to framerate; it's tied to real time factor.
Asked by Raskkii on 2018-05-21 02:31:48 UTC