VR-Forces 5.0.1 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 
13 #include <string>
14 #include "matrix/vlVector.h"
15 
16 #include <vrfutil/rwBinaryData.h>
17 
18 class DtNavArea;
19 
21 {
24 
25  DtNavTagAndLocation(const DtNavTag& t, const DtVector& l) : navTag(t), location(l) {}
27 };
28 typedef std::vector<DtNavTagAndLocation> DtNavTagAndLocationList;
29 typedef unsigned int DtNavigationPriorityType;
30 
32 {
33 public:
35  {
36  NavigationMethodShortcut = 0,
37  NavigationMethodSpline = 1
38  };
39 
41  {
43  : myNavigationMethod(NavigationMethodShortcut)
44  , myUseAbstractGraph(true)
45  , myMinAbstractGraphReplanDistance(100.)
46  , myPropagationBoxExtent(200.)
47  , myRadiusFactor(1.0)
48  , myEnablePathPlanTiming(false)
49  {}
50 
67  };
68 
70  {
73  : myEnableAvoidance(true)
74  , myEnableStop(true)
75  , myEnableSlowDown(true)
76  , myEnablePushThrough(false)
77  , myEnableNavigation(true)
78  , myCollisionLookaheadTime(15.)
79  , myCollisionDetectionRadius(15.)
80  , myAngleEvalSpan(120)
81  , myNumAngleSamples(30)
82  , mySafetyDistance((float)0.1)
83  , myCollisionAvoidanceInfluence((float)0.8)
84  {}
85 
97  };
98 
99  typedef DtNavBot* (*DtNavBotCreatorFcn)();
100 
101  static DtNavBot* create();
102  static void setNavBotCreatorFcn(DtNavBotCreatorFcn fcn);
103 
104  virtual ~DtNavBot() {};
105 
106  virtual void init(DtNavArea* world, const DtString& profile, double radius, double height, DtNavigationPriorityType queryQueuePriority,
107  NavigationConfiguration navConfig = NavigationConfiguration(),
108  CollisionAvoidanceConfiguration collAvoidConfig = CollisionAvoidanceConfiguration()) = 0;
109 
110  virtual void setPosition(const DtVector& localPos) = 0;
111  virtual void setPositionInvalid() = 0;
112  virtual void setQueryQueuePriority(const DtNavigationPriorityType& queryQueuePriority) = 0;
113  virtual void botUpdate(const DtVector& localPos, double dT) = 0;
114 
115  virtual void setDestination(const DtVector& localPos, bool forceOutsideArea = false) = 0;
116  virtual void setDesiredSpeed(double speed) = 0;
117  virtual void clearFollowedPath() = 0;
118  virtual void clearDestination() = 0;
119  virtual DtVector currentDestination() const = 0;
120 
121  virtual void resetDestination() = 0;
122 
123  virtual int getTriangleIndex() const = 0;
124  virtual void getTriangleVertices(DtVector& corner1, DtVector& corner2, DtVector& corner3) const = 0;
125  virtual DtVector getPointOnTriangle(const DtVector& localLocation) const = 0;
126 
127  virtual DtVector getOutputVelocity() = 0;
128 
129  typedef bool (*DtNavBotPathLocationEvalFcn)(const DtNavTag& navTag, float slope, float elevationChange, float* costMultiplier, void* userData);
130 
131  virtual void setPathEvalFcn(DtNavBotPathLocationEvalFcn fcn, void* user) = 0;
132 
134  {
144  };
145 
146  virtual PathStatus pathStatus(double atDistance) = 0;
148  virtual DtString pathStatusString() = 0;
149 
150  virtual bool hasArrived(double arrivalDistance) = 0;
151 
152  virtual bool currentPath(std::vector<DtVector>& path) = 0;
153  virtual bool abstractPath(std::vector<DtVector>& path) = 0;
154 
155  virtual bool currentPathEdge(DtVector& edgeStart, DtVector& edgeEnd) = 0;
156 
157  virtual void getNavPathAsRw(DtRwBinaryData&) = 0;
158 
160  virtual bool setPath(DtRwBinaryData&) = 0;
161 
162  virtual unsigned currentAbstractPathIndex() = 0;
163 
165  virtual DtNavTag navTagAtPosition(const DtVector& localPos) const = 0;
166 
168  virtual DtNavTag upcomingNavTagOnPath() const = 0;
169 
171  virtual void upcomingNavTagsOnPath(double distance, DtNavTagAndLocationList& navTags) const = 0;
172 
175  virtual void setCollisionAvoidanceEnabled(bool enable) = 0;
176 
177  virtual void setNavigationMethod(NavigationMethod navMethod) = 0;
178  virtual NavigationMethod navigationMethod() const = 0;
179 
182  virtual DtVector performMovement(double dt) = 0;
183 
186  virtual DtVector groundClamp(const DtVector& localPos, DtVector& normal) = 0;
187 
188 protected:
189  static DtNavBotCreatorFcn theNavBotCreatorFcn;
190 };
191 
float myCollisionAvoidanceInfluence
Definition: navBot.h:96
Has a valid path to move along.
Definition: navBot.h:138
bool myEnablePushThrough
Definition: navBot.h:89
static DtNavBotCreatorFcn theNavBotCreatorFcn
Definition: navBot.h:189
float mySafetyDistance
Definition: navBot.h:95
bool myEnableAvoidance
Definition: navBot.h:86
Has arrived at destination.
Definition: navBot.h:139
Not actively trying to move.
Definition: navBot.h:136
double myMinAbstractGraphReplanDistance
Only relevant if using abstract graphs. Entity will replan when the distance to the current abstract ...
Definition: navBot.h:57
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:88
bool myEnablePathPlanTiming
For debugging and performance testing. Prints the time it takes to perform path planning.
Definition: navBot.h:66
This is a rw class to save out a block of generic binary data.
Definition: rwBinaryData.h:18
NavigationConfiguration()
Definition: navBot.h:42
float myCollisionLookaheadTime
Definition: navBot.h:91
bool myEnableNavigation
Definition: navBot.h:90
double myRadiusFactor
Factor multiplied by the bounding volume radius to generate the nav bot&#39;s radius. Increasing this wil...
Definition: navBot.h:64
Failed to calculate a path.
Definition: navBot.h:140
float myAngleEvalSpan
Definition: navBot.h:93
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:94
This class contains all the data and logic for navigation within a specific area. Nav Data may be loa...
Definition: navArea.h:206
DtVector location
Definition: navBot.h:23
Currently computing a path.
Definition: navBot.h:137
Failed to calculate a path, destination is outside nav.
Definition: navBot.h:143
float myCollisionDetectionRadius
Definition: navBot.h:92
DtNavTag navTag
Definition: navBot.h:22
Definition: navBot.h:135
Definition: navBot.h:40
Definition: navBot.h:20
Definition: navBot.h:31
CollisionAvoidanceConfiguration()
Sets defaults.
Definition: navBot.h:72
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:61
#define DT_DLL_vrfNavigation
This file is used to determine how to build.
Definition: vrfNavigationDefines.h:26
virtual ~DtNavBot()
Definition: navBot.h:104
PathStatus
Definition: navBot.h:133
bool myEnableStop
Definition: navBot.h:87
Calculating a transition point.
Definition: navBot.h:142
DtNavTagAndLocation()
Definition: navBot.h:26
DtNavTagAndLocation(const DtNavTag &t, const DtVector &l)
Definition: navBot.h:25
NavigationMethod myNavigationMethod
Definition: navBot.h:51
bool myUseAbstractGraph
Indicates whether the abstract graph should be used for planning. Abstract graph allows for longer pa...
Definition: navBot.h:54
NavigationMethod
Definition: navBot.h:34
Arrived at edge of area.
Definition: navBot.h:141

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)