SCL Tutorial 3

scl.git/tutorial/scl_tutorial3_graphics_physics_cmake/

Video: SCL simulates an RRRR robot.

Goal : Simulate articulated body physics with graphics

This tutorial aims to introduce you to SCL's simulation features. It also renders the physics simulation using chai graphics (developed by Francois Conti).


Step 0 : Compile and run tutorial

Follow the README.txt file in the directory. Note that this tutorial uses a more advanced build system, cmake, which autogenerates makefiles. The overall setup is simpler and does not recompile un-necessary files. Look inside the xml file to see the graphics specifications.

Step 2 : Initialize the usual + graphics

In addition to the usual intialization code, this tutorial also intializes graphics and a glut window. The graphics code calls the actual drawing functions. Glut provides a window within which to draw stuff.

  /******************************ChaiGlut Graphics************************************/
  glutInit(&argc, argv); // We will use glut for the window pane (not the graphics).

  flag = p.readGraphicsFromFile("./RRRRCfg.xml","rrrrgraphics",rgr);
  flag = flag && rchai.initGraphics(&rgr);
  flag = flag && rchai.addRobotToRender(&rds,&rio);
  flag = flag && scl_chai_glut_interface::initializeGlutForChai(&rgr, &rchai);
  if(false==flag) { std::cout<<"\nCouldn't initialize chai graphics\n"; return 1; }

Step 3 : Integrate physics with the graphics

This is the same as the previous tutorial. Note that in addition the program has two threads. One thread runs the physics and the second runs the graphics and gui. This isn't particularly thread safe however, since the shared data is not locked. There might be race conditions but since there is only one writer (the physics) the worst that will happen is once in a while the graphics will read garbage data. You might see the screen flicker (don't worry about it).


References and Links

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




Assignment


Q1 : Integrating physics for complex robots

On completing the assignment in the previous tutorial, you probably found that the integrator starts to drift for some settings. The simple robot, however, doesn't properly test the physics integrator's abilities. Instead, re-run the analysis while adding more degrees of freedom to the robot specification. You must re-run the analysis for atleast 5 different degree-of-freedom specifications. i.e., say robots like RRR, RRRR, RRRRPR, R6, R4P2R3.

Append more degrees of freedom by adding more rigid bodies to the xml file. Make sure to add them to the end of the chain. i.e., specify the parent link to be the leaf link in the current chain. Also make sure to give each link and each joint a unique name. You may make your life easy by writing some matlab/python/js code to print out the appropriate xml spec.

For each robot, find settings that limit the energy error to less than 1% across a 10second long simulation.

Extra Credit : Enabling collisions in the simulation environment dramatically increases the energy error. Unfortunately, this remains a challenging research problem. Discuss ways in which you could mitigate the effect of such physics errors on your (future) controller tests.




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