This tutorial aims to introduce you to SCL's physics integration features. You also will learn how to test whether your simulation is accurate.
Follow the README.txt.
Use the RRRCfg.xml file. Code is very similar to earlier tutorials.
The code sets up two for loops. The outer loop sets the number of iterations. The inner loop actually integrates the physics given a dt (0.001s here). Note that SCL uses Standard International (kg, m, s) units everywhere. Also note that the sum of the kinetic and potential energy is conserved, as it should be.
for(long n_iters = 10000; n_iters < 500000; n_iters *= 2 ){ //Compute total energy before the physics is integrated for( long ii=0 ; ii < n_iters ; ++ii ) { dyn_tao.integrate(rio,dt); } //Compute total energy after the physics is integrated and print the difference. }
Also note that this specific instance uses the tao physics engine. SCL supports tao (written by members of the Khatib lab) as well as the newer scl_spatial physics. It also supports dynamics3d (written by Francois Conti), which includes some great new articulated body contact dynamics. Please contact Samir for more details.
Operational Space Control Math Tutorial: 3-dof and 6-dof chain robots.
The basic (tao) integrator used in this example is not very accurate. It is a forward Euler integrator. As such, the integrator's accuracy relies on the timestep dt. Change dt to span a range from 1 microsecond to 10 milliseconds. Plot the energy change as a function of timestep and integration length.
You should now be familiar with the tradeoff between integration parameters. What potential problems could arise if you test your controller with a physically inaccurate simulation environment?
HINT : Many existing physics simulators add damping to stabilize the integration process. How would this affect your control tests?