gwnavruntime/pathfollower/avoidanceworkspace.h Source File

avoidanceworkspace.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 
8 // primary contact: MUBI - secondary contact: LAPA
9 
10 #ifndef Navigation_AvoidanceWorkspace_H
11 #define Navigation_AvoidanceWorkspace_H
12 
17 
18 namespace Kaim
19 {
20 class Bot;
21 
22 // We want theses arrays to work on contiguous memory, never to release it
23 typedef KyArrayPOD<AvoidanceCollider, MemStat_PathFollowing, Kaim::ArrayConstPolicy<0, 16, true> > ColliderArray;
24 
25 enum AvoidanceWorkspaceAddColliderResult
26 {
27  AvoidanceWorkspace_ColliderAdded = 0,
28  AvoidanceWorkspace_ColliderIgnored
29 };
30 
31 
37 class AvoidanceWorkspace
38 {
39  KY_DEFINE_NEW_DELETE_OPERATORS(MemStat_PathFollowing)
40 
41 public:
42  // ---------------------------------- Public Member Functions ----------------------------------
43 
45  : m_doSendVisualDebugBlob(true)
46  , m_visualDebugAltitude(0.f)
47  {}
48 
51  void Reset(const AvoidanceCollider& rootCollider, KyFloat32 visualDebugAltitude = 0.f);
52 
59  AvoidanceWorkspaceAddColliderResult AddCollider(const AvoidanceConfig& config, AvoidanceCollider& collider);
60 
62  KyFloat32 ComputeAvoidanceScore(const Vec2f& candidateVelocity, const KyFloat32 safetyDistance, const KyFloat32 timeHorizon, KyFloat32& collisionTime, KyInt32& colliderIndex ) const;
63 
64  // ---------------------------------- Public Data Members ----------------------------------
65 
69 
71  ColliderArray m_colliders;
72 
76  ColliderArray m_ignoredColliders;
77 
78 
79 public: //internal
80 
81  // when true and debugging a Bot in VisualDebugLOD_Maximal, activate the sending of
82  // a display list representing the avoidance workspace
83  bool m_doSendVisualDebugBlob;
84  KyFloat32 m_visualDebugAltitude;
85 };
86 
87 } // namespace Kaim
88 
89 #endif // Navigation_AvoidanceWorkspace_H
KyFloat32 ComputeAvoidanceScore(const Vec2f &candidateVelocity, const KyFloat32 safetyDistance, const KyFloat32 timeHorizon, KyFloat32 &collisionTime, KyInt32 &colliderIndex) const
Compute the avoidance score.
AvoidanceWorkspace aggregates at once:
Definition: avoidanceworkspace.h:38
ColliderArray m_colliders
The array of Colliders which Avoidance have been kept in #m_avoidances.
Definition: avoidanceworkspace.h:81
Set of parameters used to configure AvoidanceComputer.
Definition: avoidanceconfig.h:117
AvoidanceWorkspaceAddColliderResult AddCollider(const AvoidanceConfig &config, AvoidanceCollider &collider)
Compute the time to collision and filters accordingly:
int KyInt32
Type used internally to represent a 32-bit integer.
Definition: types.h:35
AvoidanceCollider m_rootCollider
The AvoidanceCollider corresponding to the Bot for which the AvoidanceWorkspace is used to compute an...
Definition: avoidanceworkspace.h:78
This class defines a two-dimensional vector whose coordinates are stored using floating-point numbers...
Definition: vec2f.h:24
A Collider is a 2D circular particle with a linear velocity.
Definition: avoidancecollider.h:19
Definition: gamekitcrowddispersion.h:20
void Reset(const AvoidanceCollider &rootCollider, KyFloat32 visualDebugAltitude=0.f)
Reset the workspace and prepare it for a given root collider.
#define KY_DEFINE_NEW_DELETE_OPERATORS(MemStat)
This macro defines new and delete operators.
Definition: memory.h:137
float KyFloat32
Type used internally to represent a 32-bit floating-point number.
Definition: types.h:43
ColliderArray m_ignoredColliders
The array of discarded Colliders.
Definition: avoidanceworkspace.h:86