Robotics StackExchange | Archived questions

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 realtimeupdaterate and maxstepsize. I found that you can set the realtimeupdaterate 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 maxstepsize and ROS rate in my calculation process to speed things up in sync. So, I increase maxstepsize 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.

Asked by lucas on 2016-03-10 16:51:54 UTC

Comments

Can you post your code so we can take a look?

Asked by pcdangio on 2016-03-21 12:32:57 UTC

Answers

I seem to have fixed the problem I was running into.

I was under the impression that when increasing the gazebo speed via max_step_size and real_time_update_rate, that I also needed to increase my Rate size inside of my ROS loop where it uses the sleep function to keep up with it.

After I reset my rate size back to its original value, things seem to be working. Or, at least, it's working up to a certain point. I got to a 20x speedup. Above that and new problems start to pop up, but those would be for a different question.

Asked by lucas on 2016-03-25 13:46:40 UTC

Comments