VR-Forces Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
luaNavJob.h
Go to the documentation of this file.
1 /*******************************************************************************
2 ** Copyright (c) 2015 MAK Technologies, Inc.
3 ** All rights reserved.
4 *******************************************************************************/
5 
6 #pragma once
7 
8 #include "vrfLua/vrfLuaDefines.h"
9 #include "vrfLua/luaAsyncJob.h"
10 #include "vrfutil/scriptGeometry.h"
14 #include "vrfNavigation/navArea.h"
16 #include "vrfutil/rwUUID.h"
17 #include "vrfutil/movementModes.h"
18 
19 #include <luabind/luabind.hpp>
20 
21 class DtSimObject;
22 class DtCoverPointFinder;
24 
27 {
28 public:
29  typedef std::list<DtLocation3D> Points;
30 
32  DtLuaNavJob();
33 
35  ~DtLuaNavJob();
36 
38  virtual luabind::object getObject(lua_State* L, int& index, std::string& message) = 0;
39 
41  virtual luabind::object getDebugObject(lua_State* L) { return luabind::newtable(L); };
42 
44  virtual void cancel(lua_State* L) {};
45 
47  void addMessage(DtAlgorithmManager::Severity, std::string);
48 
52 
53  virtual DtString serialize();
54  virtual bool deserialize(const DtString&);
55 
56  virtual DtString objectType() const = 0;
57 
58  //Tick the job.
59  virtual void run(const DtAlgorithmManager& mgr = DtAlgorithmManager()) = 0;
60 
61  virtual bool complete();
62 
63 protected:
64 
68  DtString navigationProfile,
69  DtLocation3D startPoint,
70  DtLocation3D accessPoint = DtLocation3D(DtVector::zero()),
71  Points boundingArea = Points());
72 
73  //Initialize the job. This version must be called by derived start functions.
74  virtual void start();
75 
77  virtual void taskComplete() = 0;
78 
79  //Common parameters for nav jobs.
84 
85  std::string myMessage;
86  bool myStarted = false;
87 
89 };
90 
94 {
95 public:
96  static boost::shared_ptr<DtLuaNavRandomPointJob> Make(
98  DtString navigationProfile,
99  DtLocation3D startPoint,
100  double minDistanceFromStart,
101  double maxDistanceFromStart,
102  DtLocation3D accessPoint = DtLocation3D(DtVector::zero()),
103  Points boundingArea = Points(),
104  int numberOfPoints = 1,
105  double minDistanceBetweenPoints = 0.0,
106  DtString placementRestriction = DtMovementModeFree,
107  bool isStrict = true,
108  bool tightlyPack = false,
109  bool needLos = false,
110  bool groundClamp = false,
111  Points leftOfLine = Points(),
112  const DtSimObject* parentObject = 0);
113 
116 
119 
121  virtual luabind::object getObject(lua_State* L, int& index, std::string& message);
122 
125  virtual luabind::object getDebugObject(lua_State* L);
126 
128  virtual void cancel(lua_State* L);
129 
133 
134  static DtAsciiSerializable* creator();
135 
136  //Returns LuaNavRandomPointJob
137  virtual DtString objectType() const { return DtLuaNavRandomPointJobType; };
138 
139  //Initialize the job.
140  virtual void start();
141 
142  //Tick the job.
143  virtual void run(const DtAlgorithmManager& mgr = DtAlgorithmManager());
144 
147  virtual bool beginPointGeneration();
148 
149  //Returns true when the job is done.
150  virtual bool complete();
151 
153  virtual void taskComplete();
154 
155 protected:
156 
160  DtString navigationProfile,
161  DtLocation3D startPoint,
162  double minDistanceFromStart,
163  double maxDistanceFromStart,
164  DtLocation3D accessPoint = DtLocation3D(DtVector::zero()),
165  Points boundingArea = Points(),
166  int numberOfPoints = 1,
167  double minDistanceBetweenPoints = 0.0,
168  DtString placementRestriction = DtMovementModeFree,
169  bool isStrict = true,
170  bool tightlyPack = false,
171  bool needLos = false,
172  bool groundClamp = false,
173  Points leftOfLine = Points(),
174  const DtSimObject* parentObject = 0);
175 
183  bool myNeedLos;
189  bool myRanOnce;
196 };
197 
200 {
201 public:
202  static boost::shared_ptr<DtLuaNavPointOfInterestJob> Make(
204  DtString navigationProfile,
205  DtLocation3D startPoint,
206  DtUUID hostUuid,
207  int navTag = -1);
208 
211 
214 
216  virtual luabind::object getObject(lua_State* L, int& index, std::string& message);
217 
221 
222  static DtAsciiSerializable* creator();
223 
224  //Returns LuaNavRandomPointJob
225  virtual DtString objectType() const { return DtLuaNavRandomPointJobType; };
226 
227  //Initialize the job.
228  virtual void start();
229 
230  //Tick the job.
231  virtual void run(const DtAlgorithmManager& mgr = DtAlgorithmManager());
232 
234  virtual void taskComplete();
235 
236 protected:
237 
241  DtString navigationProfile,
242  DtLocation3D startPoint,
243  int navTag = -1);
244 
245  int myNavTag;
248 };
249 
252 {
253 public:
254  static boost::shared_ptr<DtLuaNavCoverPointJob> Make(
256  DtString navigationProfile,
257  DtLocation3D startPoint,
258  DtLocation3D coverFromPoint,
259  double threatRadius,
260  double distanceFromThreat,
261  double range,
262  unsigned numberOfPoints,
263  unsigned int queryQueuePriority);
264 
267 
270 
272  virtual luabind::object getObject(lua_State* L, int& index, std::string& message);
273 
277 
278  static DtAsciiSerializable* creator();
279 
280  //Returns LuaNavCoverPointJob
281  virtual DtString objectType() const { return DtLuaNavCoverPointJobType; };
282 
283  //Initialize the job.
284  virtual void start();
285 
286  //Tick the job.
287  virtual void run(const DtAlgorithmManager& mgr = DtAlgorithmManager());
288 
290  virtual void taskComplete();
291 
292 protected:
293 
297  DtString navigationProfile,
298  DtLocation3D startPoint,
299  DtLocation3D threatPoint,
300  double threatRadius,
301  double distanceFromThreat,
302  double range,
303  unsigned numberOfPoints,
304  unsigned int queryQueuePriority);
305 
308  double myRange;
310  std::set<DtCoverPoint> myResultPoints;
314 
315  boost::shared_ptr<DtCoverPointFinder> myPendingCoverPointFinder;
316 };
317 
320 {
321 public:
322  static boost::shared_ptr<DtLuaNavFindPathJob> Make(DtSimulationServices* mgr,
323  DtString navigationProfile,
324  DtLocation3D startPoint,
325  DtLocation3D endPoint,
326  bool useAbstractGraphs,
327  const DtLocation3D& avoidLocation, double avoidanceRadius,
328  DtActiveBotNavInterface* navIf = 0);
329 
332 
335 
337  virtual luabind::object getObject(lua_State* L, int& index, std::string& message);
338 
340  virtual luabind::object getDebugObject(lua_State* L);
341 
345 
346  static DtAsciiSerializable* creator();
347 
348  //Returns LuaNavCoverPointJob
349  virtual DtString objectType() const { return DtLuaNavCoverPointJobType; };
350 
351  //Initialize the job.
352  virtual void start();
353 
354  //Tick the job.
355  virtual void run(const DtAlgorithmManager& mgr = DtAlgorithmManager());
356 
358  virtual void taskComplete();
359 
360 protected:
361 
364  DtString navigationProfile,
365  DtLocation3D startPoint,
366  DtLocation3D endPoint,
367  bool useAbstractGraphs,
368  const DtLocation3D& avoidLocation, double avoidanceRadius,
369  DtActiveBotNavInterface* navIf = 0);
370 
377  double myPathCost;
379 
381 };
382 
384 {
385 public:
388  virtual void tick();
389  virtual void addJob(boost::shared_ptr<DtLuaNavJob> job);
390 protected:
391  std::list<boost::shared_ptr<DtLuaNavJob> > myJobs;
392 };
UUID is a unique ID wrapper class.
Definition: uuid.h:59
bool myGenerated
Definition: luaNavJob.h:378
const DtString DtLuaNavCoverPointJobType
Definition: asciiSerializable.h:24
const char DtMovementModeFree[]
Definition: movementModes.h:11
Points myDebugPoints
Definition: luaNavJob.h:380
int myNavTag
Definition: luaNavJob.h:245
Severity
Definition: algorithmManager.h:29
virtual void addJob(boost::shared_ptr< DtLuaNavJob > job)
Lua object class which represents a feature navigation task.
Definition: luaNavJob.h:199
double myMinDistanceBetweenPoints
Definition: luaNavJob.h:179
bool myRanOnce
Definition: luaNavJob.h:189
DtLocation3D myThreatPoint
Definition: luaNavJob.h:309
std::list< DtLocation3D > Points
Definition: luaNavJob.h:29
Lua object class which finds a path to the specified location.
Definition: luaNavJob.h:319
This is the DtVrfObjectNavInterface subclass for objects which are actively querying the navigation s...
Definition: activeBotNavInterface.h:27
virtual void run(const DtAlgorithmManager &mgr=DtAlgorithmManager())=0
unsigned myQueryQueuePriority
Definition: luaNavJob.h:312
Lua object class which represents a feature navigation task.
Definition: luaNavJob.h:26
bool myIsStrict
Definition: luaNavJob.h:181
virtual luabind::object getObject(lua_State *L, int &index, std::string &message)=0
Retrieve value.
Points myPathPoints
Definition: luaNavJob.h:372
Definition: asciiSerializable.h:38
Interface for getting asynchronously computed data into Lua.
Definition: luaAsyncJob.h:29
virtual bool deserialize(const DtString &)=0
This function should take the string that was serialized via serialize() and fill this object with th...
unsigned myNumberOfPoints
Definition: luaNavJob.h:311
int myNumberOfPoints
Definition: luaNavJob.h:176
virtual DtString objectType() const
Should return the string name of this object. The object name should not be part of the serialization...
Definition: luaNavJob.h:137
boost::shared_ptr< DtCoverPointFinder > myPendingCoverPointFinder
Definition: luaNavJob.h:315
Contains the DtUUID class declaration.
std::list< boost::shared_ptr< DtLuaNavJob > > myJobs
Definition: luaNavJob.h:391
virtual void taskComplete()=0
Called by task object whenever it is done.
virtual DtString serialize()=0
The following characters are reserved and cannot be used in serialization: &#39;|&#39;, &#39;:&#39;.
double myAvoidanceRadius
Definition: luaNavJob.h:375
virtual void start()
double myThreatRadius
Definition: luaNavJob.h:306
virtual void cancel(lua_State *L)
Cancels the job. By default this is a no-op, we let the job finish on its own.
Definition: luaNavJob.h:44
virtual DtString objectType() const
Should return the string name of this object. The object name should not be part of the serialization...
Definition: luaNavJob.h:349
DtLocation3D myStartPoint
Definition: luaNavJob.h:81
std::list< DtLocation3D > Points
Definition: luaTerrainReasoningJob.h:290
Points myBoundingArea
Definition: luaNavJob.h:83
std::set< DtCoverPoint > myResultPoints
Definition: luaNavJob.h:310
DtLocation3D myEndPoint
Definition: luaNavJob.h:371
const DtSimObject * myParentObject
Definition: luaNavJob.h:188
Definition: asyncJobServer.h:37
bool myGenerated
Definition: luaNavJob.h:190
DtLocation3D myAvoidLocation
Definition: luaNavJob.h:374
Lua object class for finding random points within a nav area.
Definition: luaNavJob.h:93
double myMinDistanceFromStart
Definition: luaNavJob.h:177
bool myNoNavArea
Definition: luaNavJob.h:192
bool myGenerated
Definition: luaNavJob.h:247
bool myGenerated
Definition: luaNavJob.h:313
bool myUseAbstractGraphs
Definition: luaNavJob.h:373
DtLocation3D myResultPoint
Definition: luaNavJob.h:246
DtLocalVertexList myBoundary
Definition: luaNavJob.h:194
#define DT_DLL_vrfLua
This file is used to determine how to build.
Definition: vrfLuaDefines.h:25
Lua object class which finds a cover point from the specified location.
Definition: luaNavJob.h:251
const DtString DtLuaNavRandomPointJobType
Definition: asciiSerializable.h:23
double myMaxDistanceFromStart
Definition: luaNavJob.h:178
std::string myMessage
Definition: luaNavJob.h:85
DtLocation3D myAccessPoint
Definition: luaNavJob.h:82
boost::shared_ptr< DtNavAreaQuery > Ptr
Definition: navArea.h:60
virtual luabind::object getObject(lua_State *L, int &index, std::string &message)=0
Retrieve current value.
DtLocalVertexList myLeftOfLineVertices
Definition: luaNavJob.h:195
double myRange
Definition: luaNavJob.h:308
Points myResultPoints
Definition: luaNavJob.h:186
virtual DtString objectType() const =0
Should return the string name of this object. The object name should not be part of the serialization...
bool myTightlyPack
Definition: luaNavJob.h:182
Central access point of all non-object-specific the services and managers that are available for use ...
Definition: simulationServices.h:94
double myDistanceFromThreat
Definition: luaNavJob.h:307
Represents a single simulation object in the exercise. Object may be VRF simulation, or non-VRF simulated, and may be simulated by the local sim engine, or by a remote sim engine. Only public (external) state of the object is available. All data is read-only. All access to data of the object is thread safe within the simulation frame.
Definition: simObject.h:88
double myPathCost
Definition: luaNavJob.h:377
bool myNeedLos
Definition: luaNavJob.h:183
virtual void tick()
bool myGroundClamp
Definition: luaNavJob.h:184
virtual luabind::object getDebugObject(lua_State *L)
Retrieve debug data, if available. Default behavior is an empty table.
Definition: luaNavJob.h:41
Points myLeftOfLine
Definition: luaNavJob.h:185
DtString myNavigationProfile
Definition: luaNavJob.h:80
virtual bool complete()
virtual DtString objectType() const
Should return the string name of this object. The object name should not be part of the serialization...
Definition: luaNavJob.h:281
class DtLocalVertexList:
Definition: localVertexList.h:20
DtNavAreaQuery::Ptr myQuery
Definition: luaNavJob.h:88
Definition: luaNavJob.h:383
Points myDebugPoints
Definition: luaNavJob.h:187
virtual DtString objectType() const
Should return the string name of this object. The object name should not be part of the serialization...
Definition: luaNavJob.h:225
bool myDataAvailable
Definition: luaNavJob.h:191
Used to find the best cover point(s) to take cover from attacker at a specified location. If myBestCoverPoint is not DtVector::zero(), it will be the cover point to use.
Definition: coverPointFinder.h:36
DtVector myLocalAccessPoint
Definition: luaNavJob.h:193
DtActiveBotNavInterface * myNavIf
Definition: luaNavJob.h:376
General interface which can be passed into an algorithm to control its behavior.
Definition: algorithmManager.h:24
A location3D is a point in space, i.e. a geocentric coordinate.
Definition: scriptGeometry.h:22
DtString myPlacementRestriction
Definition: luaNavJob.h:180

Document ID: Generated on Wed Mar 27 22:49:11 EDT 2024 from SVN revision 264633
Copyright © 2005-2024 MAK Technologies. All Rights Reserved (www.mak.com)