how to speed up gazebo simulation?
I'm working with the panda_gazebo package to control the 7-dofs franka manipulator, using the cartesian velocity controller of ros_control. For computational constraints, I have to slow down the gazebo simulation, settting real_time_update_rate from 1000.0 to 100.0 and max_step_size from 0.001 to 0.01. That's to keep a real time factor of 1. Consequently, the PID controller frequency of the manipulator has been set from 1Khz to 100Hz. The original PID values of the velocity controller working at 1Khz are as follows:
# Panda SDK Controllers: Velocity --------------------------
velocity_joint_velocity_controller:
type: panda_sim_controllers/PandaVelocityController
topic: /panda_simulator/motion_controller/arm/joint_commands
joints:
panda_joint1_controller:
joint: panda_joint1
pid: {p: 10, i: 0.0, d: 0.1}
panda_joint2_controller:
joint: panda_joint2
pid: {p: 100, i: 1.0, d: 0.1}
panda_joint3_controller:
joint: panda_joint3
pid: {p: 0.05, i: 0.0, d: 0.01}
panda_joint4_controller:
joint: panda_joint4
pid: {p: 0.5, i: 0.01, d: 0.1}
panda_joint5_controller:
joint: panda_joint5
pid: {p: 1.0, i: 0.0, d: 0.01}
panda_joint6_controller:
joint: panda_joint6
pid: {p: 0.05, i: 0.0, d: 0.01}
panda_joint7_controller:
joint: panda_joint7
pid: {p: 0.05, i: 0.0, d: 0.01}
These parameters works fine for the simulation running at the 1Khz, but as soon as the frequency turns to 100Hz, I'm not able to control the manipulator anymore. Indeed, it starts moving randomly even when no commands are being sent at all.
I know a popular technique to manual tuning PID values is to increase Kp as much as possible, then working on Kd and finally Ki. There is also a pid_tuning package available.
However, I wasn't any luck with those approaches.
Knowing the correct parameters at 1Khz, I'm pretty sure there should be a rule of thumb to make those values work at 100Hz. I've tried to just multiply/divide them by 10, since I'm now operating at 1/10th of the frequency, but again that approach failed.
The issue is you have created a bad physics simulation by making the time_step coarser. I doubt any amount of pid tuning is going to fix that.
I reduced the timestamp because I need to work in real time but my machine doesn’t bear 1Khz. Are there other strategies to reduce the gazebo high-resource demanding or it’s a dead end project?
I edited your title to make it more general.
Is there any tutorial explaining how to fix a broken gazebo simulation?
@underscoredavid Not that I'm aware of. It's a very difficult problem, because the input files are complex and there are so many possible configurations.
A common strategy is to start from a working simulation, and test each incremental change you make - that tends to help you narrow down where to look for the problem.