I have been going through the ARGoS source code trying to understand how a robot (along with it's sensors and actuators) is defined and instantiated in the simulator. As far as I can tell, entities whether they are inanimate blocks or complex robots are not treated any differently by the simulator. Rather what is happening is that these entities inherit certain characteristics such as being controllable and embodying simulated space etc.
From what I (think I) have learned, it seems that robots in the simulator are defined using the following components/definitions:
- The controller - defined in dynamically linked shared library defines the behaviour of the robot. during the initialisation (Init method) of the robot it requests references (pointers) to it actuators and sensors which are stored within an instance of that controller. During each step (ControlStep method) the controller can read the sensors and update the values of the actuators via the stored pointers in that instance.
- The experiment file - an XML document which is passed to ARGoS on the command line. Amongst many other things, this file defines configurable type instances of the aforementioned controller, which are parametrised via XML attributes. The sensors and actuators used in the controller are instantiated as this configuration file is parsed. If the controller requests references to sensors or actuators which have not been declared in the XML, the simulator throws an exception.
- Features and Properties
- Entities, the way in which each robot seems to be able to interact with the simulated world seems to be using the entity class (incl the inheritance hierarchy) definitions. For example all of the implemented robots have a class which derives from an EmbodiedEntity and a ComposableEntity. The EmbodiedEntity defines the shape of the robot in terms of how it occupies the simulated space. I'm uncertain what the ComposableEntity represents. (attached diagram for inheritance hierarchy).
- Physics, for each robot (more generally entity) type a physics engine is specified in the XML experiment file. It seems that for this physics engine to interact with an entity, each entity type must also specify a model which inhertits from the PhysicsEngineEntity.
- Sensors, for each robot there is a base class which defines the type C<Robot>Sensor, and each sensor implemented on the robot inherits from this base class.
- Actuators, same as the sensors
- Rendering definition, each robot defines an OpenGL model class which is used for the OpenGL and POVRay Rendering modes.
I haven't quite figured out how the names in the XML link into all these classes (i.e. how attribute assigning the footbot to a physic engine e.g. engine id="dyn2d" links to the class CDynamics2DFootBotEntity), I assume that there is some tag which is stored as const string with each class as it is registered as a plugin during the simulators initialisation.
Anyway I'll be interested to know whether I am understanding everything here, so feel free to let me know if I'm completely wrong about any of this.
Cheers
-mallwright