Design and implementation

The software was designed to be a simple simulator (or even the simplest, if needed) in which agents are capable of navigating in an environment populated with solid objects, and of interacting with these objects using articulated arms. The agents can grasp some of the objects with their arms and move them relative to their body, carry them from place to place in the environment, explore them haptically and visually. The agents have sensors for vision, proprioception, and also tactile sensors distributed on the surface of their body. As effectors, agents can control the angles of their joints. Agents may also have "rockets" that allow them to move in the 2D space.

Simplicity was desired because it implies computational efficiency (rapidity in simulations) and stability in operation. A simple simulator can also be extended, as needed. Computational efficiency is very important if the simulator is used with evolutive methods, where many generations of agents have to be tested repeatedly in the environment.

Dimensionality of the space. The simplest physical environment that fits our purposes has a two-dimensional (2D) space. A 2D simulation is computationally much simpler / faster than a 3D one, but retains the needed features of the environment (spatial relations, the discreteness of the objects). The simulator was implemented in 2D, but can be extended to 3D in the future.

Objects. The simulated environment may contain solid articulated agents and other solid objects. We used as solid primitives circles and capped rectangles (rectangles having two opposite sides capped with semicircles). These primitives were chosen for the computational simplicity of detecting the contact between.

The objects in the environment or the parts of the articulated agents may be composed of a single solid primitive, or of several primitives bound together to form a composed object.

Dynamics. For computational efficiency, we have not used an environment implementing the Newtonian dynamics of the real world F=m a, but an environment with a simplified, Aristotelian (quasistatic) dynamics, which obeys the law F=m v. The velocity of an object directly depends on the force applied to the object. There is thus no inertial movement: a body moves as long a force is applied to it, but it immediately stops if no force moves it. Objects cannot be thus thrown in the environment simulated by Thyrix, they stop after the contact ceases, as in the real word they would stop if confronted with a large friction force. This is a radical change from the laws of real physics. However, this difference is not essential from a cognitive point of view. Actually, many noneducated humans believe that the real world obeys Aristotelian laws: in elementary physics courses, children must be unteached the Aristotelian principles, sometimes with great pain. Besides balls or other small objects thrown or kicked in the air or water, or on the surface of ice or other smooth surfaces, most other objects around us stop after one ceases pushing or pulling them, because of friction.

There are several computational advantages of using Aristotelian dynamics versus classical dynamics. The computation and integration of dynamical quantities are slightly simpler. We have no collisions to deal with, but only contacts. The treatment of friction is much simpler: dynamic friction in Aristotelian physics is equivalent with static-only friction in real (Newtonian) physics, and thus much easier to simulate computationally. Dynamic friction in real physics can yield configurations that are inconsistent or intractable computationally, and may require not only contact forces, but also contact impulses (besides collision impulses). The movement of objects in the environment are mainly initiated by the agents, so we can optimise the computations by not updating on each cycle objects that are out of the reach of the agents.

Contacts. The simulator detects and resolves the contact between the objects. The contact detection is integrated with the updating of the haptic sensors of the agents. The contact may be coupled with friction, if needed. For contact resolution, with or without friction, we have implemented a fast algorithm devised by Baraff.

Articulations. The articulated agents have a body and one or more tree-shaped articulated limbs connected to the body. Each link of the articulated limb can rotate relative to the joint; the rotation angle can be limited to a predefined range.

The simulator does not allow loops in the structure of the articulated agent, because of the algorithm used. We have implemented a modified Featherstone-type algorithm, which allows the fast simulation of the dynamics of a chain of N articulated links in a computational time linearly proportional with N. Our implementation was based on the implementations described by McMillan. We have changed the algorithm to comply with the characteristics of our environment (2D, rather than 3D; and Aristotelian dynamics, rather than Newtonian). The algorithm uses the so-called "spatial notation", where the corresponding angular and linear components of velocity, acceleration and force are combined in a single vector. In 3D, these vectors are 6-dimensional, with 3 angular components and 3 linear components. In 2D, these vectors are 3-dimensional, with one angular component and 2 linear components. We have also changed the algorithm to allow contact resolution for the parts of the articulated body.

Performance. The simulator can easily attain a faster than real time performance on a common PC, even if the agents interact with several objects and tens of objects populate the environment.

Portability. The simulator has a graphical user interface developed with wxWidgets, thus being easily ported to any major operating system (including Windows, Linux, and MacOS).