Hello,
I've been trying to get the GUI Real Time Factor programmatically, and I had various issues trying to do so. Here were a couple things I found from looking around that did not work:
- Subscribing to ~/diagnostics: the rtf given by diagnostics seems to be just simtime/realtime so it is the average RTF, not the current RTF. For example, having the simulator at 0.5x for a couple minutes and then putting it to 3x will still give an RTF of 0.5x, slowly converging to 3x. So this is not an option.
- Subscribing to ~/world_stats: had no info about rtf; useless
- Gz stats. This thing never stops so I don't think I can call it with popen. One dirty workaround I did (that works but not good enough) is popen("gz stats -p -d 1"), which makes gz stats run for 1 second. Ideally, I want a command line arg that'll make gz stat show one line. I tried decimal seconds but those seem to round down (-d 0.5 would just print nothing)
- Manually calculating the RTF. I really don't want to do this unless I know the exact formula the Gazebo GUI uses to calculate the RTF. I don't know how long it polls for.
So tl;dr, I either would want to have a way to run gz stats for one line (and not for one second), the exact algorithm/formula that the Gazebo GUI uses to calculate RTF, or any things I am missing (I did look through all Gazebo topics that were published, but I might be missing some compilation flag for extra topics).
Any suggestions? Thanks!
Originally posted by csano on Gazebo Answers with karma: 3 on 2017-06-27
Post score: 0