INOS
cinosmovepathinterpolator.h
Go to the documentation of this file.
1//******************************************************************************
26//******************************************************************************
27#ifndef INC_CINOSMOVEPATHINTERPOLATOR_H
28#define INC_CINOSMOVEPATHINTERPOLATOR_H
29//------------------------------------------------------------------------------
30// defines
31//------------------------------------------------------------------------------
32//
33//------------------------------------------------------------------------------
34// includes
35//------------------------------------------------------------------------------
36//
37#include <map>
38#include <functional>
39//
40// system
41#include <inos.h>
42#include <cinosbaseramp.h>
43//
44// C++
45//
46// project
47//
48//------------------------------------------------------------------------------
49// type definitions
50//------------------------------------------------------------------------------
51//
52//
53//------------------------------------------------------------------------------
54// macros
55//------------------------------------------------------------------------------
56//
57#define SECURE_INC(index) \
58 if (index<(DF_INOS_MOVEPATH_MAX_POINTS-1)){ \
59 index++; \
60 } \
61 else { \
62 return INOS_MOVEPATH_ERROR_ITP_MAX_SEGMENTS; \
63 }
64
65
66#define INOS_REGISTER_MOVEPATH_INTERPOLATOR(aName, aClass ) \
67 static int aClass##RegistrationRet = CINOSMovePathInterpolator::AddInterpolator(aName, ([](CINOSMovePathCurve* c, CINOSMovePath* p){return new aClass(c, p);}));
68
69//------------------------------------------------------------------------------
70// forwards
71//------------------------------------------------------------------------------
72//
74class CINOSMovePath;
76//
77//------------------------------------------------------------------------------
78// class definition
79//------------------------------------------------------------------------------
80//
82{
83
84 //--- user interface -------------------------------------------------------
85
86 // public member functions
87 public :
88
89 // position handling
90
93 TINOSMovePathVec& ovPos);
95 virtual void GetDirection(double adP,
96 TINOSMovePathVec& ovDir);
98 virtual void GetDirectionLast(TINOSMovePathVec& ovDir);
100 virtual void GetDerivative(uint32 auLevel, double adP,
101 TINOSMovePathVec& ovDer);
103 virtual void GetD2max(double adBgn, double adEnd, TINOSMovePathVec& aD2max);
105 virtual void GetD3max(double adBgn, double adEnd, TINOSMovePathVec& aD3max);
106
108 virtual double GetCurveLength();
109
111 virtual bool IsCurveContinuous(uint32 auLevel)
112 {
113 // assume no
114 return false;
115 }
116
118 virtual uint32 Prepare();
119
120 CINOSMovePathInterpolatorSegment* GetFirstSegment() {
121 return m_pFirstSegment;
122 }
123
124 CINOSMovePathInterpolatorSegment* GetLastSegment() {
125 return m_pLastSegment;
126 }
127
129
130 virtual uint32 ConnectSegments(CINOSMovePathInterpolator* apOther);
131 // trajectory interface
132
133
134
135 static CINOSMovePathInterpolator* CreateInterpolator(
136 const char* apInterpolatorType,
139
140 typedef std::function<CINOSMovePathInterpolator* (CINOSMovePathCurve*, CINOSMovePath*)> TINOSInterpolatorConstructor;
141
143 static int AddInterpolator(const char* apInterpolatorType, const TINOSInterpolatorConstructor& constructor_call);
144
147
148 //--- internals ------------------------------------------------------------
149
150 friend class CINOSMovePath;
153 BaseCleanup();
154 };
155
156 // constructor / destructor
157 protected :
161 class CINOSMovePath* apPath = NULL);
162
164 virtual void Cleanup();
165
168 { return m_pPath; };
171 { m_pPath = apPath; };
174
178
185
187 virtual CINCOObject* RequestRegister();
188
189
192
194 CINCOObject* GetRegister()
195 {
196 return m_pRegister;
197 }
198
199 typedef std::map<std::string, TINOSInterpolatorConstructor> TINOSInterpolatorMap;
201 static TINOSInterpolatorMap& GetInterpolatorsMap();
202
203
204 private:
206 void BaseCleanup();
207
208
209 // protected members
210 protected :
212 inosName32 m_cType;
216 char m_cSpeedSet[64];
225
227 uint32 m_uRegisterCnt = 0;
229 CINCOObject* m_pRegister = nullptr;
230
231 CINOSMovePathCurve* m_pCurve;
232
235 class CINOSMovePathInterpolatorSegment* m_pLastSegment = nullptr;
236
237 // dynamic
239};
240
241//------------------------------------------------------------------------------
242// end of file
243//------------------------------------------------------------------------------
244
245#endif // INC_CINOSMOVEPATHINTERPOLATOR_H
Short comment.
#define DECLARE_DYNAMIC(aClass)
Definition cinospartitionmemory.h:328
Definition cinosmcmodule.h:1900
Definition cinosmovepathcurve.h:56
Definition cinosmovepathinterpolator.h:82
static int AddInterpolator(const char *apInterpolatorType, const TINOSInterpolatorConstructor &constructor_call)
add new interpolator constructor to the interplators map
virtual void GetDirection(double adP, TINOSMovePathVec &ovDir)
get direction vector at 'adP'
inosName32 m_cType
interpolator type
Definition cinosmovepathinterpolator.h:212
void ReleaseRegister()
release inco registration
char m_cSpeedSet[64]
speedset name
Definition cinosmovepathinterpolator.h:216
virtual bool IsCurveContinuous(uint32 auLevel)
check if curve continuous
Definition cinosmovepathinterpolator.h:111
CINCOObject * m_pRegister
pointer to inco registration
Definition cinosmovepathinterpolator.h:229
bool IsBlendingRequired(CINOSMovePathSegment *apSegment1, CINOSMovePathSegment *apSegment2)
return true if blending between segment 1 and 2 required
virtual void GetPosition(double adP, CINOSMovePathSegment *&opSegment, TINOSMovePathVec &ovPos)
get position vector at 'adP'
virtual ~CINOSMovePathInterpolator()
destructor
Definition cinosmovepathinterpolator.h:152
void SetPath(class CINOSMovePath *apPath)
set pointer to my path
Definition cinosmovepathinterpolator.h:170
virtual void GetD2max(double adBgn, double adEnd, TINOSMovePathVec &aD2max)
get max D2 vector of given range
virtual double GetCurveLength()
get curve length
SINOSRampParam m_sSpeedSet
speedset
Definition cinosmovepathinterpolator.h:218
bool IsContinuous(CINOSMovePathSegment *apSegment1, CINOSMovePathSegment *apSegment2, uint32 auLevel)
return true if segment 1 and 2 are auLevel continuous
virtual CINCOObject * RequestRegister()
return pointer to inco registration
CINCOObject * GetRegister()
get pointer to inco registration (if any)
Definition cinosmovepathinterpolator.h:194
virtual void GetDerivative(uint32 auLevel, double adP, TINOSMovePathVec &ovDer)
get auLevel derivative vector at 'adP'
virtual void GetDirectionLast(TINOSMovePathVec &ovDir)
get direction vector at the end
static bool CheckInterpolatorType(const char *apInterpolatorType)
check if an interpolator with the given name is in the interpolators map
CINOSMovePathInterpolator(CINOSMovePathCurve *apCurve, class CINOSMovePath *apPath=NULL)
constructor
virtual uint32 Prepare()
do precalculation
virtual void Cleanup()
cleanup
double m_dCycleTime
cycle time
Definition cinosmovepathinterpolator.h:222
class CINOSMovePathCurve * GetCurve()
get pointer to my curve
virtual void GetD3max(double adBgn, double adEnd, TINOSMovePathVec &aD3max)
get max D3 vector of given range
class CINOSMovePath * m_pPath
pointer to my path
Definition cinosmovepathinterpolator.h:214
double m_dCycleTime_1
inverse cycle time
Definition cinosmovepathinterpolator.h:224
static TINOSInterpolatorMap & GetInterpolatorsMap()
get interpolatos map, to avoid inserting before initialization
uint32 m_uRegisterCnt
inco tree registration counter
Definition cinosmovepathinterpolator.h:227
double m_dTolerance
requested tolerance
Definition cinosmovepathinterpolator.h:220
bool IsBlendingAllowed(CINOSMovePathSegment *apSegment1, CINOSMovePathSegment *apSegment2)
return true if blending between segment 1 and 2 allowed
class CINOSMovePath * GetPath()
get pointer to my path
Definition cinosmovepathinterpolator.h:167
class CINOSMovePathInterpolatorSegment * m_pFirstSegment
array of interpolator segments
Definition cinosmovepathinterpolator.h:234
Definition cinosmovepathsegment.h:45
Definition cinosmovepath.h:566
ramp parameters
Definition cinosbaseramp.h:503