VR-Forces 4.10 Class Documentation
 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 class DtNavArea;
17 
19 {
22 
23  DtNavTagAndLocation(const DtNavTag& t, const DtVector& l) : navTag(t), location(l) {}
25 };
26 typedef std::vector<DtNavTagAndLocation> DtNavTagAndLocationList;
27 typedef unsigned int DtNavigationPriorityType;
28 
30 {
31 public:
33  {
34  NavigationMethodShortcut = 0,
35  NavigationMethodSpline = 1
36  };
37 
39  {
41  : myNavigationMethod(NavigationMethodShortcut)
42  , myUseAbstractGraph(true)
43  , myMinAbstractGraphReplanDistance(100.)
44  , myPropagationBoxExtent(200.)
45  , myRadiusFactor(1.0)
46  {}
47 
62  };
63 
65  {
68  : myEnableAvoidance(true)
69  , myEnableStop(true)
70  , myEnableSlowDown(true)
71  , myEnablePushThrough(false)
72  , myEnableNavigation(true)
73  , myCollisionLookaheadTime(15.)
74  , myCollisionDetectionRadius(15.)
75  , myAngleEvalSpan(120)
76  , myNumAngleSamples(30)
77  , mySafetyDistance((float)0.1)
78  , myCollisionAvoidanceInfluence((float)0.8)
79  {}
80 
92  };
93 
94  typedef DtNavBot* (*DtNavBotCreatorFcn)();
95 
96  static DtNavBot* create();
97  static void setNavBotCreatorFcn(DtNavBotCreatorFcn fcn);
98 
99  virtual ~DtNavBot() {};
100 
101  virtual void init(DtNavArea* world, const DtString& profile, double radius, double height, DtNavigationPriorityType queryQueuePriority,
102  NavigationConfiguration navConfig = NavigationConfiguration(),
103  CollisionAvoidanceConfiguration collAvoidConfig = CollisionAvoidanceConfiguration()) = 0;
104 
105  virtual void setPosition(const DtVector& localPos) = 0;
106  virtual void setPositionInvalid() = 0;
107  virtual void setQueryQueuePriority(const DtNavigationPriorityType& queryQueuePriority) = 0;
108  virtual void botUpdate(const DtVector& localPos, double dT) = 0;
109 
110  virtual void setDestination(const DtVector& localPos, bool forceOutsideArea = false) = 0;
111  virtual void setDesiredSpeed(double speed) = 0;
112  virtual void clearFollowedPath() = 0;
113  virtual void clearDestination() = 0;
114 
115  virtual void resetDestination() = 0;
116 
117  virtual void moveAlongPath(const std::vector<DtVector>&) = 0;
118 
119  virtual DtVector getOutputVelocity() = 0;
120 
121  typedef bool (*DtNavBotPathLocationEvalFcn)(const DtNavTag& navTag, float slope, float elevationChange, float* costMultiplier, void* userData);
122 
123  virtual void setPathEvalFcn(DtNavBotPathLocationEvalFcn fcn, void* user) = 0;
124 
126  {
136  };
137 
138  virtual PathStatus pathStatus(double atDistance) = 0;
140  virtual DtString pathStatusString() = 0;
141 
142  virtual bool hasArrived(double arrivalDistance) = 0;
143 
144  virtual bool currentPath(std::vector<DtVector>& path) = 0;
145  virtual bool abstractPath(std::vector<DtVector>& path) = 0;
146 
147  virtual bool currentPathEdge(DtVector& edgeStart, DtVector& edgeEnd) = 0;
148 
149  virtual unsigned currentAbstractPathIndex() = 0;
150 
152  virtual DtNavTag navTagAtPosition(const DtVector& localPos) const = 0;
153 
155  virtual DtNavTag upcomingNavTagOnPath() const = 0;
156 
158  virtual void upcomingNavTagsOnPath(double distance, DtNavTagAndLocationList& navTags) const = 0;
159 
162  virtual void setCollisionAvoidanceEnabled(bool enable) = 0;
163 
164  virtual void setNavigationMethod(NavigationMethod navMethod) = 0;
165  virtual NavigationMethod navigationMethod() const = 0;
166 
169  virtual DtVector performMovement(double dt) = 0;
170 
173  virtual DtVector groundClamp(const DtVector& localPos, DtVector& normal) = 0;
174 
175 protected:
176  static DtNavBotCreatorFcn theNavBotCreatorFcn;
177 };
float myCollisionAvoidanceInfluence
Definition: navBot.h:91
Has a valid path to move along.
Definition: navBot.h:130
bool myEnablePushThrough
Definition: navBot.h:84
static DtNavBotCreatorFcn theNavBotCreatorFcn
Definition: navBot.h:176
float mySafetyDistance
Definition: navBot.h:90
bool myEnableAvoidance
Definition: navBot.h:81
Has arrived at destination.
Definition: navBot.h:131
Not actively trying to move.
Definition: navBot.h:128
double myMinAbstractGraphReplanDistance
Only relevant if using abstract graphs.
Definition: navBot.h:54
Wrapper for GameWare NavTag.
Definition: navDataTag.h:54
bool myEnableSlowDown
Definition: navBot.h:83
NavigationConfiguration()
Definition: navBot.h:40
float myCollisionLookaheadTime
Definition: navBot.h:86
bool myEnableNavigation
Definition: navBot.h:85
double myRadiusFactor
Factor multiplied by the bounding volume radius to generate the nav bot&#39;s radius. ...
Definition: navBot.h:61
Failed to calculate a path.
Definition: navBot.h:132
float myAngleEvalSpan
Definition: navBot.h:88
DT_DLL_VRVCORE double distance(const makVrv::DtCoordinateSystem &, const DtVector &from, const DtVector &to)
Returns the distance from the two points.
int myNumAngleSamples
Definition: navBot.h:89
Contains all the data and logic for navigation within a specific area.
Definition: navArea.h:181
DtVector location
Definition: navBot.h:21
Currently computing a path.
Definition: navBot.h:129
Failed to calculate a path, destination is outside nav.
Definition: navBot.h:135
float myCollisionDetectionRadius
Definition: navBot.h:87
DtNavTag navTag
Definition: navBot.h:20
Definition: navBot.h:127
Definition: navBot.h:38
Definition: navBot.h:18
Definition: navBot.h:29
CollisionAvoidanceConfiguration()
Sets defaults.
Definition: navBot.h:67
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.
Definition: navBot.h:58
#define DT_DLL_vrfNavigation
This file is used to determine how to build.
Definition: vrfNavigationDefines.h:26
virtual ~DtNavBot()
Definition: navBot.h:99
PathStatus
Definition: navBot.h:125
bool myEnableStop
Definition: navBot.h:82
Calculating a transition point.
Definition: navBot.h:134
DtNavTagAndLocation()
Definition: navBot.h:24
DtNavTagAndLocation(const DtNavTag &t, const DtVector &l)
Definition: navBot.h:23
NavigationMethod myNavigationMethod
Definition: navBot.h:48
bool myUseAbstractGraph
Indicates whether the abstract graph should be used for planning.
Definition: navBot.h:51
NavigationMethod
Definition: navBot.h:32
Arrived at edge of area.
Definition: navBot.h:133

Document ID: Generated on Tue Sep 21 17:42:52 EDT 2021 from SVN revision 234861
Copyright © 2005-2021 MAK Technologies. All Rights Reserved (www.mak.com)