VR-Forces Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
navBot.h
Go to the documentation of this file.
1 /*******************************************************************************
2 ** Copyright (c) 2015 MaK Technologies, Inc.
3 ** All rights reserved.
4 *******************************************************************************/
5 
8 
9 
10 #pragma once
11 
14 #include <string>
15 #include "matrix/vlVector.h"
16 
17 #include <vrfutil/rwBinaryData.h>
18 
19 class DtNavArea;
20 
22 {
24  DtVector location;
25 
26  DtNavTagAndLocation(const DtNavTag& t, const DtVector& l) : navTag(t), location(l) {}
28 };
29 typedef std::vector<DtNavTagAndLocation> DtNavTagAndLocationList;
30 typedef unsigned int DtNavigationPriorityType;
31 
33 {
34 public:
36  {
37  NavigationMethodShortcut = 0,
38  NavigationMethodSpline = 1
39  };
40 
42  {
44  : myNavigationMethod(NavigationMethodShortcut)
45  , myUseAbstractGraph(true)
46  , myMinAbstractGraphReplanDistance(100.)
47  , myPropagationBoxExtent(200.)
48  , myRadiusFactor(1.0)
49  , myEnablePathPlanTiming(false)
50  {}
51 
68  };
69 
71  {
74  : myEnableAvoidance(true)
75  , myEnableStop(true)
76  , myEnableSlowDown(true)
77  , myEnablePushThrough(false)
78  , myEnableNavigation(true)
79  , myCollisionLookaheadTime(15.)
80  , myCollisionDetectionRadius(15.)
81  , myAngleEvalSpan(120)
82  , myNumAngleSamples(30)
83  , mySafetyDistance((float)0.1)
84  , myCollisionAvoidanceInfluence((float)0.8)
85  {}
86 
98  };
99 
100  typedef DtNavBot* (*DtNavBotCreatorFcn)();
101 
102  static DtNavBot* create();
103  static void setNavBotCreatorFcn(DtNavBotCreatorFcn fcn);
104 
105  virtual ~DtNavBot() {};
106 
107  virtual void init(DtNavArea* world, const DtString& profile, double radius, double height, DtNavigationPriorityType queryQueuePriority,
108  NavigationConfiguration navConfig = NavigationConfiguration(),
109  CollisionAvoidanceConfiguration collAvoidConfig = CollisionAvoidanceConfiguration()) = 0;
110 
111  virtual void setPosition(const DtVector& localPos) = 0;
112  virtual void setPositionInvalid() = 0;
113  virtual void setQueryQueuePriority(const DtNavigationPriorityType& queryQueuePriority) = 0;
114  virtual void botUpdate(const DtVector& localPos, double dT) = 0;
115 
116  virtual void setDestination(const DtVector& localPos, bool forceOutsideArea = false) = 0;
117  virtual void setDesiredSpeed(double speed) = 0;
118  virtual void clearFollowedPath() = 0;
119  virtual void clearDestination() = 0;
120  virtual DtVector currentDestination() const = 0;
121 
122  virtual void resetDestination() = 0;
123 
124  virtual int getTriangleIndex() const = 0;
125  virtual void getTriangleVertices(DtVector& corner1, DtVector& corner2, DtVector& corner3) const = 0;
126  virtual DtVector getPointOnTriangle(const DtVector& localLocation) const = 0;
127 
128  virtual DtVector getOutputVelocity() = 0;
129 
130  typedef bool (*NavBotPathLocationEvalFcn)(const DtNavTag& navTag, float slope, float elevationChange, float* costMultiplier, void* userData);
131 
132  virtual void setPathEvalFcn(NavBotPathLocationEvalFcn fcn, void* user) = 0;
133 
135  {
145  };
146 
147  virtual PathStatus pathStatus(double atDistance) = 0;
149  virtual DtString pathStatusString() = 0;
150 
151  virtual bool hasArrived(double arrivalDistance) = 0;
152 
153  virtual bool currentPath(std::vector<DtVector>& path) = 0;
154  virtual bool abstractPath(std::vector<DtVector>& path) = 0;
155 
156  virtual bool currentPathEdge(DtVector& edgeStart, DtVector& edgeEnd) = 0;
157 
158  virtual void getNavPathAsRw(DtRwBinaryData&) = 0;
159 
161  virtual bool setPath(DtRwBinaryData&) = 0;
162 
163  virtual unsigned currentAbstractPathIndex() = 0;
164 
167  virtual void setUseAbstractGraph(bool yesNo) = 0;
168 
170  virtual void resetUseAbstractGraph() = 0;
171 
173  virtual bool usingAbstractGraph() const = 0;
174 
176  virtual DtNavTag navTagAtPosition(const DtVector& localPos) const = 0;
177 
179  virtual DtNavTag upcomingNavTagOnPath() const = 0;
180 
182  virtual void upcomingNavTagsOnPath(double distance, DtNavTagAndLocationList& navTags) const = 0;
183 
186  virtual void setCollisionAvoidanceEnabled(bool enable) = 0;
187 
188  virtual void setNavigationMethod(NavigationMethod navMethod) = 0;
189  virtual NavigationMethod navigationMethod() const = 0;
190 
193  virtual DtVector performMovement(double dt) = 0;
194 
197  virtual DtVector groundClamp(const DtVector& localPos, DtVector& normal) = 0;
198 
199 protected:
200  static DtNavBotCreatorFcn theNavBotCreatorFcn;
201 };
202 
float myCollisionAvoidanceInfluence
Definition: navBot.h:97
Has a valid path to move along.
Definition: navBot.h:139
bool myEnablePushThrough
Definition: navBot.h:90
static DtNavBotCreatorFcn theNavBotCreatorFcn
Definition: navBot.h:200
float mySafetyDistance
Definition: navBot.h:96
bool myEnableAvoidance
Definition: navBot.h:87
Has arrived at destination.
Definition: navBot.h:140
Not actively trying to move.
Definition: navBot.h:137
double myMinAbstractGraphReplanDistance
Only relevant if using abstract graphs. Entity will replan when the distance to the current abstract ...
Definition: navBot.h:58
VR-Forces wrapper for Gameware NavTag. Note: This class keeps only a pointer to the data...
Definition: navDataTag.h:87
bool myEnableSlowDown
Definition: navBot.h:89
bool myEnablePathPlanTiming
For debugging and performance testing. Prints the time it takes to perform path planning.
Definition: navBot.h:67
This is a rw class to save out a block of generic binary data.
Definition: rwBinaryData.h:18
NavigationConfiguration()
Definition: navBot.h:43
float myCollisionLookaheadTime
Definition: navBot.h:92
bool myEnableNavigation
Definition: navBot.h:91
double myRadiusFactor
Factor multiplied by the bounding volume radius to generate the nav bot&#39;s radius. Increasing this wil...
Definition: navBot.h:65
Failed to calculate a path.
Definition: navBot.h:141
float myAngleEvalSpan
Definition: navBot.h:94
DT_DLL_VRVCORE double distance(const makVrv::DtCoordinateSystem &, const DtVector &from, const DtVector &to)
Returns the distance from the two points. Coordinates are in local database coordinates The coordinat...
int myNumAngleSamples
Definition: navBot.h:95
This class contains all the data and logic for navigation within a specific area. Nav Data may be loa...
Definition: navArea.h:205
DtVector location
Definition: navBot.h:24
Currently computing a path.
Definition: navBot.h:138
Failed to calculate a path, destination is outside nav.
Definition: navBot.h:144
float myCollisionDetectionRadius
Definition: navBot.h:93
DtNavTag navTag
Definition: navBot.h:23
Definition: navBot.h:136
Definition: navBot.h:41
Definition: navBot.h:21
Definition: navBot.h:32
CollisionAvoidanceConfiguration()
Sets defaults.
Definition: navBot.h:73
DT_DLL_DEBUGDRAWRENDERER void init(makVrv::DtDe &de)
Work function for the plugin initialization.
double myPropagationBoxExtent
Determines the size of the box used for path planning. Path planning is limited to the 2d box created...
Definition: navBot.h:62
#define DT_DLL_vrfNavigation
This file is used to determine how to build.
Definition: vrfNavigationDefines.h:26
virtual ~DtNavBot()
Definition: navBot.h:105
PathStatus
Definition: navBot.h:134
bool myEnableStop
Definition: navBot.h:88
Calculating a transition point.
Definition: navBot.h:143
DtNavTagAndLocation()
Definition: navBot.h:27
DtNavTagAndLocation(const DtNavTag &t, const DtVector &l)
Definition: navBot.h:26
NavigationMethod myNavigationMethod
Definition: navBot.h:52
bool myUseAbstractGraph
Indicates whether the abstract graph should be used for planning. Abstract graph allows for longer pa...
Definition: navBot.h:55
NavigationMethod
Definition: navBot.h:35
Arrived at edge of area.
Definition: navBot.h:142

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)