gwnavruntime/pathfollower/iavoidancecomputer.h Source File

iavoidancecomputer.h
Go to the documentation of this file.
1 /*
2 * Copyright 2015 Autodesk, Inc. All rights reserved.
3 * Use of this software is subject to the terms of the Autodesk license agreement and any attachments or Appendices thereto provided at the time of installation or download,
4 * or which otherwise accompanies this software in either electronic or hard copy form, or which is signed by you and accepted by Autodesk.
5 */
6 
7 // primary contact: MUBI - secondary contact: LAPA
8 #ifndef Navigation_IAvoidanceComputer_H
9 #define Navigation_IAvoidanceComputer_H
10 
13 
14 namespace Kaim
15 {
16 
17 class Bot;
18 
21 {
30  Avoidance_NoTrajectory
31 };
32 
36 class IAvoidanceComputer: public RefCountBase<IAvoidanceComputer, MemStat_PathFollowing>
37 {
39 
40 public:
41  // ---------------------------------- Public Member Functions ----------------------------------
42 
44 
45  virtual ~IAvoidanceComputer() {}
46 
47  // ---------------------------------- Pure Virtual Functions ----------------------------------
48  virtual AvoidanceResult Compute(
49  Bot& bot, KyFloat32 simulationTimeInSeconds, KyFloat32 desiredSpeed, const Vec2f& movingDirection,
50  Vec2f& avoidanceVelocity, Vec2f& outputFrontDirection, bool& collide) = 0;
51 
52  static const char* GetAvoidanceResultString(AvoidanceResult avoidanceResult)
53  {
54  switch(avoidanceResult)
55  {
57  return "No avoidance";
58  case Avoidance_SlowDown:
59  return "Slow down";
61  return "Accelerate";
62  case Avoidance_Turn:
63  return "Turn";
64  case Avoidance_Stop:
65  return "Stop";
67  return "Solution not found";
69  return "Forcing passage";
71  return "Waiting for force passage";
72  default:
73  return "";
74  };
75  }
76 
77  static const char* GetAvoidanceResultDescription(AvoidanceResult avoidanceResult)
78  {
79  switch(avoidanceResult)
80  {
82  return "The trajectory goes in target direction at the desired speed";
83  case Avoidance_SlowDown:
84  return "The trajectory goes in target direction but at lower speed than the desired one";
86  return "The trajectory goes in target direction but at higher speed than the desired one";
87  case Avoidance_Turn:
88  return "The trajectory deviates from target direction";
89  case Avoidance_Stop:
90  return "The avoidance computer decided that stopping the Bot is the best solution";
92  return "The avoidance computer was not able to find any collision-free solutions";
94  return "The bot decided to force the passage";
96  return "The bot is required to wait for the force passage timer to expire";
97  default:
98  return "";
99  };
100  }
101 
102 public: // internal
103  // Used specifically by the ShortcutTrajectory in order to skip, cf. World::SetNumberOfFramesForShortcutTrajectoryPeriodicUpdate()
104  virtual bool IsComputationRequiredThisFrame(Bot* /*bot*/, KyFloat32 /*simulationTimeInSeconds*/) { return true; }
105 };
106 
107 } // namespace Kaim
108 
109 #endif // Navigation_IAvoidanceComputer_H
The avoidance computer was not able to find a collision-free solution.
Definition: iavoidancecomputer.h:27
The trajectory goes in target direction at the desired speed.
Definition: iavoidancecomputer.h:22
Waiting for force passage.
Definition: iavoidancecomputer.h:29
#define KY_CLASS_WITHOUT_COPY(ClassName)
Define to forbid copy constructor and copy assignment.
Definition: types.h:387
AvoidanceResult
Enumerates the possible results of a call to IAvoidanceComputer::Compute().
Definition: iavoidancecomputer.h:20
The trajectory deviates from target direction.
Definition: iavoidancecomputer.h:25
The trajectory goes in target direction but at higher speed than the desired one. ...
Definition: iavoidancecomputer.h:24
Definition: gamekitcrowddispersion.h:20
This interface class defines the way avoidance is computed.
Definition: iavoidancecomputer.h:38
Currently forcing the passage.
Definition: iavoidancecomputer.h:28
The avoidance computer decided that stopping the Bot is the best solution.
Definition: iavoidancecomputer.h:26
The trajectory goes in target direction but at lower speed than the desired one.
Definition: iavoidancecomputer.h:23
float KyFloat32
Type used internally to represent a 32-bit floating-point number.
Definition: types.h:43