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"
20 
21 #include <luabind/luabind.hpp>
22 
23 class DtSimObject;
24 class DtCoverPointFinder;
26 
29 {
30 public:
31  typedef std::list<DtLocation3D> Points;
32 
34  DtLuaNavJob();
35 
37  virtual ~DtLuaNavJob() override;
38 
40  virtual luabind::object getObject(lua_State* L, int& index, std::string& message) override = 0;
41 
43  virtual luabind::object getDebugObject(lua_State* L) override { return luabind::newtable(L); };
44 
46  virtual void cancel(lua_State* L) override {};
47 
49  void addMessage(DtAlgorithmManager::Severity, std::string);
50 
54 
55  virtual DtString serialize() override;
56  virtual bool deserialize(const DtString&) override;
57 
58  virtual DtString objectType() const override = 0;
59 
60  //Tick the job.
61  virtual void run(const DtAlgorithmManager& mgr = DtAlgorithmManager()) = 0;
62 
63  virtual bool complete();
64 
65 protected:
66 
70  DtString navigationProfile,
71  DtLocation3D startPoint,
72  DtLocation3D accessPoint = DtLocation3D(DtVector::zero()),
73  Points boundingArea = Points());
74 
75  //Initialize the job. This version must be called by derived start functions.
76  virtual void start();
77 
79  virtual void taskComplete() = 0;
80 
81  //Common parameters for nav jobs.
86 
87  std::string myMessage;
88  bool myStarted = false;
89 
91 };
92 
96 {
97 public:
98  static std::shared_ptr<DtLuaNavRandomPointJob> Make(
100  DtString navigationProfile,
101  DtLocation3D startPoint,
102  double minDistanceFromStart,
103  double maxDistanceFromStart,
104  DtLocation3D accessPoint = DtLocation3D(DtVector::zero()),
105  Points boundingArea = Points(),
106  int numberOfPoints = 1,
107  double minDistanceBetweenPoints = 0.0,
108  DtString placementRestriction = DtMovementModeFree,
109  bool isStrict = true,
110  bool tightlyPack = false,
111  bool needLos = false,
112  bool groundClamp = false,
113  Points leftOfLine = Points(),
114  const DtSimObject* parentObject = 0);
115 
118 
120  virtual ~DtLuaNavRandomPointJob() override;
121 
123  virtual luabind::object getObject(lua_State* L, int& index, std::string& message) override;
124 
127  virtual luabind::object getDebugObject(lua_State* L) override;
128 
130  virtual void cancel(lua_State* L) override;
131 
135 
136  static DtAsciiSerializable* creator();
137 
138  //Returns LuaNavRandomPointJob
139  virtual DtString objectType() const override { return DtLuaNavRandomPointJobType; };
140 
141  //Initialize the job.
142  virtual void start() override;
143 
144  //Tick the job.
145  virtual void run(const DtAlgorithmManager& mgr = DtAlgorithmManager()) override;
146 
149  virtual bool beginPointGeneration();
150 
151  //Returns true when the job is done.
152  virtual bool complete() override;
153 
155  virtual void taskComplete() override;
156 
157 protected:
158 
162  DtString navigationProfile,
163  DtLocation3D startPoint,
164  double minDistanceFromStart,
165  double maxDistanceFromStart,
166  DtLocation3D accessPoint = DtLocation3D(DtVector::zero()),
167  Points boundingArea = Points(),
168  int numberOfPoints = 1,
169  double minDistanceBetweenPoints = 0.0,
170  DtString placementRestriction = DtMovementModeFree,
171  bool isStrict = true,
172  bool tightlyPack = false,
173  bool needLos = false,
174  bool groundClamp = false,
175  Points leftOfLine = Points(),
176  const DtSimObject* parentObject = 0);
177 
185  bool myNeedLos;
191  bool myRanOnce;
198 };
199 
202 {
203 public:
204  static std::shared_ptr<DtLuaNavPointOfInterestJob> Make(
206  DtString navigationProfile,
207  DtLocation3D startPoint,
208  DtUUID hostUuid,
209  int navTag = -1);
210 
213 
215  virtual ~DtLuaNavPointOfInterestJob() override;
216 
218  virtual luabind::object getObject(lua_State* L, int& index, std::string& message) override;
219 
223 
224  static DtAsciiSerializable* creator();
225 
226  //Returns LuaNavRandomPointJob
227  virtual DtString objectType() const override { return DtLuaNavRandomPointJobType; };
228 
229  //Initialize the job.
230  virtual void start() override;
231 
232  //Tick the job.
233  virtual void run(const DtAlgorithmManager& mgr = DtAlgorithmManager()) override;
234 
236  virtual void taskComplete() override;
237 
238 protected:
239 
243  DtString navigationProfile,
244  DtLocation3D startPoint,
245  int navTag = -1);
246 
247  int myNavTag;
250 };
251 
254 {
255 public:
256  static std::shared_ptr<DtLuaNavCoverPointJob> Make(
258  DtString navigationProfile,
259  DtLocation3D startPoint,
260  DtLocation3D coverFromPoint,
261  double threatRadius,
262  double distanceFromThreat,
263  double range,
264  unsigned numberOfPoints,
265  unsigned int queryQueuePriority);
266 
269 
271  virtual ~DtLuaNavCoverPointJob() override;
272 
274  virtual luabind::object getObject(lua_State* L, int& index, std::string& message) override;
275 
279 
280  static DtAsciiSerializable* creator();
281 
282  //Returns LuaNavCoverPointJob
283  virtual DtString objectType() const override { return DtLuaNavCoverPointJobType; };
284 
285  //Initialize the job.
286  virtual void start() override;
287 
288  //Tick the job.
289  virtual void run(const DtAlgorithmManager& mgr = DtAlgorithmManager()) override;
290 
292  virtual void taskComplete() override;
293 
294 protected:
295 
299  DtString navigationProfile,
300  DtLocation3D startPoint,
301  DtLocation3D threatPoint,
302  double threatRadius,
303  double distanceFromThreat,
304  double range,
305  unsigned numberOfPoints,
306  unsigned int queryQueuePriority);
307 
310  double myRange;
312  std::set<DtCoverPoint> myResultPoints;
316 
317  std::shared_ptr<DtCoverPointFinder> myPendingCoverPointFinder;
318 };
319 
321 {
322  bool useAbstractGraphs = true;
323  bool useChannels = false;
324  double channelRadius = 4.0;
326  double avoidanceRadius = 0.0;
330 };
331 
334 {
335 public:
336  static std::shared_ptr<DtLuaNavFindPathJob> Make(DtSimulationServices* mgr,
337  DtLocation3D startPoint,
338  DtLocation3D endPoint,
339  DtLuaNavFindPathParameters& parameters);
340 
343 
345  virtual ~DtLuaNavFindPathJob() override;
346 
348  virtual luabind::object getObject(lua_State* L, int& index, std::string& message) override;
349 
351  virtual luabind::object getDebugObject(lua_State* L) override;
352 
356 
357  static DtAsciiSerializable* creator();
358 
359  //Returns LuaNavCoverPointJob
360  virtual DtString objectType() const override { return DtLuaNavFindPathJobType; };
361 
362  //Initialize the job.
363  virtual void start() override;
364 
365  //Tick the job.
366  virtual void run(const DtAlgorithmManager& mgr = DtAlgorithmManager()) override;
367 
369  virtual void taskComplete() override;
370 
371 protected:
372 
375  DtLocation3D startPoint,
376  DtLocation3D endPoint,
377  DtLuaNavFindPathParameters& parameters);
378 
388  double myPathCost;
390 
392 };
393 
396 {
397 public:
398  static std::shared_ptr<DtLuaNavPlaceFormationJob> Make(
400  DtString navigationProfile,
401  std::vector<DtLocation3D> formationPoints,
402  double width);
403 
406 
408  virtual ~DtLuaNavPlaceFormationJob() override;
409 
411  virtual luabind::object getObject(lua_State* L, int& index, std::string& message) override;
412 
416 
417  static DtAsciiSerializable* creator();
418 
419  //Returns LuaNavRandomPointJob
420  virtual DtString objectType() const override { return DtLuaNavPlaceFormationJobType; };
421 
422  //Initialize the job.
423  virtual void start() override;
424 
425  //Tick the job.
426  virtual void run(const DtAlgorithmManager& mgr = DtAlgorithmManager()) override;
427 
429  virtual void taskComplete() override;
430 
431 protected:
432 
436  DtString navigationProfile,
437  std::vector<DtLocation3D> formationPoints,
438  double width);
439 
440  std::vector<DtLocation3D> myStartPoints;
441  std::vector<DtLocation3D> myResultPoints;
442  double myWidth;
444 };
445 
449 {
450 public:
451  static std::shared_ptr<DtLuaNavFindExitPointJob> Make(
453  DtString navigationProfile,
454  DtLocation3D startPoint, DtLocation3D endPoint,
455  DtActiveBotNavInterface* myNavIf = nullptr);
456 
459 
461  virtual ~DtLuaNavFindExitPointJob() override;
462 
464  virtual luabind::object getObject(lua_State* L, int& index, std::string& message) override;
465 
469 
470  static DtAsciiSerializable* creator();
471 
472  //Returns LuaNavFindExitPointJob
473  virtual DtString objectType() const override { return DtLuaNavFindExitPointJobType; };
474 
475  //Initialize the job.
476  virtual void start() override;
477 
478  //Tick the job.
479  virtual void run(const DtAlgorithmManager& mgr = DtAlgorithmManager()) override;
480 
482  virtual void taskComplete() override;
483 
484 protected:
485 
489  DtString navigationProfile,
490  DtLocation3D startPoint, DtLocation3D endPoint,
491  DtActiveBotNavInterface* myNavIf = nullptr);
492 
498  bool myFailed;
499 };
500 
502 {
503 public:
506  virtual void tick();
507  virtual void addJob(std::shared_ptr<DtLuaNavJob> job);
508 protected:
509  std::list<std::shared_ptr<DtLuaNavJob> > myJobs;
510 };
double channelRadius
Definition: luaNavJob.h:324
UUID is a unique ID wrapper class.
Definition: uuid.h:59
bool myGenerated
Definition: luaNavJob.h:389
std::shared_ptr< DtCoverPointFinder > myPendingCoverPointFinder
Definition: luaNavJob.h:317
virtual luabind::object getObject(lua_State *L, int &index, std::string &message) override=0
Retrieve value.
constexpr char DtLuaNavRandomPointJobType[]
Definition: asciiSerializable.h:23
const char DtMovementModeFree[]
Definition: movementModes.h:11
Points myDebugPoints
Definition: luaNavJob.h:391
int myNavTag
Definition: luaNavJob.h:247
double avoidanceRadius
Definition: luaNavJob.h:326
Severity
Definition: algorithmManager.h:29
DtLocation3D myEndPoint
Definition: luaNavJob.h:494
virtual DtString objectType() const override
Should return the string name of this object. The object name should not be part of the serialization...
Definition: luaNavJob.h:283
Lua object class which represents a feature navigation task.
Definition: luaNavJob.h:201
double myMinDistanceBetweenPoints
Definition: luaNavJob.h:181
bool myRanOnce
Definition: luaNavJob.h:191
DtLocation3D avoidLocation
Definition: luaNavJob.h:325
DtLocation3D myThreatPoint
Definition: luaNavJob.h:311
std::list< DtLocation3D > Points
Definition: luaNavJob.h:31
Lua object class which finds a path to the specified location.
Definition: luaNavJob.h:333
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:314
Lua object class which represents a feature navigation task.
Definition: luaNavJob.h:28
bool myIsStrict
Definition: luaNavJob.h:183
constexpr char DtLuaNavPlaceFormationJobType[]
Definition: asciiSerializable.h:29
Points myPathPoints
Definition: luaNavJob.h:380
Definition: asciiSerializable.h:42
Interface for getting asynchronously computed data into Lua.
Definition: luaAsyncJob.h:50
bool myGenerated
Definition: luaNavJob.h:497
virtual bool deserialize(const DtString &)=0
This function should take the string that was serialized via serialize() and fill this object with th...
Definition: luaNavJob.h:320
unsigned myNumberOfPoints
Definition: luaNavJob.h:313
int myNumberOfPoints
Definition: luaNavJob.h:178
virtual void cancel(lua_State *L) override
Cancels the job. By default this is a no-op, we let the job finish on its own.
Definition: luaNavJob.h:46
DtNavPathEvalFunction evalFcn
Definition: luaNavJob.h:329
Contains the DtUUID class declaration.
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:385
virtual void start()
virtual DtString objectType() const override
Should return the string name of this object. The object name should not be part of the serialization...
Definition: luaNavJob.h:227
double myThreatRadius
Definition: luaNavJob.h:308
virtual DtString objectType() const override
Should return the string name of this object. The object name should not be part of the serialization...
Definition: luaNavJob.h:139
constexpr char DtLuaNavFindExitPointJobType[]
Definition: asciiSerializable.h:28
DtLocation3D myStartPoint
Definition: luaNavJob.h:83
std::list< DtLocation3D > Points
Definition: luaTerrainReasoningJob.h:290
virtual luabind::object getDebugObject(lua_State *L) override
Retrieve debug data, if available. Default behavior is an empty table.
Definition: luaNavJob.h:43
Points myBoundingArea
Definition: luaNavJob.h:85
std::set< DtCoverPoint > myResultPoints
Definition: luaNavJob.h:312
DtLocation3D myResultPoint
Definition: luaNavJob.h:495
DtLocation3D myEndPoint
Definition: luaNavJob.h:379
const DtSimObject * myParentObject
Definition: luaNavJob.h:190
Definition: asyncJobServer.h:37
bool myGenerated
Definition: luaNavJob.h:192
DtLocation3D myStartPoint
Definition: luaNavJob.h:493
DtLocation3D myAvoidLocation
Definition: luaNavJob.h:384
double myChannelRadius
Definition: luaNavJob.h:383
Lua object class which represents a task to find exit points from a nav area along a chord...
Definition: luaNavJob.h:448
Lua object class for finding random points within a nav area.
Definition: luaNavJob.h:95
constexpr char DtLuaNavCoverPointJobType[]
Definition: asciiSerializable.h:24
double myMinDistanceFromStart
Definition: luaNavJob.h:179
bool useAbstractGraphs
Definition: luaNavJob.h:322
bool myNoNavArea
Definition: luaNavJob.h:194
bool myGenerated
Definition: luaNavJob.h:249
bool myGenerated
Definition: luaNavJob.h:315
bool myUseAbstractGraphs
Definition: luaNavJob.h:381
DtLocation3D myResultPoint
Definition: luaNavJob.h:248
DtLocalVertexList myBoundary
Definition: luaNavJob.h:196
#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:253
double myMaxDistanceFromStart
Definition: luaNavJob.h:180
std::vector< DtLocation3D > myResultPoints
Definition: luaNavJob.h:441
bool myGenerated
Definition: luaNavJob.h:443
std::string myMessage
Definition: luaNavJob.h:87
DtLocation3D myAccessPoint
Definition: luaNavJob.h:84
virtual DtString objectType() const override
Should return the string name of this object. The object name should not be part of the serialization...
Definition: luaNavJob.h:360
virtual luabind::object getObject(lua_State *L, int &index, std::string &message)=0
Retrieve current value.
DtLocalVertexList myLeftOfLineVertices
Definition: luaNavJob.h:197
double myRange
Definition: luaNavJob.h:310
Lua object class which represents a formation placement task.
Definition: luaNavJob.h:395
Points myResultPoints
Definition: luaNavJob.h:188
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:184
std::shared_ptr< DtNavAreaQuery > Ptr
Definition: navArea.h:59
double myWidth
Definition: luaNavJob.h:442
virtual DtString objectType() const override
Should return the string name of this object. The object name should not be part of the serialization...
Definition: luaNavJob.h:473
virtual DtString objectType() const override
Should return the string name of this object. The object name should not be part of the serialization...
Definition: luaNavJob.h:420
Central access point of all non-object-specific the services and managers that are available for use ...
Definition: simulationServices.h:97
double myDistanceFromThreat
Definition: luaNavJob.h:309
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:80
double myPathCost
Definition: luaNavJob.h:388
bool myFailed
Definition: luaNavJob.h:498
bool myNeedLos
Definition: luaNavJob.h:185
virtual void tick()
bool myGroundClamp
Definition: luaNavJob.h:186
DtActiveBotNavInterface * activeNavIf
Definition: luaNavJob.h:328
Points myLeftOfLine
Definition: luaNavJob.h:187
Definition: navInterfaceManager.h:20
DtString myNavigationProfile
Definition: luaNavJob.h:82
virtual bool complete()
std::vector< DtLocation3D > myStartPoints
Definition: luaNavJob.h:440
DtActiveBotNavInterface * myNavIf
Definition: luaNavJob.h:496
class DtLocalVertexList:
Definition: localVertexList.h:20
DtNavPathEvalFunction myPathEval
Definition: luaNavJob.h:387
DtNavAreaQuery::Ptr myQuery
Definition: luaNavJob.h:90
Definition: luaNavJob.h:501
Points myDebugPoints
Definition: luaNavJob.h:189
constexpr char DtLuaNavFindPathJobType[]
Definition: asciiSerializable.h:25
bool myDataAvailable
Definition: luaNavJob.h:193
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:195
DtActiveBotNavInterface * myNavIf
Definition: luaNavJob.h:386
bool useChannels
Definition: luaNavJob.h:323
General interface which can be passed into an algorithm to control its behavior.
Definition: algorithmManager.h:24
virtual void addJob(std::shared_ptr< DtLuaNavJob > job)
bool myUseChannels
Definition: luaNavJob.h:382
std::list< std::shared_ptr< DtLuaNavJob > > myJobs
Definition: luaNavJob.h:509
DtString navigationProfile
Definition: luaNavJob.h:327
A location3D is a point in space, i.e. a geocentric coordinate.
Definition: scriptGeometry.h:22
DtString myPlacementRestriction
Definition: luaNavJob.h:182

Document ID: Generated on Thu Oct 15 21:27:02 EDT 2026 from SVN revision 296421
Copyright © 2005-2026 MAK Technologies. All Rights Reserved (www.mak.com)