VR-Forces 5.0.1 Developer's Guide
 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 
18 #include <vrfNavigation/navArea.h>
19 
22 class DtScriptedTaskTask;
24 class DtHumanFleePSR;
26 class DtVectorOutputPort;
29 
35 {
36 private:
43 public:
45  DtHumanFleeController(const DtString& name, DtLocalObject* owner,
46  DtSimulationServices* simManager, DtComponentDescriptor* desc=0, DtReaderWriterRegistry *parentRegistry=0);
47 
49  virtual ~DtHumanFleeController();
50 
52  virtual bool init();
53 
55  virtual const char* type() const;
56 
58  virtual void tick();
59 
64  static void fleeCallback(DtSimMessage * msg, void * usr);
65 
67  static DtSimComponent* creator(const DtString& name, DtLocalObject* owner, DtSimulationServices* simManager,
68  DtComponentDescriptor* desc=0, DtReaderWriterRegistry* parentRegistry=0);
69 
70 protected:
71 
73  virtual bool createPortGroups();
74 
76  virtual bool createPorts();
77 
78  virtual bool usingNavBot() const;
79 
80  virtual void processFleeTask(DtSimMessage * msg);
81 
83  virtual void registerTaskMsgCallbacks();
84 
85  static void navAreaChangedCallback(void* usr);
86  virtual void processNavAreaChanged();
87 
90  virtual std::list<DtVector> getFleeFromPoints(DtScriptedTaskTask*);
91 
93  virtual double getFleeRadius(DtScriptedTaskTask*);
94 
96  virtual bool atDestination();
97 
99  virtual void doMoving();
100 
103  virtual double findDesiredSpeed();
104 
106  virtual double findDesiredHeading();
107 
110  virtual void stop(bool success);
111 
112  virtual void clearTask();
113 
117  virtual DtVector findFleeToPoint(double radius, const std::list<DtVector>& localFrom);
118 
121  virtual double fleePointMaxCost(const std::list<DtVector>& fleeFromPtList, const DtVector& fleeToPt,
122  double maxFleeDist, bool collision);
123 
126  virtual double fleePointCost(const DtVector& fleeFromPt, const DtVector& fleeToPt,
127  double maxFleeDist, bool collision);
128 
131  virtual bool pointsMoved(const std::list<DtVector>& pts1, const std::list<DtVector>& pts2, double threshhold);
132 
134  virtual void processObjectRemoved();
135 
137  virtual void processFleeTask(DtScriptedTaskTask*);
138 
139  virtual void preFirstTickInit();
140  virtual bool createPSR();
141 
142  virtual bool entityInDestination(const DtVector& dest);
143 
144  virtual void updateTaskVisualizations();
145 
146  virtual void processNavigationInterfaceChanged();
147 
148  virtual bool isRecentlyVisitedFleePoint(const DtVector& localPoint);
149 
150 protected:
155 
157 
161  std::list<DtVector> myCachedFleeFromPoints;
162 
163  typedef std::pair<DtVector, double> PointAndCost;
164  std::vector<PointAndCost> myCandidateFleeToPoints;
165 
166 
169 
172 
179 
186 
193 
200 
202 
205 
209  std::list<DtVector> myRecentlyVisitedFleePoints;
210 
216 
217  boost::signals2::scoped_connection myRemovalConnection;
218 
220 };
#define DT_DLL_vrfmodel
This file is used to determine how to build.
Definition: vrfmodelDefines.h:24
std::vector< PointAndCost > myCandidateFleeToPoints
Definition: humanFleeController.h:164
Description: This repository holds all information that is common to all the forms of humans within t...
Definition: humanStateRepository.h:33
bool myWasTasked
Definition: humanFleeController.h:203
This is the DtVrfObjectNavInterface subclass for objects which are actively querying the navigation s...
Definition: activeBotNavInterface.h:27
Instances of DtBooleanOutputPort are output ports through which data producers can send boolean data...
Definition: boolIOPort.h:45
bool myIgnoreNavData
Definition: humanFleeController.h:153
bool mySetupFromTaskWhenCan
Definition: humanFleeController.h:158
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:171
std::list< DtVector > myCachedFleeFromPoints
Last calculated points that are being fled from. This is not kept in the PSR since it can be recalcul...
Definition: humanFleeController.h:161
const DtHumanStateRepository * myHumanSR
Definition: humanFleeController.h:154
A readable, writable type whose name is the name of a component and that has a list of component name...
Definition: componentDescriptor.h:49
DtHumanFleeControllerDescriptor * myHumanFleeControllerDescriptor
Definition: humanFleeController.h:151
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. Type values are defined in compTypes...
virtual bool init()
Calls setRadio()
boost::signals2::scoped_connection myRemovalConnection
Definition: humanFleeController.h:217
DtActiveBotNavInterface * myNavInterface
Definition: humanFleeController.h:152
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. Implemented by subclasses. ...
Definition: simComponent.h:436
DtBooleanOutputPort * myIsMovingPort
Output Port Name: is-moving Output Port Description: Indicates the entity is being actively moved by ...
Definition: humanFleeController.h:185
Specialized classes.
Definition: scriptedTaskTask.h:274
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. The component is ticked once each simulation from ...
DtHumanFleeController is a controller that models fleeing from a particular group of entities...
Definition: humanFleeController.h:34
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:209
DtVectorOutputPort * myDestinationOutputPort
Output Port Name: destination Output Port Description: Specifies the current destination of the entit...
Definition: humanFleeController.h:178
DtHumanLocalObjectFacade myHumanLocalObjectFacade
Definition: humanFleeController.h:219
virtual bool createPorts()
Called by init. Derived classes should override this method to create all their input/output ports an...
DtHumanFleeControllerDescriptor; descriptor for the DtHumanFleeController component.
Definition: humanFleeControllerDescriptor.h:20
virtual bool createPortGroups()
Called by init. Derived classes should override this method to create all their input/output port gro...
Central access point of all non-object-specific the services and managers that are available for use ...
Definition: simulationServices.h:89
The DtSimComponent class is the base class for the entire simulation model component hierarchy...
Definition: simComponent.h:70
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:215
DtIntegerOutputPort * myOverrideGroundClampFidelityPort
Output Port Name: override-ground-clamp-fidelity Output Port Description: Indicates whether or not th...
Definition: humanFleeController.h:199
Instances of DtIntegerOutputPort are output ports through which data producers can send integer value...
Definition: integerIOPort.h:45
double myNextFleeCalcTime
Definition: humanFleeController.h:204
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:163
DtHumanFleePSR * myProcessState
Definition: humanFleeController.h:156
DtBooleanOutputPort * myUseCollisionAvoidancePort
Output Port Name: use-collision-avoidance Output Port Description: Indicates whether or not this cont...
Definition: humanFleeController.h:192
char * dest
Definition: lz4.h:440
A locally simulated VRF object. Holds all internal and external data for the object, and provides access to both the current frame and next frame state data for the object. All current frame data is read-only, and next-frame data can be written to. No thread safety guarantees are made on this object during the simulation frame and it should only be accessed by the thread that is simulating the object.
Definition: localObject.h:86

Document ID: Generated on Mon Jun 20 00:38:30 EDT 2022 from SVN revision 244029
Copyright © 2005-2021 MAK Technologies. All Rights Reserved (www.mak.com)