# Simulation deteriorates over time, robot arms do not go to the same position

Hi! I'm currently running a ROS network (ROS Melodic, Ubuntu 18.04) using the ARIAC 2019 simulation interface. I have the competition going on a loop, and two UR10 arms that run on independent threads.

In the beginning of the Gazebo simulation, the robot arms pick up the parts on the conveyor belt just fine, but over time, they don't seem to go back to the same position. In fact, three minutes into the simulation, the robot arm hardly ever picks up parts even though it's the same code, just running on a loop. After checking the topic that contains the arms' joint states, I've come to the conclusion that the arm doesn't reach the same position as I'm specifying when publishing to the topic. Has anyone else experienced something similar? (i.e. after running a simulation on Gazebo where the robot actions are all looped/the same, the behavior is not consistent/deviates more and more away from expected/preferred behavior)

edit retag close merge delete

Sort by » oldest newest most voted

@luna, unfortunately that is the normal behaviour of Gazebo and other similar simulation enviroments. The way Gazebo and ODE works let the simulation to be unnacurate over time. The more time passed the more inaccurate Gazebo calculations are, but that is something inherent to the Simulation.

What you can do is to adjust the physics and physics engine params to test how you can improve over time the simulation. I am refering particularly to the SDF physics params ERP and CFM that are direcly related to the kd and kp params and are used to enhance the performance and stability of the simulation. And, on the other hand, you can try to adjust the SDF physics engine params, if you used ODE as the physics engine I am refering particularly to the min_step_size and the iters params, which you can increase to enhance the computations accuracy in detriment of the simulation performance (or the needed resources).

Those params can help you to achieve better results on the simulation, but as I said the more time the simulation is working the more unstable it will be due to the error accumulation on the different computations done in simulation time.

Regards.

more

Thank you for your response! That definitely makes sense, and is really unfortunate. I'm looking into the physics engine params right now. I just wanted to clarify-- would I be able to solve this issue with some sort of feedback loop/calibration mechanism? Based on the level of abstraction this problem seems to be occurring, it doesn't sound too likely that I will, but I just wanted to make sure.

( 2020-08-07 09:51:53 -0600 )edit

Mmm that indeed is a good idea @luna, but the problem is how to implement such thing. Corect me if I am mistaken but what you want is to produce a kind of feedback loop that attemps to fix this error accumulation dinamically on simulation time or at least to balance your commands depending of the simulation deviation error. The problem here is that you are trying to solve a problem that is not deterministic, in other words non lineal. Because you do not know how the errors are going to be and how the simulation is going to behave in a certain t in simulation time, maybe you are able to predict how the error in simulation is going to alter your robot behaviour but how you measure this and translate it to balance new commands is something that become a very complex task. I have never tried such ...(more)

( 2020-08-07 11:39:43 -0600 )edit

Thanks! You've given me a lot to think about in terms of improving my simulation. One last question-- do you know where the error in Gazebo calculations is accumulating? Is it error in calculating joint effort or just does the environment as a whole become intensely uncalibrated?

( 2020-08-07 12:53:03 -0600 )edit

Enviroment is not very important, what is important is the collision checking ODE performs in every sim cycle. The most important errors comes from the contraints: some "soft" and some "hard. This constraints can be violated with the introduction of unintentional errors. On the other hand, there is a inherent error accumulation in the joint relative position calculations. Extracted from ODE: "When a joint attaches two bodies, those bodies are required to have certain positions and orientations relative to each other. However, it is possible for the bodies to be in positions where the joint constraints are not met. This "joint error" can happen [...]". Since the force apply in simulation time does not always end with the joint in the proper position (due to calculations errors) the ERP apply a little force to the links in order to decrease this error and bring its bodies back into correct alignment. I ...(more)

( 2020-08-08 05:01:34 -0600 )edit