1 / 13

Evolutionary Robotics Physical Simulation in 3D Computer Graphics

This program simulates evolutionary robotics using physical simulation and 3D computer graphics. It allows the user to define the properties of objects, their attachments, and simulate their movement through time. The simulation includes the computation of forces, collision detection, and the ability to sense and move objects using sensors and motors.

potterd
Download Presentation

Evolutionary Robotics Physical Simulation in 3D Computer Graphics

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Evolutionary Robotics Physical Simulation 3D Computer Graphics • Define the position, orientation, shape, mass and friction properties of each object. • Define how objects are attached together. • Start the simulation: • Define the position, orientation, and shape of each object at time t. • Render. • Define the position, orientation, and shape of each object at time t+1. • … Force = mass * acceleration (F=MA)  acceleration = Force / mass

  2. Evolutionary Robotics Preliminaries (From ode\demo\demo_boxstack.cpp) dInitODE2(0); world = dWorldCreate(); space = dHashSpaceCreate (0); contactgroup = dJointGroupCreate (0); dWorldSetGravity (world,0,0,-GRAVITY); dWorldSetCFM (world,1e-5); Initialize Open Dynamics Engine contains all the objects contains all the objects that cannot interpenetrate contains all the objects that are in contact Has to do with friction; don’t worry about for now.

  3. Evolutionary Robotics Bodies from http://artis.imag.fr/Membres/Xavier.Decoret/resources/ode/tutorial1.html Object has a density of ‘1’ Object is a 1x1x1kg box Object has a mass of 0.2kg. Object starts at position (x=0,y=6,z=0)

  4. Evolutionary Robotics y y x x z z Bodies – specifying orientation in 3D Usually requires four numbers: First three define axis along which object lies; Fourth specifies how much the object is rotated about that axis. Encoded as a quaternion: q = cos(/2) + (x1,y1,z1)sin(/2) If object is a cylinder we can specify orientation with 3 numbers: dMatrix3 R; dRFromZAxis(R,x1,y1,z1); dBodySetRotation(body,R); If object is a sphere… ?

  5. Evolutionary Robotics Geoms – specifying how bodies interact with other bodies space 2 space 1 # pairs? # pairs? • To keep objects from colliding: • Compute the distance • between each geom pair. • If distance<=0, push the • bodies apart proportional • to the interpenetration space # pairs?

  6. Evolutionary Robotics y y x x z z Joints – specifying how bodies move relative to each other dJointID hinge; hinge = dJointCreateHinge (world,0); dJointAttach (hinge,body[0],body[1]); dJointSetHingeAnchor (hinge,0,0,1); dJointSetHingeAxis (hinge,x1,y1,z1); Define a hinge joint data structure. Create a hinge joint data structure. Which objects does the joint connect? Where is the joint’s fulcrum? When the objects move relative to one another, what 2D plane do they define? The plane that is perpendicular to vector (x1,y1,z1).

  7. Evolutionary Robotics y x static void nearCallback (void *data, dGeomID o1, dGeomID o2) { int i; // exit without doing anything if the two bodies are connected by a joint dBodyID b1 = dGeomGetBody(o1); dBodyID b2 = dGeomGetBody(o2); if (b1 && b2 && dAreConnectedExcluding (b1,b2,dJointTypeContact)) return; z axis=(0,1,0) . . . fulcrum=(0,0,0) Contacts – what happens when two objects collide? Continue… Return…

  8. Evolutionary Robotics Contacts – what happens when two objects collide? . . . Describes the forces that arise at each contact point dContact contact[MAX_CONTACTS]; // up to MAX_CONTACTS contacts per box-box for (i=0; i<MAX_CONTACTS; i++) { contact[i].surface.mode = dContactBounce | dContactSoftCFM; contact[i].surface.mu = dInfinity; contact[i].surface.mu2 = 0; contact[i].surface.bounce = 0.1; contact[i].surface.bounce_vel = 0.1; contact[i].surface.soft_cfm = 0.01; } . . . MAX_CONTACTS = 4

  9. Evolutionary Robotics y x z Contacts – what happens when two objects collide? . . . if (int numc = dCollide (o1,o2,MAX_CONTACTS,&contact[0].geom, sizeof(dContact))) { for (i=0; i<numc; i++) { dJointID c = dJointCreateContact (world,contactgroup,contact+i); dJointAttach (c,b1,b2); } } . . . . . . Contact joint(lasts one time step) Hinge joint(lasts all simulation)

  10. Evolutionary Robotics simLoop – updating the physics, and updating the graphics static void simLoop (int pause) { dSpaceCollide (space,0,&nearCallback); if (!pause) dWorldQuickStep (world,0.02); dJointGroupEmpty (contactgroup); dsSetColor (1,1,0); drawGeom (obj[i].geom[j],0,0,show_aabb); } . . . Find out who collided . . . Update the positions and orientations of all objects . . . Delete all contact joints . . . Draw all objects . . .

  11. Evolutionary Robotics Sensors – Allowing the robot to sense in ODE… Simulating a touch sensor in nearCallback, dCollide(obj2,floor)==true? Simulating a light sensor obj4 const dReal posObj1 = dBodyGetPosition(obj1); const dReal posObj4 = dBodyGetPosition(obj4); double lightLevel = EuclideanDistance(posObj1,posObj4)

  12. Evolutionary Robotics  = 60o Motors – Allowing the robot to move in ODE…  = 40o  = 20o error = 60 error = 40 error = 20 The maximum force the joint can handle. dJointSetHingeParam(joint,dParamFMax,motorForce); double desiredAngle = 60; double actualAngle = dJointGetHingeAngle(joint); double diff = desiredAngle – actualAngle; dJointSetHingeParam(joint,dParamVel,diff); Apply force to rotate the leg to 60 degrees forward. What angle is the joint at now? How much difference is there? Apply force proportional to how far the joint is from where it should be.

  13. Evolutionary Robotics Neural networks – connecting sensors to motors.  = -90 – 20 = -110o  = 60o M1 T2 T2 T1 T1 next time step…

More Related