In this post we will take a look at robot simulators and physics engines which should be discussed together.
Robot Simulator:
Basically a robot simulator is a computer program that facilitates building and testing of robots in a virtual environment.
Some key points:
Firstly, robot simulators help save great deal of time and money by elimination of physical prototypes and testing, at least during a major part of the design except the very last stages. Errors can be corrected, the simulations and tests can be reset, and any desired changes can be made far more easier than in real world for all aspects of the robot such as its sensors, actuators, kinematics, operating algorithms and control systems. Benefits are even further multiplied when building and testing multiple robot systems which may also be required to interact with each other and the system behavior must be coordinated.
It is important for a simulator to mimic real world as closely as possible, at least to a degree of simulating real life variables which will affect robots’ operation. This is done by a physics engine which is the core component of a robot simulator. It will be described in more detail below.
The robot simulator must integrate well with the actual operating system ( such as ROS etc…) that the robot will run on in the real world.
There are open source simulators. Using these have the advantages of not only cost but the possibility of being able to receiving inputs or at least discuss the process with far greater number of people.
One of the most beneficial aspects of using a robot simulator is to be able to train the AI far more easier than real world. Such training need a lot of trials and errors which can be performed much faster with a simulator.
Another advantage of using robot simulators is safety. Especially an incomplete robot’s operation may carry higher safety risks, even if all precautions are taken. Using a simulator eliminates such risks.
Real time ( or near real time) simulation and testing is also possible with simulators which means that the simulation runs at the same speed of the actual system.
Pysics Engine:
Simulators include a physics engine which is their key component. A physics engine tries to imitate real world by having virtual objects and environment interact within the boundaries of defined physical laws and constraints. Velocity, acceleration, position, mass of objects, collision detection and response, friction, rotations, kinetic and potential energy, their conversion into each other and conservation of energy concepts must all be represented within certain imposed constraints, with necessary mathematical functions, matrices, differential equations, numerical methods (methods which approximate solution to a complex system by enabling us to avoid very complex differential equations, by dividing the system into much smaller parts all of which can be solved easily and then their solutions are combined), within a coordinate system. As more advanced options, any soft bodies and their deformations, or even fluids may also need to be represented. So basically a physics engine is a mathematical model with variables representing a state of a system at a given instant. The simulation of the state of the system over time is of course ongoing which means all of these are continuously updated over time, which is done by numerical integration methods.
The author of this article, who is a civil engineer, can tell about a similarity here with structural analysis, which might reinforce understanding here. For example in structural analysis, when representing structural behavior under earthquake action over time, the state of the structure is also continuously updated by numerical integration methods, based on the forces on the structure and the structure’s stiffness at that instant (i.e. the equation [F]=[K][X] is continuously updated, where [F] is the global force matrix, [K] is the global stiffness matrix and [X] is the global displacement matrix of the structure. So this matrix is solved continuously within each small time increment ( i.e. 0.1 second). And the constraints as mentioned above in this case are the reaction forces provided by supports ( i.e. foundation) of the structure.
A. Tuter