our implementation, the simplest types emitted by schemas are integer, floating point, and boolean scalar values. More complex types that have been implemented are the two-dimensional floating point vector and image types. The floating point vector may be used to encode any two-dimensional quantity commonly used by robot schemas, such as velocities and positions. The image type corresponds to the image structure used by the RoBIOS image processing routines.
Schemas may optionally embed other schemas for use as inputs. Data of the pre-defined primitive types is exchanged between schemas. In this way behaviors may be recursively combined to produce more complex behaviors.
In a robot control program, schema organization is represented by a processing tree. Sensors form the leaf nodes, implemented as embedded schemas. The complexity of the behaviors that embed sensors varies, from simple movement in a fixed direction to ball detection using an image processing algorithm. The output of the tree’s root node is used every processing cycle to determine the robot’s next action. Usually the root node corresponds to an actuator output value. In this case output from the root node directly produces robot action.
Behavior The behavioral framework has been implemented in C++, using the implementation RoBIOS API to interface with the Eyebot. These same functions are simulated and available in EyeSim (see Chapter 13), enabling programs created with the
framework to be used on both the real and simulated platforms.
The framework has been implemented with an object-oriented methodology. There is a parent Node class that is directly inherited by type-emitting schema classes for each pre-defined type. For example, the NodeInt class represents a node that emits an integer output. Every schema inherits from a node child class, and is thus a type of node itself.
All schema classes define a value(t) function that returns a primitive type value at a given time t. The return type of this function is dependent on the class – for example, schemas deriving from NodeInt return an integer type. Embedding of schemas is by a recursive calling structure through the schema tree. Each schema class that can embed nodes keeps an array of pointers to the embedded instances. When a schema requires an embedded node value, it iterates through the array and calls each embedded schema’s respective value(t) function. This organization allows invalid connections between schemas to be detected at compile time: when a schema embedding a node of an invalid type tries to call the value function, the returned value will not be of the required type. The compiler checks that the types from connected emitting and embedding nodes are the same at compilation time and will flag any mismatch to the programmer.
The hierarchy of schema connections forms a tree, with actuators and sensors mediated by various schemas and schema aggregations. Time has been discretized into units, Schemas in the tree are evaluated from the lowest level (sensors) to the highest from a master clock value generated by the running program.
331