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 
132  virtual double findDesiredSpeed(const DtVector& localDestination,
133  const double stoppingAcceleration = 0.0);
135  virtual double findDesiredSpeed(const double stoppingAcceleration = 0.0);
136 
147  virtual double destinationSpeed(const double cruiseSpeed) const;
148 
155  virtual DtAutoTransmissionGearEnum determineGearSetting(const double desiredSpeed);
156 
165  virtual bool atDestination();
166 
172  virtual double approximateThrottle(double desiredSpeed, double headingError = 0.0) override;
173 
178  virtual void stopVehicle(bool success = true);
179 
181  virtual void stop(bool success = true);
182 
185  virtual void doMoving();
186 
192  virtual void updateTaskVisualizations() override;
193 
196 
207  virtual bool nearDestination();
208 
218  virtual bool passedDestination();
219 
221 
225  static const std::string notActiveString;
226  static const std::string noObstaclesString;
227  static const std::string avoidingString;
228  static const std::string blockedByVehicleString;
230  static const std::string blockedByWallString;
231 
233 
234 
235 protected:
236 
240  virtual bool setupDestination();
241 
251  virtual void setupDestinationVector();
252 
254  virtual void invalidateDestinationVector() const;
255 
257  virtual void moveToDestination();
258  virtual double distanceSqToDestination() const;
259 
268  virtual double steeringHeadingToLocation(const DtVector& destination);
269 
278  virtual double findDesiredHeading();
279 
283  virtual bool decideToGiveUpTask() const override;
284 
286  virtual void taskComplete(bool success = true) override;
287 
288  virtual bool createPortGroups() override;
289  virtual bool createPorts() override;
290 
293  virtual void setDestinationIsInsideObstruction(bool yesNo);
294 
297  virtual bool destinationIsInsideObstruction() const;
298 
301  virtual unsigned maxNumFailedPathAttempts() const;
302 
303  static void navAreaChangedCallback(void* usr);
304  virtual void processNavAreaChanged();
305 
306  DtVector localDestination() const;
307 
308  virtual void processNavigationInterfaceChanged();
309 
311  virtual void processEstimatedTotCalculation();
312 
314  virtual void processGroundVehicleLocationChanged();
315 
316 private:
320 
323 
327 
328 protected:
332 
335 
342 
344 
347 
350 
357 
358  mutable DtVector myDestinationVector;
361 
368 
371 
373 
376 
378  const double DtEstimatedTotCalcInterval = 5.0;
379 
389 
394 };
395 
396 
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:375
DtVector myLocalDestination
Definition: groundMoveToDestinationControllerComponent.h:348
static const std::string noObstaclesString
= &quot;NotActive&quot;;
Definition: groundMoveToDestinationControllerComponent.h:226
double myNearDistanceSquared
Deprecated– these two are no longer used.
Definition: groundMoveToDestinationControllerComponent.h:366
DtVector myDestinationVector
Definition: groundMoveToDestinationControllerComponent.h:358
bool myHasIntermediateDestination
These no longer get set, since Gameware path planning is not performed by this controller.
Definition: groundMoveToDestinationControllerComponent.h:353
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:370
virtual void registerTaskMsgCallbacks()
virtual void clearTask() override
Overridden to deactivate the port group when this controller completes a task.
bool myDestinationVectorIsValid
Definition: groundMoveToDestinationControllerComponent.h:359
DtVector myEstimatedTotTextPos
tot text position
Definition: groundMoveToDestinationControllerComponent.h:387
bool myDestinationIsInsideObstruction
Definition: groundMoveToDestinationControllerComponent.h:372
double myCurrentSpeed
Definition: groundMoveToDestinationControllerComponent.h:346
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:349
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:393
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:355
virtual void updateTaskVisualizations()
Called to update task visualizations after every tick. Implemented by subclasses. ...
Definition: simComponent.h:443
DtActiveBotNavInterface * myNavInterface
Definition: groundMoveToDestinationControllerComponent.h:369
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:330
virtual bool createPorts() override
Overridden to create the automotive ports.
const DtGroundMoveToDescriptor * myMoveToDescriptor
Definition: groundMoveToDestinationControllerComponent.h:329
File: simMsg.h.
Definition: simMessage.h:35
int myLastNumberOfObstacleVisualizations
Definition: groundMoveToDestinationControllerComponent.h:331
virtual void tick()
This gives the thread of control to the component. The component is ticked once each simulation from ...
bool myEstimatedTotCalcEnabled
enabled flag for the tot calculations
Definition: groundMoveToDestinationControllerComponent.h:381
bool myAtDestination
Definition: groundMoveToDestinationControllerComponent.h:360
DtVector myIntermediateWorldDestination
These no longer get set, since Gameware path planning is not performed by this controller.
Definition: groundMoveToDestinationControllerComponent.h:354
static const std::string blockedByWallString
= &quot;BlockedByVehicle&quot;;
Definition: groundMoveToDestinationControllerComponent.h:230
static const std::string notActiveString
= &quot;NotActive&quot;;
Definition: groundMoveToDestinationControllerComponent.h:225
DtBooleanOutputPort * myClampToNavDataPort
Output Port Name: clamp-to-nav-data Output Port Description: When there is a failure to path plan due...
Definition: groundMoveToDestinationControllerComponent.h:341
Definition: collision.h:25
Definition: rangeAndDirectionNetworkSegmentMetric.h:21
static const std::string avoidingString
= &quot;NoObstacles&quot;;
Definition: groundMoveToDestinationControllerComponent.h:227
Central access point of all non-object-specific the services and managers that are available for use ...
Definition: simulationServices.h:96
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:388
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:345
Definition: groundMoveToObstacleAvoider.h:26
bool myNearDestination
Deprecated– these two are no longer used.
Definition: groundMoveToDestinationControllerComponent.h:364
bool myPassedDestination
Deprecated– these two are no longer used.
Definition: groundMoveToDestinationControllerComponent.h:365
void processSetLocation(DtSetDataRequest *set, const DtVertexList &vertices, double position, DtMoveAlongRouteTimeEstimator *est)
double myEstimatedTotLastCalcTime
used for tot calculation intervals
Definition: groundMoveToDestinationControllerComponent.h:385
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:383
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 23 22:29:17 EDT 2025 from SVN revision 280951
Copyright © 2005-2024 MAK Technologies. All Rights Reserved (www.mak.com)