## The Simulation Pipeline

During the past two weeks we have started developing the real-time 3D physics simulation of the robot and its control.

The first step in this endeavor was to find the best tools to simulate Jacobian in a virtual environment.

Physics simulation involves:

a) Mass / Inertia – each part (limb) of the robot has mass and an intertia moment “tensor” relative to the joint it is attached to

b) Joints – these are the servo hinges in the case of our robot – joints need to have simulated motors that apply torque through complex combination of friction and power. Joints also need to have limits as in the physical limited movement of the robot’s joints

c) Collision – the robot’s limbs can collide with the floor and with each other. Physics simulators have a real tough time dealing with collision of complex objects. Ideally each part of the robot that has mass/inertia, will be composed of a collidable mesh of triangles, the same triangle mesh that is used to draw it in 3D.  This kind of collision framework is called “convex object” collision or “mesh object” collision. This way when the robot parts collide with something on the screen, it will be precisely represented by a physically simulated collision. (Remember that the 3D mesh drawn on the screen has nothing to do with the physics simulation happening invisibly behind the scenes). Each time a triangle collides with something (such as another triangle of another robot limb object or floor or wall), the collision is detected and an impact force vector is applied to the mass/inertia relative to its center-of-mass. In video games, usually collisions are not calculated based on the mess of the 3D object. Instead, simplified collision proxies are used for the purpose of identifying collision so for example a 3D shoe may be represented by 2-3 boxes when it comes to interacting with the simulated environment. This may be good enough visually for video games but for our purpose we need a bit more details if this simulation is going to be a verbatim representation of the natural occurrences in Jacobian’s robotic life.

So we need to look for tools:

1) 3D rendering engine for some eye candy

2) A physics parameters editor that will allow us to see the 3D objects and edit their physics parameters mentioned above.

3) A physics engine that will simulate Jacobian to high degree of precision in real-time. Our objective is to run Jacobian at 100Hz. That means that the physics simulator needs to calculate where Jacobian’s limbs need to be at 100 times per second while applying motor torques, gravity and collision impact forces.

After some research (Excel Document) the PhysX engine was elected has the better physics engine for our budget. For rendering it was decided that a custom small OpenGL application would suffice.

We did not find a physics editor that fulfilled all the requirements (except for ezPhysics but the code is too old to revive it in short timeframe). The solution is a combination of SolidWorks as a visual editor and physics parameters calculator, and PhysX engine that comes with a demo GUI environment that proved to be quite effective for our modest 3D needs.

SolidWorks will export files in the form of Collada 1.4 standard (see picture). However upon several tests this option proved unreliable mainly by the lack of support from the Colloda export tool for SolidWorks. We eventually disregarded this necessity by simply sampling the correct values from SolidWorks into PhysX by hand.