How to speed up Gazebo and keep a ROS processing node in sync with it?
I have a simulation that I am trying to speed up, and I was hoping someone here could give me some guidance.
I am using Gazebo to run a quad-copter. Using a separate node in ROS, I pull an image from the quad-copter camera, perform some calculations on that image, and issue move commands back to the quad-copter in Gazebo. The problem is, I need these to stay relatively in sync. Each time my process sends a move command to the quad-copter, I want the move distances to be relatively the same.
For my calculation process, I make use of the ROS Rate class. In my calculation process, I initially had a rate of 50 when I was running the simulation at normal speed, and everything was working fine.
Now, when trying to speed it up, I'm not completely clear on how to get to a max simulation speed. I have figured out how to speed up Gazebo using real_time_update_rate and max_step_size. I found that you can set the real_time_update_rate to 0 and Gazebo will attempt to run as fast as it can. However, the rate in my calculation process caused the movement to be erratic. It seemed to take too long to make decisions.
I am currently trying to solve this problem the following way. I am slowly increasing the max_step_size and ROS rate in my calculation process to speed things up in sync. So, I increase max_step_size to get a Gazebo speed of 2x, and I increase my calculation process to use a rate of 100 rather than 50. This works fine. However, I want to go as fast a possible. I've increased to 3x, then 4x, and I am continuing, but I am unsure of what the max rate that my calculation will be able to process or if ROS has a maximum rate it can run at.
So, I guess my real question is, is the best way to handle this to slowly increase the Gazebo speed and Ros rate until it breaks and then step back a step? Or, is there some other ROS and Gazebo functionality that I could use to make this work.
I figure this is a problem someone has solved before, and their solution is probably better than mine. So, can anyone offer a solution or advice? Thanks.
Can you post your code so we can take a look?