INOS
cinosmovepathcurve.h
Go to the documentation of this file.
1//******************************************************************************
26//******************************************************************************
27#ifndef INC_CINOSMOVEPATHCURVE_H
28#define INC_CINOSMOVEPATHCURVE_H
29//------------------------------------------------------------------------------
30// defines
31//------------------------------------------------------------------------------
32//
33//------------------------------------------------------------------------------
34// includes
35//------------------------------------------------------------------------------
36//
37// system
38#include <inos.h>
40//
41// C++
42//
43// project
44//
45//------------------------------------------------------------------------------
46// forwards
47//------------------------------------------------------------------------------
48
51//------------------------------------------------------------------------------
52// class definition
53//------------------------------------------------------------------------------
54//
56{
57 //--- user interface ---------------------------------------------------
58
59 // public member functions
60 public :
61
62 // segment handling
63
66
69
72
75
77
80
83
84
87
90 {
91 // return pointer to first segment
92 return m_pFstSegment;
93 }
94
97 {
98 // return pointer to last segment
99 return m_pLstSegment;
100 }
101
102 // position handling
103
105 bool GetPosition(uint32 auIndex, TINOSMovePathVec& ovPos);
106
107
109 bool GetPosition(double adP, TINOSMovePathVec& ovPos);
110
111
113 bool GetPosition(double& adP, CINOSMovePathSegment*& opSegment, TINOSMovePathVec& ovPos);
114
115
117 bool GetDirection(double adP, TINOSMovePathVec& ovDir);
118
119
121 void GetDirectionLast(TINOSMovePathVec& ovDir);
122
124 void GetDerivative(uint32 auLevel, double adP, TINOSMovePathVec& ovDer);
125
127 bool GetD2max(double adP, TINOSMovePathVec& ovDir);
128
130 bool GetD3max(double adP, TINOSMovePathVec& ovDir);
131
132
134 void GetPositionFirst(TINOSMovePathVec& ovPos);
135
137 void GetPositionLast(TINOSMovePathVec& ovPos);
138
141
143 void SetStart(TINOSMovePathVec& ivPos)
144 {
145 // set start vector
146 m_vStart = ivPos;
147 // mark all positions as valid
149 }
150
153 {
154 // ensure a valid index
156 // set start vector
158 // mark position as valid
159 m_uStartValid |= (1<<auIndex);
160 }
161 }
162
164 void GetStart(TINOSMovePathVec& ovPos)
165 {
166 // set start vector
167 ovPos = m_vStart;
168 }
169
171 virtual double GetLength()
172 {
173 // return curve length
174 return m_dLength;
175 };
176
178 virtual void SetLength(double dLength)
179 {
180 // return curve length
182 };
183
186 {
187 // return number of curve segments
188 return m_uSegments;
189 };
190
193 {
194 // return flags
195 return m_uFlags;
196 };
197
200 {
201 // set flags
202 m_uFlags |= auFlags;
203 }
204
205 void ClearFlags(uint32 auFlags)
206 {
207 // set flags
209 }
212
214 virtual uint32 Prepare(TINOSMovePathVec& ivAct, double& adActP,
215 double adTolerance, double adEpsilon);
216
217
219 virtual void Reset(
223
224
227 {
228 // return mask of involved axes
229 return m_uInvolved;
230 }
231
233 virtual bool IsRelocatable()
234 {
236 }
237
239 virtual bool IsZeroBased()
240 {
242 }
243
245 virtual bool IsPureLinear()
246 {
247 return (m_uFlags & DF_INOS_MOVEPATH_FLAG_PURE_LINEAR);
248 }
249
250 virtual bool IsIncomplete()
251 {
253 }
254
255 virtual bool IsContinuation()
256 {
258 }
259
260
263
267
270 {
271 // return tolerance
272 return m_dTolerance;
273 }
274
278
280 double GetVelocity()
281 {
282 // return velocity
283 return m_dVelocity;
284 }
285
287 double GetVelocity(double adP);
288
292
293 CINOSMovePathInterpolator* GetInterpolator() {
294 return m_pInterpolator;
295 }
296
297 //--- internals --------------------------------------------------------
298
299 friend class CINOSMovePath;
300
301 // constructor / destructor
302 public :
305 : m_pInterpolator(0),
308 m_dLength(0.0),
311 m_uLstIndex(0), m_pLstIndex(0),
312 m_dLstP(0.0), m_pLstP(0),
313 m_uStartValid(0),
315 {
316 // reset position vectors
317 m_vStart = 0.0;
318 m_vActual = 0.0;
319 }
320
323 {
324 // destroy segments
325 DestroySegments();
326
327 // destroy interpolator if i'm the owner
328 if (m_pInterpolator){
329 // do it
330 delete m_pInterpolator;
331 // done
332 m_pInterpolator = 0;
333 } // end if
334 }
335
336 virtual uint32 SetInterpolator(CINOSMovePathInterpolator* apInterpolator);
337
338
339 // destroy segments
340 virtual void DestroySegments();
341
342
344 virtual CINCOObject* RequestRegister();
345
348
349 // protected methods
350 protected :
352 CINCOObject* GetRegister()
353 {
354 return m_pRegister;
355 }
356
357 // protected members
358 protected :
368 double m_dLength;
373 // search helpers
374
377 CINOSMovePathSegment* m_pLstIndex;
379 double m_dLstP;
380 CINOSMovePathSegment* m_pLstP;
381
385 TINOSMovePathVec m_vStart;
387 TINOSMovePathVec m_vActual;
388
392 CINCOObject* m_pRegister = nullptr;
393
398
399 // dynamic object handling
401};
402
403
404//------------------------------------------------------------------------------
405// end of file
406//------------------------------------------------------------------------------
407
408#endif // INC_CINOSMOVEPATHCURVE_H
#define DF_INOS_MOVEPATH_VELOCITY_DEFAULT
Definition cinosmovepath.h:51
#define DF_INOS_MOVEPATH_FLAG_RELOCATABLE
Definition cinosmovepath.h:105
#define DF_INOS_MOVEPATH_FLAG_INCOMPLETE
Definition cinosmovepath.h:94
#define DF_INOS_MOVEPATH_FLAG_INC
Definition cinosmovepath.h:63
#define DF_INOS_MOVEPATH_FLAG_CONTINUATION
Definition cinosmovepath.h:90
#define DF_INOS_MOVEPATH_TOLERANCE_DEFAULT
Definition cinosmovepath.h:43
#define DF_INOS_MOVEPATH_FLAG_OFFSET_ZERO
Definition cinosmovepath.h:100
The CINOSMovePathInterpolator class.
#define DECLARE_DYNAMIC(aClass)
Definition cinospartitionmemory.h:328
Definition cinosmcmodule.h:1900
Definition cinosmovepathcurve.h:56
void RemSegment(CINOSMovePathSegment *apSegment, bool abDelete=true)
remove segment from curve
uint32 m_uRegisterCnt
inco tree registration counter
Definition cinosmovepathcurve.h:390
double GetTolerance()
get curve tolerance
Definition cinosmovepathcurve.h:269
void GetStart(TINOSMovePathVec &ovPos)
get start position vector
Definition cinosmovepathcurve.h:164
uint32 m_uFlags
flags
Definition cinosmovepathcurve.h:362
void GetDirectionLast(TINOSMovePathVec &ovDir)
get last position vector
uint32 GetSegmentId(double adP)
get id of segment at 'adP'
virtual bool IsPureLinear()
return true if curve is pure linear
Definition cinosmovepathcurve.h:245
CINOSMovePathSegment * GetSegmentFirst()
get pointer to first segment
Definition cinosmovepathcurve.h:89
void InsSegment(CINOSMovePathSegment *apStart, CINOSMovePathSegment *apSegment)
insert segment in curve after apStart or at the beginning if apStart == 0
void GetPositionLast(TINOSMovePathVec &ovPos)
get last position vector
double m_dVelocity
curve velocity
Definition cinosmovepathcurve.h:372
virtual uint32 Prepare(TINOSMovePathVec &ivAct, double &adActP, double adTolerance, double adEpsilon)
do precalculation with actual position vector
bool GetD2max(double adP, TINOSMovePathVec &ovDir)
get D2 max of segment containing 'adP'
uint32 m_uLstIndex
last search index
Definition cinosmovepathcurve.h:376
virtual bool IsRelocatable()
return true if curve is relocatable
Definition cinosmovepathcurve.h:233
double m_dLstP
last search P
Definition cinosmovepathcurve.h:379
CINOSMovePathInterpolator * m_pInterpolator
pointer to interpolator
Definition cinosmovepathcurve.h:360
CINCOObject * m_pRegister
pointer to inco registration
Definition cinosmovepathcurve.h:392
void SetStart(TINOSMovePathVec &ivPos)
set start position vector
Definition cinosmovepathcurve.h:143
TINOSMovePathVec m_vActual
actual position vector (used at prepare)
Definition cinosmovepathcurve.h:387
virtual bool IsZeroBased()
return true if curve is zero based
Definition cinosmovepathcurve.h:239
void ReleaseRegister()
release inco registration
uint32 m_uSegments
number of segments
Definition cinosmovepathcurve.h:364
uint32 GetInvolved()
get involved axes
Definition cinosmovepathcurve.h:226
uint32 AddSegment(CINOSMovePathSegment *apSegment)
add segment to curve
double m_dLength
curve length
Definition cinosmovepathcurve.h:368
double GetVelocity(double adP)
get commanded curve velocity at given position
uint32 m_uInvolved
involved axes
Definition cinosmovepathcurve.h:366
bool GetDirection(double adP, TINOSMovePathVec &ovDir)
get direction vector at 'adP'
CINOSMovePathCurve()
constructor
Definition cinosmovepathcurve.h:304
double GetVelocity(CINOSMovePathSegment *apSegment, double adDefaultVelocity=DF_INOS_MOVEPATH_VELOCITY_DEFAULT)
get segment velocity
double GetVelocity()
get commanded curve velocity
Definition cinosmovepathcurve.h:280
virtual double GetLength()
get curve length
Definition cinosmovepathcurve.h:171
virtual uint32 GetSegments()
get number of segments
Definition cinosmovepathcurve.h:185
virtual bool IsContinuous(uint32 auLevel)
return true if curve is requested level continuous
CINOSMovePathSegment * m_pFstSegment
pointer to head of curve segments
Definition cinosmovepathcurve.h:395
void RemSegment(CINOSMovePathSegment *apFirst, CINOSMovePathSegment *apLast)
remove segments from curve (excluding apFirst and apLast)
virtual ~CINOSMovePathCurve()
destructor
Definition cinosmovepathcurve.h:322
CINCOObject * GetRegister()
get pointer to inco registration (if any)
Definition cinosmovepathcurve.h:352
virtual uint32 Recalc(CINOSMovePathSegment *apSegment, double adEpsilon)
recalculate curve starting at end of segment apSegment
void GetPositionFirst(TINOSMovePathVec &ovPos)
get start position vector
CINOSMovePathSegment * GetSegment(uint32 auIndex)
get pointer to segment auIndex
bool GetPosition(double adP, TINOSMovePathVec &ovPos)
get position vector at 'adP'
CINOSMovePathSegment * m_pLstSegment
pointer to tail of curve segments
Definition cinosmovepathcurve.h:397
void GetPositionLast(CINOSMovePathSegment *&opSegment, TINOSMovePathVec &ovPos)
get last position vector
CINOSMovePathSegment * GetSegment(double adP)
get pointer to segment at 'adP'
bool GetPosition(double &adP, CINOSMovePathSegment *&opSegment, TINOSMovePathVec &ovPos)
get position vector at 'adP'
bool GetPosition(uint32 auIndex, TINOSMovePathVec &ovPos)
get position vector auIndex
virtual void Reset(uint32 auFlags=DF_INOS_MOVEPATH_FLAG_INC|DF_INOS_MOVEPATH_FLAG_RELOCATABLE|DF_INOS_MOVEPATH_FLAG_PURE_LINEAR, double adTolerance=DF_INOS_MOVEPATH_TOLERANCE_DEFAULT, double adVelocity=DF_INOS_MOVEPATH_VELOCITY_DEFAULT)
reset curve
virtual void SetLength(double dLength)
get curve length
Definition cinosmovepathcurve.h:178
double GetTolerance(CINOSMovePathSegment *apSegment, double adDefaultTolerance=DF_INOS_MOVEPATH_TOLERANCE_DEFAULT)
get segment tolerance
uint32 GetFlags()
get flags
Definition cinosmovepathcurve.h:192
bool GetD3max(double adP, TINOSMovePathVec &ovDir)
get D3 max of segment containing 'adP'
void SetFlags(uint32 auFlags)
set flags
Definition cinosmovepathcurve.h:199
CINOSMovePathSegment * GetSegmentLast()
get pointer to last segment
Definition cinosmovepathcurve.h:96
double m_dTolerance
curve tolerance
Definition cinosmovepathcurve.h:370
TINOSMovePathVec m_vStart
start position vector
Definition cinosmovepathcurve.h:385
virtual CINCOObject * RequestRegister()
return pointer to inco registration
void SetStart(uint8 auIndex, double adPosition)
set start position of axis auIndex
Definition cinosmovepathcurve.h:152
virtual bool IsContinuous(CINOSMovePathSegment *apSeg1, CINOSMovePathSegment *apSeg2, uint32 auLevel)
return true if curve is requested level continuous
void GetDerivative(uint32 auLevel, double adP, TINOSMovePathVec &ovDer)
get auLevel derivative at 'adP'
uint32 m_uStartValid
pattern of valid startpos indexes
Definition cinosmovepathcurve.h:383
Definition cinosmovepathinterpolator.h:82
Definition cinosmovepathsegment.h:45
Definition cinosmovepath.h:566
#define DF_INOS_MOVEPATH_MAX_AXES
Definition inosdefault.h:144