Linking Agents to Entities

EIS Environments expose a set of entities that can be controlled by one or more agents. Each entity is associated with a unique identifier (name), a type and an associated set of actions and perceptions. Information about the actions and perceptions available for each entity / entity type is not available through EIS, but is instead is normally described in the supporting documentation for each environment.

To link an agent to an entity, all you need is the name of the entity and, where more than one environment is involved, the id of the environment. Linking an agent to an entity is supported through three EIS API actions:link(), link(entity), link(envId, entity). The first of these actions links the agent to an entity in the default environment with the same name as the agent; the second action links the agent to an entity in the default environment with the provided entity name and third action links the agent to an entity in the specified environment with the given entity name. To illustrate this, the program below links the agent to the gripperentity in the default environment (as we only use one environment in this example) which is the TowerEnvironment.

  package examples;
  
  agent Tower {
      module EISAPI eis;
      
      initial !init();
      
      rule +!init() {
          eis.launch("tower", "towerenv.jar");
          eis.join("tower");
          eis.link("gripper");
      }
  }