Class Iv4xrAgentState<NavgraphNode>

java.lang.Object
nl.uu.cs.aplib.mainConcepts.SimpleState
nl.uu.cs.aplib.agents.State
eu.iv4xr.framework.mainConcepts.Iv4xrAgentState<NavgraphNode>
Direct Known Subclasses:
MyAgentState, W3DAgentState

public class Iv4xrAgentState<NavgraphNode> extends State
Representing the state of an iv4xr agent. It extends the class State. As such, we can then attach a Prolog reasoner to this state. See State.

The new features of this class is that it also holds a representation of the state of the target world. This is represented as an instance of WorldModel. And, along with it it can also hold a navigation graph to facilitate automated navigation over the target world. The type paremeter NavgraphNode represents the type of the nodes in worldNavigation, or the type that is used to identify the nodes.

Author:
Wish
  • Field Details

    • worldmodel

      public WorldModel worldmodel
      Representing the current state of the target world.
    • worldNavigation

      public Navigatable<NavgraphNode> worldNavigation
      A navigation graph for navigating the the target world. Every node represent a physical location in the target world. When two nodes are connected by an edge, it means that there is a way to travel between them in the target world. You can use AStar to calculate a path between two nodes and use this path to guide an agent to travel between them.

      Note that Navigatable is only an interface; you will need a concrete implementation of this. An example of such an implementation is SimpleNavGraph.

      This class does not provide a method to construct a navigation graph. Something else must construct this graph, which you then can attach it to this state.

  • Constructor Details

    • Iv4xrAgentState

      public Iv4xrAgentState()
  • Method Details

    • env

      public Iv4xrEnvironment env()
      Description copied from class: SimpleState
      Return the Environment associated with the state.
      Overrides:
      env in class SimpleState
    • worldmodel

      public WorldModel worldmodel()
      Return the value in worldmodel.
      Returns:
    • worldNavigation

      public Navigatable<NavgraphNode> worldNavigation()
      Return the navigation-graph in worldNavigation.
    • setWorldNavigation

      public Iv4xrAgentState<NavgraphNode> setWorldNavigation(Navigatable<NavgraphNode> navgraph)
    • setEnvironment

      public Iv4xrAgentState<NavgraphNode> setEnvironment(Environment env)
      Link the given environment to this State. An instance of Iv4xrEnvironment is needed as the environment.
      Overrides:
      setEnvironment in class SimpleState
      Parameters:
      env - The Environment we want to associate with this state.
      Returns:
      The method simply returns this state to allow it to be used in the Fluent Interface style.
    • updateState

      public void updateState(String agentId)
      This will call the observe() method of the environment attached to this state to obtain a fresh observation, and then uses it to update this state. If worldmodel exists, this new observation will be merged into the worldmodel.
      Overrides:
      updateState in class SimpleState
    • loadSimpleNavGraph

      public static void loadSimpleNavGraph(Iv4xrAgentState<Integer> state, Mesh mesh)
      Covert the given surface-mesh into a navigation graph. More precisely, to an instance of SimpleNavGraph. Then the method attaches this navigation graph into the given agent-state.
    • loadSimpleNavGraph

      public static void loadSimpleNavGraph(Iv4xrAgentState<Integer> state)
      If the environment attached to the given state has a navigation/surface-mesh, this method converts the mesh into a navigation graph. More precisely, to an instance of SimpleNavGraph. Then the method attaches this navigation graph into the given agent-state.
    • loadSurfaceNavGraph

      public static void loadSurfaceNavGraph(Iv4xrAgentState<Integer> state, Mesh mesh, float faceAreaThresholdToAddCenterNode)
      Covert the given surface-mesh into a navigation graph. More precisely, to an instance of SurfaceNavGraph. Then the method attaches this navigation graph into the given agent-state.
    • loadSurfaceNavGraph

      public static void loadSurfaceNavGraph(Iv4xrAgentState<Integer> state, float faceAreaThresholdToAddCenterNode)
      If the environment attached to the given state has a navigation/surface-mesh, this method converts the mesh into a navigation graph. More precisely, to an instance of SurfaceNavGraph. Then the method attaches this navigation graph into the given agent-state.