65 class SimulatorInterface;
232 bool addGoal(
size_t goalSet,
size_t goalID,
Goal * goal );
242 const Goal *
getGoal(
size_t goalSet,
size_t goalID );
The transition between BFSM states.
Definition: Transition.h:67
The basic state of the behavior finite state machine.
Definition: State.h:123
The full description of the behavioral finite state machine.
Definition: FSMDescrip.h:84
State * getNode(size_t id)
Get the pointer for the node with the given identifier.
Definition: FSM.h:186
The core namespace. All elements of Menge are contained in this namespace.
Definition: AgentGenerator.cpp:43
void finalize()
Finalize the FSM.
Definition: FSM.cpp:299
void collectTasks()
Collects all tasks from the FSM elements.
Definition: FSM.cpp:85
const Agents::SimulatorInterface * getSimulator() const
Retrieve the simulator.
Definition: FSM.h:304
std::vector< VelModifier * > _velModifiers
A list of velocity modifiers to be applied to all states in the simulator.
Definition: FSM.h:384
void computePrefVelocity(Agents::BaseAgent *agent)
Computes the preferred velocity for the given agent based on the FSM's record of which state the agen...
Definition: FSM.cpp:140
FSMException(const std::string &s)
Constructor with message.
Definition: FSM.h:97
A set of goals. Maps integer identifiers to instances of goals.
Definition: GoalSet.h:63
The base, abstract class defining goals.
Definition: Goal.h:110
std::map< size_t, GoalSet * > _goalSets
Mapping from goal set identifier to GoalSet.
Definition: FSM.h:379
size_t getNodeCount() const
Reports the number of states in the FSM.
Definition: FSM.h:202
bool doStep()
Update the fsm state by one time step.
Definition: FSM.cpp:258
const Goal * getGoal(size_t goalSet, size_t goalID)
Retrieves the given goal from the given goal set.
Definition: FSM.cpp:205
FSM(Agents::SimulatorInterface *sim)
Constructor.
Definition: FSM.cpp:62
Exception thrown when the FSM has an error which cannot be recovered from.
Definition: FSM.h:106
~FSM()
Destructor.
Definition: FSM.cpp:68
The base definition for exceptions in Menge.
size_t getTaskCount() const
Returns the number of registered tasks.
Definition: FSM.h:314
The basic simulator interface required by the fsm.
Definition: SimulatorInterface.h:66
bool addGoal(size_t goalSet, size_t goalID, Goal *goal)
Adds a goal to the indicated goal set.
Definition: FSM.cpp:196
void setAgentCount(size_t count)
Initializes the memory required for the number of agents included in the FSm.
Definition: FSM.cpp:117
void addTask(Task *task)
Adds a task to the set.
Definition: FSM.cpp:103
Generic base class for FSM exceptions.
Definition: FSM.h:85
std::vector< State * > _nodes
The states in the BFSM.
Definition: FSM.h:369
Base exception class for menge operations.
Definition: MengeException.h:58
FSMFatalException(const std::string &s)
Constructor with message.
Definition: FSM.h:118
Base context for finite state machine elements.
Definition: FsmContext.h:71
bool allFinal() const
Reports if all agents are in final states (i.e. the simulation is done.)
Definition: FSM.cpp:248
void addVelModifier(VelModifier *v)
Add an velocity modifier to the FSM.
Definition: FSM.h:346
Agents::SimulatorInterface * _sim
The simulator on which the FSM acts.
Definition: FSM.h:352
Templated class for the behavior finite state machine.
Definition: FSM.h:126
size_t getAgentStateID(const Agents::BaseAgent *agent) const
Reports the state the given agent is currently in.
Definition: FSM.cpp:236
void advance(Agents::BaseAgent *agent)
Advances the FSM based on the current state for the given agent.
Definition: FSM.cpp:129
Base class for fatal exceptions.
Definition: MengeException.h:99
The namespace contains the Behavior Finite State Machine (BFSM) definition.
Collection of convenient pre-compiler information for fsm definitions.
friend FSM * buildFSM(FSMDescrip &fsmDescrip, Agents::SimulatorInterface *sim, bool VERBOSE)
Templated function which builds the behavior fsm from the behavior configuration given.
Definition: buildFSM.cpp:72
FsmContext * getContext()
Returns the BFSM Context for this FSM.
Definition: FSM.cpp:306
Interface for basic FSM task.
Definition: Task.h:110
std::map< size_t, GoalSet * > & getGoalSets()
Returns the goal sets defined in the simulator.
Definition: FSM.h:337
Defines the basic agent properties and functionality that all simulation agents share.
Definition: BaseAgent.h:123
void doTasks()
Performs the work in the FSM's tasks.
Definition: FSM.cpp:284
const GoalSet * getGoalSet(size_t goalSetID)
Retrives the given goal set.
Definition: FSM.cpp:214
The base class for modifying preferred velocities.
Definition: VelModifier.h:110
State * getCurrentState(const Agents::BaseAgent *agt) const
Gets a pointer to the state the agent is currently in.
Definition: FSM.cpp:230
State ** _currNode
The active state for each agent in the system.
Definition: FSM.h:364
The definition of behavior finite state machines.
size_t _agtCount
Number of agents attached to the state machine.
Definition: FSM.h:359
FSMException()
Default constructor.
Definition: FSM.h:90
FSMFatalException()
Default constructor.
Definition: FSM.h:111
The namespace that contains the basic simulation mechanisms.
std::vector< Task * > _tasks
The set of tasks to perform at each time step.
Definition: FSM.h:374
size_t addNode(State *node)
Adds a state to the BFSM.
Definition: FSM.cpp:175
bool addTransition(size_t fromNode, Transition *t)
Adds the given transition to the FSM.
Definition: FSM.cpp:187
void setCurrentState(Agents::BaseAgent *agt, size_t currNode)
Sets the current state for the given agent.
Definition: FSM.cpp:223