SCL Tutorial 2


Terminal output: Testing conservation of energy during physics simulation

Goal : Set up a physics simulator

This tutorial aims to introduce you to SCL's physics integration features. You also will learn how to test whether your simulation is accurate.

Step 0 : Compile and run tutorial

Follow the README.txt.

Step 1 : Set up data structures and dynamics class

Use the RRRCfg.xml file. Code is very similar to earlier tutorials.

Step 2 : Integrate the robot's physics

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.

References and Links

Operational Space Control Math Tutorial: 3-dof and 6-dof chain robots.


Q1 : Study effect of integration timestep

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.

Q2 : Why do integrator errors arise

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?

    © Samir Menon. CCA 3.0 license.
    Valid HTML and CSS.
    Last updated on Sep 2nd, 2014