VR-Forces Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
groundMoveToDestinationControllerComponent.h
Go to the documentation of this file.
1 /*******************************************************************************
2 ** Copyright (c) 2004 MAK Technologies, Inc.
3 ** All rights reserved.
4 *******************************************************************************/
5 
8 
11 
12 
13 #pragma once
14 
15 
17 #include <matrix/vlVector.h>
19 
20 class DtString;
22 class DtSimMessage;
26 class DtInputPortGroup;
28 class DtCollision;
30 
42 {
43 public:
44 
48  DtLocalObject* owner,
49  DtSimulationServices* simManager,
50  DtComponentDescriptor* desc = 0,
51  DtReaderWriterRegistry* parentRegistry = 0);
52 
55 
58  virtual void createObstacleAvoider();
59  virtual DtGroundMoveToObstacleAvoider* obstacleAvoider() const;
60 
62  virtual bool init() override;
63 
69  virtual void tick() override;
70 
73  virtual const char* type() const override;
74 
76  static void setLocationCallback(DtSimMessage* msg, void* usr);
79  virtual void processSetLocation(DtSimMessage* msg);
80 
82  static void modifyVrfObjectCallback(DtSimMessage* msg, void* usr);
86  virtual void processModifyVrfObject(DtSimMessage* msg);
87 
91  static DtSimComponent * creator(const DtString& name,
92  DtLocalObject* owner,
93  DtSimulationServices* simManager,
94  DtComponentDescriptor* desc = 0,
95  DtReaderWriterRegistry* parentRegistry = 0);
96 
98  virtual void registerTaskMsgCallbacks() override;
99 
101  virtual void clearTask() override;
102 
111  virtual bool getDestination(DtVector & destination) const;
112 
117  virtual const DtVector& destinationVector();
118 
134  virtual double findDesiredSpeed(const DtVector& localDestination,
135  const double stoppingAcceleration = 0.0);
137  virtual double findDesiredSpeed(const double stoppingAcceleration = 0.0);
138 
149  virtual double destinationSpeed(const double cruiseSpeed) const;
150 
157  virtual DtAutoTransmissionGearEnum determineGearSetting(const double desiredSpeed);
158 
167  virtual bool atDestination();
168 
174  virtual double approximateThrottle(double desiredSpeed, double headingError = 0.0) override;
175 
180  virtual void stopVehicle(bool success = true);
181 
183  virtual void stop(bool success = true);
184 
187  virtual void doMoving();
188 
194  virtual void updateTaskVisualizations() override;
195 
198 
209  virtual bool nearDestination();
210 
220  virtual bool passedDestination();
221 
223 
227  static const std::string notActiveString;
228  static const std::string noObstaclesString;
229  static const std::string avoidingString;
230  static const std::string blockedByVehicleString;
232  static const std::string blockedByWallString;
233 
235 
236 
237 protected:
238 
242  virtual bool setupDestination();
243 
253  virtual void setupDestinationVector();
254 
256  virtual void invalidateDestinationVector() const;
257 
259  virtual void moveToDestination();
260  virtual double distanceSqToDestination() const;
261 
270  virtual double steeringHeadingToLocation(const DtVector& destination);
271 
280  virtual double findDesiredHeading();
281 
285  virtual bool decideToGiveUpTask() const override;
286 
288  virtual void taskComplete(bool success = true) override;
289 
290  virtual bool createPortGroups() override;
291  virtual bool createPorts() override;
292 
295  virtual void setDestinationIsInsideObstruction(bool yesNo);
296 
299  virtual bool destinationIsInsideObstruction() const;
300 
303  virtual unsigned maxNumFailedPathAttempts() const;
304 
305  static void navAreaChangedCallback(void* usr);
306  virtual void processNavAreaChanged();
307 
308  DtVector localDestination() const;
309 
310  virtual void processNavigationInterfaceChanged();
311 
313  virtual void processEstimatedTotCalculation();
314 
316  virtual void processGroundVehicleLocationChanged();
317 
319  virtual const DtString& markAsInUse(const DtString& name);
320 
322  virtual void markAllForRemoval();
323 
324 private:
328 
331 
335 
336 protected:
340  std::map<DtString, bool> myInUse;
342 
345 
352 
354 
357 
360 
367 
368  mutable DtVector myDestinationVector;
371 
378 
381 
383 
386 
388  const double DtEstimatedTotCalcInterval = 5.0;
389 
399 
404 };
405 
406 
virtual const char * type() const override
Returns a string identifies the class type of component. Type values are defined in compTypes...
#define DT_DLL_vrfmodel
This file is used to determine how to build.
Definition: vrfmodelDefines.h:24
double myTargetHeading
For task visualization:
Definition: groundMoveToDestinationControllerComponent.h:385
DtVector myLocalDestination
Definition: groundMoveToDestinationControllerComponent.h:358
static const std::string noObstaclesString
= &quot;NotActive&quot;;
Definition: groundMoveToDestinationControllerComponent.h:228
double myNearDistanceSquared
Deprecated– these two are no longer used.
Definition: groundMoveToDestinationControllerComponent.h:376
DtVector myDestinationVector
Definition: groundMoveToDestinationControllerComponent.h:368
bool myHasIntermediateDestination
These no longer get set, since Gameware path planning is not performed by this controller.
Definition: groundMoveToDestinationControllerComponent.h:363
virtual bool init() override
Initializes myGroundVehicleState.
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
A DtComponentDescriptor that has parameters that indicate the distances at which the entity is consid...
Definition: groundMoveToDescriptor.h:30
bool myIgnoreNavData
Definition: groundMoveToDestinationControllerComponent.h:380
virtual void registerTaskMsgCallbacks()
std::map< DtString, bool > myInUse
Definition: groundMoveToDestinationControllerComponent.h:340
virtual void clearTask() override
Overridden to deactivate the port group when this controller completes a task.
bool myDestinationVectorIsValid
Definition: groundMoveToDestinationControllerComponent.h:369
DtVector myEstimatedTotTextPos
tot text position
Definition: groundMoveToDestinationControllerComponent.h:397
bool myDestinationIsInsideObstruction
Definition: groundMoveToDestinationControllerComponent.h:382
double myCurrentSpeed
Definition: groundMoveToDestinationControllerComponent.h:356
A readable, writable type whose name is the name of a component and that has a list of component name...
Definition: componentDescriptor.h:49
DtVector myWorldDestination
Definition: groundMoveToDestinationControllerComponent.h:359
Definition: readerWriterRegistry.h:39
const DtGroundAutoControllerComponent & operator=(const DtGroundAutoControllerComponent &orig)
assignment operator; not implemented
bool myHasFinalOutputBeenSet
This flag is set by task complete when the final control outputs are set. It is used by clearTask to ...
Definition: groundMoveToDestinationControllerComponent.h:403
virtual void taskComplete(bool success=true)
If we are currently tasked, this will cause us to notify the entity that we&#39;re done and delete the ta...
DtVector myIntermediateLocalDestination
These no longer get set, since Gameware path planning is not performed by this controller.
Definition: groundMoveToDestinationControllerComponent.h:365
virtual void updateTaskVisualizations()
Called to update task visualizations after every tick. Implemented by subclasses. ...
Definition: simComponent.h:471
DtActiveBotNavInterface * myNavInterface
Definition: groundMoveToDestinationControllerComponent.h:379
virtual bool decideToGiveUpTask() const override
If the entity is attached and the target of the current task is not, give up on the task...
DtGroundMoveToDestinationControllerComponent is a controller that provides a kinematics-based model o...
Definition: groundMoveToDestinationControllerComponent.h:40
DtGroundMoveToObstacleAvoider * myObstacleAvoider
Definition: groundMoveToDestinationControllerComponent.h:338
virtual bool createPorts() override
Overridden to create the automotive ports.
const DtGroundMoveToDescriptor * myMoveToDescriptor
Definition: groundMoveToDestinationControllerComponent.h:337
File: simMsg.h.
Definition: simMessage.h:35
int myLastNumberOfObstacleVisualizations
Definition: groundMoveToDestinationControllerComponent.h:339
virtual void tick()
This gives the thread of control to the component. The component is ticked once each simulation frame...
bool myEstimatedTotCalcEnabled
enabled flag for the tot calculations
Definition: groundMoveToDestinationControllerComponent.h:391
bool myAtDestination
Definition: groundMoveToDestinationControllerComponent.h:370
int myLastNumberOfPathSearchRegionVisualizations
Definition: groundMoveToDestinationControllerComponent.h:341
DtVector myIntermediateWorldDestination
These no longer get set, since Gameware path planning is not performed by this controller.
Definition: groundMoveToDestinationControllerComponent.h:364
static const std::string blockedByWallString
= &quot;BlockedByVehicle&quot;;
Definition: groundMoveToDestinationControllerComponent.h:232
static const std::string notActiveString
= &quot;NotActive&quot;;
Definition: groundMoveToDestinationControllerComponent.h:227
DtBooleanOutputPort * myClampToNavDataPort
Output Port Name: clamp-to-nav-data Output Port Description: When there is a failure to path plan due...
Definition: groundMoveToDestinationControllerComponent.h:351
Definition: collision.h:25
Definition: rangeAndDirectionNetworkSegmentMetric.h:21
static const std::string avoidingString
= &quot;NoObstacles&quot;;
Definition: groundMoveToDestinationControllerComponent.h:229
Central access point of all non-object-specific the services and managers that are available for use ...
Definition: simulationServices.h:97
The DtSimComponent class is the base class for the entire simulation model component hierarchy...
Definition: simComponent.h:89
DtAutoTransmissionGearEnum
Definition: automotivePSR.h:25
bool myChangedLocation
Definition: groundMoveToDestinationControllerComponent.h:398
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
virtual bool createPortGroups() override
Overridden to create myAutomotiveControlPortGroup.
double myDistanceSquared
Definition: groundMoveToDestinationControllerComponent.h:355
Definition: groundMoveToObstacleAvoider.h:26
bool myNearDestination
Deprecated– these two are no longer used.
Definition: groundMoveToDestinationControllerComponent.h:374
bool myPassedDestination
Deprecated– these two are no longer used.
Definition: groundMoveToDestinationControllerComponent.h:375
void processSetLocation(DtSetDataRequest *set, const DtVertexList &vertices, double position, DtMoveAlongRouteTimeEstimator *est)
double myEstimatedTotLastCalcTime
used for tot calculation intervals
Definition: groundMoveToDestinationControllerComponent.h:395
virtual double approximateThrottle(double desiredSpeed, double headingError=0.0)
ApproximateThrottle computes a value between -1 and 1 that represents the desired, normalized acceleration. The calling function should treat negative values as (positive) brake output. This control function gets the current gear setting, the current forward speed, current throttle setting, the speed last tick, and dT as further input. If the gear is Reverse, then the desiredSpeed and currentSpeed are negated so that the throttle value computed will end up being positive to move the vehicle. The function then considers two cases:
double myEstimatedTotValue
the tot value
Definition: groundMoveToDestinationControllerComponent.h:393
DtGroundAutoControllerComponent is a base controller that holds capabilitites common to all automotiv...
Definition: groundAutoControllerComponent.h:34
A locally simulated VRF object.
Definition: localObject.h:98

Document ID: Generated on Thu Oct 15 21:27:02 EDT 2026 from SVN revision 296421
Copyright © 2005-2026 MAK Technologies. All Rights Reserved (www.mak.com)