Class MorphAgent

java.lang.Object
  extended by MorphAgent
All Implemented Interfaces:
IAgent

public class MorphAgent
extends java.lang.Object
implements IAgent

Implementation of IAgent for formation morphing algorithm.

Associated state is described in TreeAgentState

Since:
1.0
See Also:
TreeAgentState

Constructor Summary
MorphAgent()
           
MorphAgent(double lfRobotVelocity)
           
MorphAgent(MorphAgent src)
           
 
Method Summary
 boolean checkStateValidity(StateBundle state)
          checks that a particular discrete state is valid for this agent.
 void getMsgs(ILogicVarBundle state, IDiscreteDynamicsCallback dynCallback, double[] arrLfStateCont, double lfCurrTime, int nIdxStateOffset, java.util.Iterator<CommLink> channelsToSendOn)
           Given the state of an agent, and the channels it can send messages on, push the next set of messages onto the appropriate channels.
 IAgent makeCopy()
          in case the agent has some internal state, this allows syncrhonized wrapper calls to cache a snapshot of the agent at some rational point in time.
 void setGlobalFrameMode(boolean bMode)
           
 void setMotionParams(double lfVel, double lfTCom, double lfRad)
           
 void setShapeDesc(IMorphSpec shapeDesc)
          Override the default shape description (useful if switching between global and local algorithm modes)
 StateBundle updateState(ILogicVarBundle statePrev, double[] arrLfStateCont, double lfCurrTime, int nIdxStateOffset, IEnvironment env, java.util.Iterator<CommLink> channelsRecieveFrom)
           Given the previous state of an agent, and the channels to recieve messages from, recieve messages (destructively) and return new state (non-destructively).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MorphAgent

public MorphAgent()

MorphAgent

public MorphAgent(double lfRobotVelocity)

MorphAgent

public MorphAgent(MorphAgent src)
Method Detail

setShapeDesc

public void setShapeDesc(IMorphSpec shapeDesc)
Override the default shape description (useful if switching between global and local algorithm modes)


setGlobalFrameMode

public void setGlobalFrameMode(boolean bMode)

setMotionParams

public void setMotionParams(double lfVel,
                            double lfTCom,
                            double lfRad)

checkStateValidity

public boolean checkStateValidity(StateBundle state)
checks that a particular discrete state is valid for this agent.

Specified by:
checkStateValidity in interface IAgent

getMsgs

public void getMsgs(ILogicVarBundle state,
                    IDiscreteDynamicsCallback dynCallback,
                    double[] arrLfStateCont,
                    double lfCurrTime,
                    int nIdxStateOffset,
                    java.util.Iterator<CommLink> channelsToSendOn)

Given the state of an agent, and the channels it can send messages on, push the next set of messages onto the appropriate channels. Channels are assumed to be modified by this operation. One weakness of this signature is that it requires programmer discipline not to look at the continuous state of agents other then your neighbors.

Specified by:
getMsgs in interface IAgent
Parameters:
state - discrete component of agent state
arrLfStateCont - global vector of continuous state
nIdxStateOffset - offset into global state vector corresonding to this agent.
channelsToSendOn - Iterator containing objects of type CommLink CommLink corresponding to channels to send messages on (neighbor indices can be ascertained from channels).
Since:
1.0
See Also:
CommLink

updateState

public StateBundle updateState(ILogicVarBundle statePrev,
                               double[] arrLfStateCont,
                               double lfCurrTime,
                               int nIdxStateOffset,
                               IEnvironment env,
                               java.util.Iterator<CommLink> channelsRecieveFrom)

Given the previous state of an agent, and the channels to recieve messages from, recieve messages (destructively) and return new state (non-destructively).

Specified by:
updateState in interface IAgent
Parameters:
statePrev - previous state (do not modify)
arrLfStateCont - vector of all continuous states (do not modify)
nIdxStateOffset - offset into arrLfStateCont corresponding to start of this agents continuous variables
channelsRecieveFrom - iterator storing CommLink classes corresponding incoming channels
Returns:
new discrete state of agent
See Also:
CommLink

makeCopy

public IAgent makeCopy()
in case the agent has some internal state, this allows syncrhonized wrapper calls to cache a snapshot of the agent at some rational point in time. If the agent has no internal state, this function can just return "this".

Specified by:
makeCopy in interface IAgent