VR-Forces 4.10 Class Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
humanFleeController.h
Go to the documentation of this file.
1 /*******************************************************************************
2 ** Copyright (c) 2015 MAK Technologies, Inc.
3 ** All rights reserved.
4 *******************************************************************************/
5 
9 
12 
13 #pragma once
14 
17 #include <vrfNavigation/navArea.h>
18 
21 class DtScriptedTaskTask;
23 class DtHumanFleePSR;
25 class DtVectorOutputPort;
28 
34 {
35 private:
42 public:
44  DtHumanFleeController(const DtString& name, DtVrfObject* owner,
45  DtSimManager* simManager, DtComponentDescriptor* desc=0, DtReaderWriterRegistry *parentRegistry=0);
46 
48  virtual ~DtHumanFleeController();
49 
51  virtual bool init();
52 
54  virtual const char* type() const;
55 
57  virtual void tick();
58 
63  static void fleeCallback(DtSimMessage * msg, void * usr);
64 
66  static DtSimComponent* creator(const DtString& name, DtVrfObject* owner, DtSimManager* simManager,
67  DtComponentDescriptor* desc=0, DtReaderWriterRegistry* parentRegistry=0);
68 
69 protected:
70 
72  virtual bool createPortGroups();
73 
75  virtual bool createPorts();
76 
77  virtual bool usingNavBot() const;
78 
79  virtual void processFleeTask(DtSimMessage * msg);
80 
82  virtual void registerTaskMsgCallbacks();
83 
84  static void navAreaChangedCallback(void* usr);
85  virtual void processNavAreaChanged();
86 
89  virtual std::list<DtVector> getFleeFromPoints(DtScriptedTaskTask*);
90 
92  virtual double getFleeRadius(DtScriptedTaskTask*);
93 
95  virtual bool atDestination();
96 
98  virtual void doMoving();
99 
102  virtual double findDesiredSpeed();
103 
105  virtual double findDesiredHeading();
106 
109  virtual void stop(bool success);
110 
111  virtual void clearTask();
112 
116  virtual DtVector findFleeToPoint(double radius, const std::list<DtVector>& localFrom);
117 
120  virtual double fleePointMaxCost(const std::list<DtVector>& fleeFromPtList, const DtVector& fleeToPt,
121  double maxFleeDist, bool collision);
122 
125  virtual double fleePointCost(const DtVector& fleeFromPt, const DtVector& fleeToPt,
126  double maxFleeDist, bool collision);
127 
130  virtual bool pointsMoved(const std::list<DtVector>& pts1, const std::list<DtVector>& pts2, double threshhold);
131 
133  static void objectAboutToBeRemoved(const DtVrfObject* msg, void * usr);
134  virtual void processObjectAboutToBeRemoved(const DtVrfObject* msg);
135 
137  virtual void processFleeTask(DtScriptedTaskTask*);
138 
139  virtual void showFleePoint();
140 
141  virtual void preFirstTickInit();
142  virtual bool createPSR();
143 
144  virtual bool entityInDestination(const DtVector& dest);
145 
146  virtual void updateTaskVisualizations();
147 
148  static void navigationInterfaceChanged(const DtVrfObject*, void* usr);
149  virtual void processNavigationInterfaceChanged(const DtVrfObject*);
150 
151  virtual bool isRecentlyVisitedFleePoint(const DtVector& localPoint);
152 
153 protected:
158 
160 
164  std::list<DtVector> myCachedFleeFromPoints;
165 
166  typedef std::pair<DtVector, double> PointAndCost;
167  std::vector<PointAndCost> myCandidateFleeToPoints;
168 
169 
172 
175 
182 
189 
196 
203 
205 
208 
212  std::list<DtVector> myRecentlyVisitedFleePoints;
213 
219 };
#define DT_DLL_vrfmodel
This file is used to determine how to build.
Definition: vrfmodelDefines.h:24
std::vector< PointAndCost > myCandidateFleeToPoints
Definition: humanFleeController.h:167
DtVrfObject is used to represent any type of simulated object (entities, aggregate, control objects) in a VR-Forces application.
Definition: vrfObject.h:215
Description: This repository holds all information that is common to all the forms of humans within t...
Definition: humanStateRepository.h:32
bool myWasTasked
Definition: humanFleeController.h:206
This is the DtVrfObjectNavInterface subclass for objects which are actively querying the navigation s...
Definition: activeBotNavInterface.h:26
Instances of DtBooleanOutputPort are output ports through which data producers can send boolean data...
Definition: boolIOPort.h:45
bool myIgnoreNavData
Definition: humanFleeController.h:156
bool mySetupFromTaskWhenCan
Definition: humanFleeController.h:161
virtual void registerTaskMsgCallbacks()
virtual void preFirstTickInit()
This function can be overridden to initialize a component before it is ticked for the first time...
This class provides a base class for all controllers that are capable of executing a DtSimTask...
Definition: singleTaskControllerComponent.h:20
DtHumanMovementControlOutputPortGroup * myHumanMovementControlOutputPortGroup
Output Group Name: movement-control .
Definition: humanFleeController.h:174
std::list< DtVector > myCachedFleeFromPoints
Last calculated points that are being fled from.
Definition: humanFleeController.h:164
const DtHumanStateRepository * myHumanSR
Definition: humanFleeController.h:157
A readable, writable type whose name is the name of a component and that has a list of component name...
Definition: componentDescriptor.h:42
DtHumanFleeControllerDescriptor * myHumanFleeControllerDescriptor
Definition: humanFleeController.h:154
Definition: readerWriterRegistry.h:39
class DtHumanFleePSR:
Definition: humanFleePSR.h:21
virtual const char * type() const =0
Returns a string identifies the class type of component.
virtual bool init()
Calls setRadio()
DtActiveBotNavInterface * myNavInterface
Definition: humanFleeController.h:155
virtual void clearTask()
If component is currently tasked, calls clearPendingSubtasks(), sets the tasked flag to false...
virtual void updateTaskVisualizations()
Called to update task visualizations after every tick.
Definition: simComponent.h:487
DtBooleanOutputPort * myIsMovingPort
Output Port Name: is-moving Output Port Description: Indicates the entity is being actively moved by ...
Definition: humanFleeController.h:188
Specialized classes.
Definition: scriptedTaskTask.h:270
Instances of DtVectorOutputPort are output ports through which data producers can send a DtVector...
Definition: vectorIOPort.h:52
File: simMsg.h.
Definition: simMessage.h:35
virtual void tick()
This gives the thread of control to the component.
DtHumanFleeController is a controller that models fleeing from a particular group of entities...
Definition: humanFleeController.h:33
std::list< DtVector > myRecentlyVisitedFleePoints
These points are stored here instead of the PSR because they are really just a very recent history...
Definition: humanFleeController.h:212
DtVectorOutputPort * myDestinationOutputPort
Output Port Name: destination Output Port Description: Specifies the current destination of the entit...
Definition: humanFleeController.h:181
virtual bool createPorts()
Called by init.
DtHumanFleeControllerDescriptor; descriptor for the DtHumanFleeController component.
Definition: humanFleeControllerDescriptor.h:20
virtual bool createPortGroups()
Called by init.
The DtSimComponent class is the base class for the entire simulation model component hierarchy...
Definition: simComponent.h:67
const DtTaskControllerComponent & operator=(const DtTaskControllerComponent &orig)
assignment operator
double myFleeEndRadiusFactor
A factor to determine how far beyond the flee radius the entity will run before quitting the task...
Definition: humanFleeController.h:218
DtIntegerOutputPort * myOverrideGroundClampFidelityPort
Output Port Name: override-ground-clamp-fidelity Output Port Description: Indicates whether or not th...
Definition: humanFleeController.h:202
The simulation engine is controlled by a single,top-level class called the Simulation Manager...
Definition: simManager.h:103
Instances of DtIntegerOutputPort are output ports through which data producers can send integer value...
Definition: integerIOPort.h:45
double myNextFleeCalcTime
Definition: humanFleeController.h:207
An output port group that contains the ports necessary to control the movement of a human using the D...
Definition: humanMovementControlOutputPortGroup.h:22
std::pair< DtVector, double > PointAndCost
Definition: humanFleeController.h:166
DtHumanFleePSR * myProcessState
Definition: humanFleeController.h:159
DtBooleanOutputPort * myUseCollisionAvoidancePort
Output Port Name: use-collision-avoidance Output Port Description: Indicates whether or not this cont...
Definition: humanFleeController.h:195
char * dest
Definition: lz4.h:440

Document ID: Generated on Tue Sep 21 17:42:52 EDT 2021 from SVN revision 234861
Copyright © 2005-2021 MAK Technologies. All Rights Reserved (www.mak.com)