Single stepping - ways to speed it up?
I'm trying to get gazebo and Simulink to play nicely together. The primary issue is that Simulink runs an integrator, gazebo also runs an integrator, and there's no obvious way to make sure the two are stepping in sync with each other.
So I'm starting gazebo paused (-u command line argument). I've written a Simulink S-function (essentially a C plugin to Simulink) that sends a world control command to gazebo that tells it to take a single, fixed-length time step. I've also written a gazebo plugin - a handful of plugins, actually - that respond to a topic message that originates inside Simulink with a dump of the current simulation state. Thus, as a (to Simulink) atomic action, I can get gazebo to single-step and then send a series of topics that report the full state to Simulink, before Simulink takes its next time step.
As long as the stepsize in gazebo and Simulink are fixed and consistent, this works like a charm. With one exception: it's DOG SLOW. it is about 100x slower than realtime.I've turned off alomst all collision checking, I've tried running headless, I've done everything else I can think of to speed it up. No dice.
The identical gazebo simulation, left on its own to free-run, runs faster than realtime. So clearly there's either something either in my topic exchange protocol or in the process of gazebo single stepping, that makes this really inefficient. It does not appear to be on the Simulink side, eg the Simulink code isn't that slow.
Any ideas?