VR-Forces 5.0.1 Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
humanMoveToController.h
Go to the documentation of this file.
1 /****************************************************************************
2  * Copyright (c) 2021 MAK Technologies, Inc.
3  * All rights reserved.
4  ****************************************************************************/
5 
9 
10 #pragma once
11 
15 
16 class DtCgf;
18 class DtSimMessage;
19 class DtHumanMoveToPSR;
21 class DtInputPortGroup;
23 class DtVectorOutputPort;
27 class DtGenericPsr;
28 class DtAnalogInputPort;
29 class DtAnalogOutputPort;
30 class DtVectorInputPort;
31 
43 {
44 private:
51 public:
53  DtHumanMoveToController(const DtString& name, DtLocalObject* owner, DtSimulationServices* simManager, DtComponentDescriptor* desc=0, DtReaderWriterRegistry *parentRegistry=0);
54 
56  virtual ~DtHumanMoveToController();
57 
59  virtual bool init();
60 
62  virtual const char* type() const;
63 
65  virtual void tick();
66 
71  static void moveToCallback(DtSimMessage * msg, void * usr);
72 
77  static void setLocationCallback(DtSimMessage* msg, void* usr);
78 
83  static void moveToLocationCallback(DtSimMessage * msg, void * usr);
84 
86  static DtSimComponent* creator(const DtString& name, DtLocalObject* owner, DtSimulationServices* simManager, DtComponentDescriptor* desc=0, DtReaderWriterRegistry* parentRegistry=0);
87 
89  static void modifyVrfObjectCallback(DtSimMessage* msg, void* usr);
90 
91 protected:
92 
95  virtual void processMoveToTask(DtSimMessage * msg);
96 
97 
98  virtual void processMoveToLocationTask(DtSimMessage * msg);
99 
104  virtual void processDestinationChanged();
105 
109  virtual bool setupDestination();
110 
119  virtual void setupDestinationVector() const;
120 
122  virtual void invalidateDestinationVector() const;
123 
132  virtual bool atDestination();
133 
135  virtual void doMoving();
136 
138  virtual double findDesiredHeading();
139 
141  virtual double findDesiredSpeed();
142 
144  virtual void moveToDestination();
145 
148  virtual void stop(bool success);
149 
151  virtual void registerTaskMsgCallbacks();
152 
156  virtual void processModifyVrfObject(DtSimMessage* msg);
157 
160  virtual void processSetLocation(DtSimMessage* msg);
161 
163  virtual bool createPortGroups();
164 
166  virtual bool createPorts();
167 
173  virtual bool createPSR();
174 
175  virtual double distanceToDestination() const;
176 
178  virtual void clearTask();
179 
181  virtual bool destinationIsInsideObstruction(
182  const DtVector& localDestination) const;
183 
186  virtual bool decideToGiveUpTask() const;
187 
192  virtual double atDistance() const;
193 
195  virtual bool usingNavBot() const;
196 
198  virtual void useNavBotData();
199 
202  virtual unsigned maxNumFailedPathAttempts() const;
203 
206  virtual bool findAlternateDestination();
207 
209  virtual void setStuck(bool yesNo);
211  virtual double stuckTime();
212 
213  static void navAreaChangedCallback(void* usr);
214  virtual void processNavAreaChanged();
215 
219  DtVector localDestination() const;
220 
221  virtual void updateTaskVisualizations();
222 
225  virtual void suspendTask();
226 
228  virtual void preFirstTickInit();
229 
230  static void setAiEnabledCallback(DtSimMessage* msg, void* usrData);
231  virtual void processSetAiEnabled(DtSimMessage* msg);
232 
233  virtual void processNavigationInterfaceChanged();
234 
236  virtual void processEstimatedTotCalculation();
237 
238 protected:
239 
242 
250 
254 
257 
264 
271 
278 
286 
292 
298 
300 
304 
307 
311 
314 
317 
322 
323  //Used to force the navigation interface to be ignored.
324  //This is useful when the nav interface has given us a partial
325  //path to the destination (for example, if we're in a nav area
326  //but our destination is outside the nav area).
327  //Once set, gets reset when any of the following happen:
328  //1) A new task is issued
329  //2) The destination location changes
330  //3) A set location occurs
331  //4) The entity moves to a new navArea.
333 
335 
337 
341  //DtGenericPsr* myHumanMovePsr;
342 
345 
347 
349  const double DtEstimatedTotCalcInterval = 5.0;
350 
359 
361 };
362 
class DtHumanMoveToPSR:
Definition: humanMoveToPSR.h:28
#define DT_DLL_vrfmodel
This file is used to determine how to build.
Definition: vrfmodelDefines.h:24
DtAnalogInputPort * myEtaForLastVertexInputPort
Input Port Name: eta-for-last-vertex Input Port Description: Specifies the eta for the last vertex of...
Definition: humanMoveToController.h:291
bool myIgnoreNavData
Definition: humanMoveToController.h:332
virtual void suspendTask()
This method is called when the currently running task is being suspended. The default implementation ...
DtHumanMovementControlOutputPortGroup * myHumanMovementControlOutputPortGroup
Output Group Name: movement-control .
Definition: humanMoveToController.h:256
DtHumanStateRepository * myHumanStateRepository
Definition: humanMoveToController.h:336
Description: This repository holds all information that is common to all the forms of humans within t...
Definition: humanStateRepository.h:33
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
virtual void registerTaskMsgCallbacks()
virtual void preFirstTickInit()
This function can be overridden to initialize a component before it is ticked for the first time...
double myEstimatedTotLastCalcTime
used for tot calculation intervals
Definition: humanMoveToController.h:356
This class provides a base class for all controllers that are capable of executing a DtSimTask...
Definition: singleTaskControllerComponent.h:20
DtVector myIntermediateLocalDestination
Definition: humanMoveToController.h:310
The DtSimObjectReference is a shared pointer that can be used amongst many object for access to the u...
Definition: simObjectReference.h:26
A readable, writable type whose name is the name of a component and that has a list of component name...
Definition: componentDescriptor.h:49
Definition: readerWriterRegistry.h:39
DtVector myLocalDestination
Definition: humanMoveToController.h:305
virtual const char * type() const =0
Returns a string identifies the class type of component. Type values are defined in compTypes...
DtHumanLocalObjectFacade myHumanLocalObjectFacade
Definition: humanMoveToController.h:360
virtual bool init()
Calls setRadio()
virtual void clearTask()
If component is currently tasked, calls clearPendingSubtasks(), sets the tasked flag to false...
bool myDestinationVectorIsValid
Definition: humanMoveToController.h:313
Contains class declarations for DtVectorInputPort, DtVectorOutputPort, and DtVectorPortData.
Definition: vectorIOPort.h:27
virtual void updateTaskVisualizations()
Called to update task visualizations after every tick. Implemented by subclasses. ...
Definition: simComponent.h:436
DtBooleanOutputPort * myUseCollisionAvoidancePort
Output Port Name: use-collision-avoidance Output Port Description: Indicates whether or not this cont...
Definition: humanMoveToController.h:277
DtHumanMoveToPSR * myProcessState
Container for state data associated with this component. This state is saved and restored as part of ...
Definition: humanMoveToController.h:340
DtVectorInputPort * myLastVertexLocationInputPort
Input Port Name: last-vertex-location Input Port Description: Specifies the last vertex location of t...
Definition: humanMoveToController.h:285
void registerDtHumanMoveToController(DtCgf *cgf)
Registers component and associated classes with the factories. Call after DtVrfApp::init() ...
bool myEstimatedTotCalcEnabled
enabled flag for the tot calculations
Definition: humanMoveToController.h:352
DtInputPortGroup * myCollisionAvoidancePortGroup
Input Port Group Name: collision-avoidance-control Input Port Group Description:
Definition: humanMoveToController.h:253
DtVector myIntermediateWorldDestination
Definition: humanMoveToController.h:309
Instances of DtAnalogOutputPort are input ports through which data producers can send real numbers...
Definition: analogIOPort.h:45
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
DtAnalogOutputPort * myEtaToLastVertexOutputPort
Output Port Name: eta-to-last-vertex Output Port Description: Specifies the eta to reach the last ver...
Definition: humanMoveToController.h:297
virtual void tick()
This gives the thread of control to the component. The component is ticked once each simulation from ...
DtActiveBotNavInterface * myNavInterface
Definition: humanMoveToController.h:344
DtVectorOutputPort * myDestinationOutputPort
Output Port Name: destination Output Port Description: Specifies the current destination of the entit...
Definition: humanMoveToController.h:263
DtCollisionInputPort * myCollisionAvoidancePort
Input Port Name: potential-collision-info Input Port Description: information about an impending pote...
Definition: humanMoveToController.h:249
double myDistanceSquared
Definition: humanMoveToController.h:316
DtVector myWorldDestination
Definition: humanMoveToController.h:306
DtHumanMoveToControllerDescriptor; descriptor for the DtHumanMoveToControllerDescriptor component...
Definition: humanMoveToControllerDescriptor.h:23
virtual bool createPorts()
Called by init. Derived classes should override this method to create all their input/output ports an...
bool myOverrideAtDistance
Definition: humanMoveToController.h:318
virtual bool decideToGiveUpTask() const
This function is used to determine if the controller should give up trying to execute the current tas...
double myEstimatedTotValue
the tot value
Definition: humanMoveToController.h:354
virtual bool createPortGroups()
Called by init. Derived classes should override this method to create all their input/output port gro...
DtSimObjectReference myControlPoint
This is looked up once per tick - assumed unchanging while we have control.
Definition: humanMoveToController.h:303
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
DtBooleanOutputPort * myIsMovingPort
Output Port Name: is-moving Output Port Description: Indicates the entity is being actively moved by ...
Definition: humanMoveToController.h:270
DtHumanMoveToControllerDescriptor * myHumanMoveToControllerDescriptor
Definition: humanMoveToController.h:343
bool myAtDestination
Definition: humanMoveToController.h:315
DtInputPortGroup is a data port group of a data consumer. It may contain any number of DtInputPorts a...
Definition: inputPortGroup.h:35
Instances of DtCollisionInputPort are input ports through which data consumers can receive informatio...
Definition: collisionIOPort.h:29
DtHumanMoveToController is a controller that models movement to a <location> or <waypoint> for indivi...
Definition: humanMoveToController.h:42
Contains class declarations for DtAnalogInputPort, DtAnalogOutputPort, and DtAnalogPortData.
Definition: analogIOPort.h:25
A DtVrfProcessStateRepository subclass that keeps an arbitrary key/value pair set of data...
Definition: genericPsr.h:17
unsigned myNumFailedPathAttempts
Definition: humanMoveToController.h:334
void processSetLocation(DtSetDataRequest *set, const DtVertexList &vertices, double position, DtMoveAlongRouteTimeEstimator *est)
An output port group that contains the ports necessary to control the movement of a human using the D...
Definition: humanMovementControlOutputPortGroup.h:22
bool myHasIntermediateDestination
Definition: humanMoveToController.h:308
bool myAIEnabled
Definition: humanMoveToController.h:346
The top level class of a VR-Forces Simulation Engine, representing a Computer Generated Forces instan...
Definition: cgf.h:143
DtVector myEstimatedTotTextPos
tot text position
Definition: humanMoveToController.h:358
DtVector myDestinationVector
Definition: humanMoveToController.h:312
double myOverrideAtDistanceValue
Definition: humanMoveToController.h:319
bool myOverrideSpeed
Definition: humanMoveToController.h:320
double myOverrideSpeedValue
Definition: humanMoveToController.h:321
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)