MotorWare f2806x Module API Documentation

- Main Page
- Modules
- Data Structures
- Files

- File List
- Globals

angle.h
Go to the documentation of this file.
1 #ifndef _ANGLE_H_
2 #define _ANGLE_H_
3
9
10
11 // **************************************************************************
12 // the includes
13 #include <stdint.h>
14
15 // drivers
16
17
18 // modules
19 #include "sw/modules/types/src/types.h"
20 #include "sw/modules/est/src/float/est.h"
21 #include "sw/modules/math/src/float/math.h"
22
23
24 // solutions
25
26
29
32
33
34
35 #ifdef __cplusplus
36 extern "C" {
37 #endif
38
39
40 // **************************************************************************
41 // the defines
42
43
44 // **************************************************************************
45 // the typedefs
46
47
50 typedef struct _ANGLE_Obj_
51 {
52 int_least32_t timeStamp;
53 float_t angleEst_rad;
54 float_t speedEst_rps;
55 float_t accelEst_rps2;
56
57 float_t angle_rad;
58 float_t angleWithDelay_rad;
59 float_t speed_rps;
60
61 float_t angleDelayed_sf_sec;
62 float_t timeStampPeriod_sec;
63 } ANGLE_Obj;
64
65
68 typedef struct _ANGLE_Obj_ *ANGLE_Handle;
69
70
71 // **************************************************************************
72 // the globals
73
74
75 // **************************************************************************
76 // the function prototypes
77
81 static inline float_t ANGLE_getAccelEst_rps2(ANGLE_Handle handle)
82 {
83 ANGLE_Obj *obj = (ANGLE_Obj *)handle;
84
85 return(obj->accelEst_rps2);
86 } // end of ANGLE_getAccelEst_rps2() function
87
88
92 static inline float_t ANGLE_getAngle_rad(ANGLE_Handle handle)
93 {
94 ANGLE_Obj *obj = (ANGLE_Obj *)handle;
95
96 return(obj->angle_rad);
97 } // end of ANGLE_getAngle_rad() function
98
99
103 static inline float_t ANGLE_getAngleEst_rad(ANGLE_Handle handle)
104 {
105 ANGLE_Obj *obj = (ANGLE_Obj *)handle;
106
107 return(obj->angleEst_rad);
108 } // end of ANGLE_getAngleEst_rad() function
109
110
114 static inline float_t ANGLE_getAngleWithDelay_rad(ANGLE_Handle handle)
115 {
116 ANGLE_Obj *obj = (ANGLE_Obj *)handle;
117
118 return(obj->angleWithDelay_rad);
119 } // end of ANGLE_getAngleWithDelay_rad() function
120
121
125 static inline float_t ANGLE_getAngleDelayed_sf_sec(ANGLE_Handle handle)
126 {
127 ANGLE_Obj *obj = (ANGLE_Obj *)handle;
128
129 return(obj->angleDelayed_sf_sec);
130 } // end of ANGLE_getAngleDelayed_sf_sec() function
131
132
136 static inline float_t ANGLE_getSpeed_rps(ANGLE_Handle handle)
137 {
138 ANGLE_Obj *obj = (ANGLE_Obj *)handle;
139
140 return(obj->speed_rps);
141 } // end of ANGLE_getSpeed_rps() function
142
143
147 static inline float_t ANGLE_getSpeedEst_rps(ANGLE_Handle handle)
148 {
149 ANGLE_Obj *obj = (ANGLE_Obj *)handle;
150
151 return(obj->speedEst_rps);
152 } // end of ANGLE_getSpeedEst_rps() function
153
154
158 static inline int_least32_t ANGLE_getTimeStamp(ANGLE_Handle handle)
159 {
160 ANGLE_Obj *obj = (ANGLE_Obj *)handle;
161
162 return(obj->timeStamp);
163 } // end of ANGLE_getTimeStamp() function
164
165
169 static inline float_t ANGLE_getTimeStampPeriod_sec(ANGLE_Handle handle)
170 {
171 ANGLE_Obj *obj = (ANGLE_Obj *)handle;
172
173 return(obj->timeStampPeriod_sec);
174 } // end of ANGLE_getTimeStampPeriod_sec() function
175
176
181 extern ANGLE_Handle ANGLE_init(void *pMemory,const size_t numBytes);
182 extern ANGLE_Handle cla_ANGLE_init(void *pMemory,const size_t numBytes);
183
184
188 extern void ANGLE_run(ANGLE_Handle handle,const int_least32_t timeStamp);
189 extern void cla_ANGLE_run(ANGLE_Handle handle,const int_least32_t timeStamp);
190
191
195 static inline void ANGLE_setAccelEst_rps2(ANGLE_Handle handle,const float_t accel_rps2)
196 {
197 ANGLE_Obj *obj = (ANGLE_Obj *)handle;
198
199 obj->accelEst_rps2 = accel_rps2;
200
201 return;
202 } // end of ANGLE_setAccelEst_rps() function
203
204
208 static inline void ANGLE_setAngle_rad(ANGLE_Handle handle,const float_t angle_rad)
209 {
210 ANGLE_Obj *obj = (ANGLE_Obj *)handle;
211
212 obj->angle_rad = angle_rad;
213
214 return;
215 } // end of ANGLE_setAngle_rad() function
216
217
221 static inline void ANGLE_setAngleEst_rad(ANGLE_Handle handle,const float_t angle_rad)
222 {
223 ANGLE_Obj *obj = (ANGLE_Obj *)handle;
224
225 obj->angleEst_rad = angle_rad;
226
227 return;
228 } // end of ANGLE_setAngleEst_rad() function
229
230
234 static inline void ANGLE_setAngleWithDelay_rad(ANGLE_Handle handle,const float_t angle_rad)
235 {
236 ANGLE_Obj *obj = (ANGLE_Obj *)handle;
237
238 obj->angleWithDelay_rad = angle_rad;
239
240 return;
241 } // end of ANGLE_setAngleWithDelay_rad() function
242
243
247 static inline void ANGLE_setAngleDelayed_sf_sec(ANGLE_Handle handle,const float_t angleDelayed_sf_sec)
248 {
249 ANGLE_Obj *obj = (ANGLE_Obj *)handle;
250
251 obj->angleDelayed_sf_sec = angleDelayed_sf_sec;
252
253 return;
254 } // end of ANGLE_setAngleDelayed_sf_sec() function
255
256
261 extern void ANGLE_setParams(ANGLE_Handle handle,
262 const float_t timeStampPeriod_sec,
263 const float_t angleDelayed_sf_sec);
264 extern void cla_ANGLE_setParams(ANGLE_Handle handle,
265 const float_t timeStampPeriod_sec,
266 const float_t angleDelayed_sf_sec);
267
268
272 static inline void ANGLE_setSpeed_rps(ANGLE_Handle handle,const float_t speed_rps)
273 {
274 ANGLE_Obj *obj = (ANGLE_Obj *)handle;
275
276 obj->speed_rps = speed_rps;
277
278 return;
279 } // end of ANGLE_setSpeed_rps() function
280
281
285 static inline void ANGLE_setSpeedEst_rps(ANGLE_Handle handle,const float_t speed_rps)
286 {
287 ANGLE_Obj *obj = (ANGLE_Obj *)handle;
288
289 obj->speedEst_rps = speed_rps;
290
291 return;
292 } // end of ANGLE_setSpeedEst_rps() function
293
294
298 static inline void ANGLE_setTimeStamp(ANGLE_Handle handle,const int_least32_t timeStamp)
299 {
300 ANGLE_Obj *obj = (ANGLE_Obj *)handle;
301
302 obj->timeStamp = timeStamp;
303
304 return;
305 } // end of ANGLE_setTimeStamp() function
306
307
311 static inline void ANGLE_setTimeStampPeriod_sec(ANGLE_Handle handle,const float_t timeStampPeriod_sec)
312 {
313 ANGLE_Obj *obj = (ANGLE_Obj *)handle;
314
315 obj->timeStampPeriod_sec = timeStampPeriod_sec;
316
317 return;
318 } // end of ANGLE_setTimeStampPeriod_sec() function
319
320
327 extern void ANGLE_setup(ANGLE_Handle handle,
328 const int_least32_t timeStamp,
329 const float_t angle_rad,
330 const float_t speed_rps,
331 const float_t accel_rps2);
332 extern void cla_ANGLE_setup(ANGLE_Handle handle,
333 const int_least32_t timeStamp,
334 const float_t angle_rad,
335 const float_t speed_rps,
336 const float_t accel_rps2);
337
338
339 #ifdef __cplusplus
340 }
341 #endif // extern "C"
342
344
345 #endif // end of _ANGLE_H_ definition
346
347
ANGLE_setup
void ANGLE_setup(ANGLE_Handle handle, const int_least32_t timeStamp, const float_t angle_rad, const float_t speed_rps, const float_t accel_rps2)
Updates the angle generator with new data.
ANGLE_setTimeStampPeriod_sec
static void ANGLE_setTimeStampPeriod_sec(ANGLE_Handle handle, const float_t timeStampPeriod_sec)
Sets the time stamp period value.
Definition: angle.h:311
ANGLE_setAngleWithDelay_rad
static void ANGLE_setAngleWithDelay_rad(ANGLE_Handle handle, const float_t angle_rad)
Sets the angle value considering system delay.
Definition: angle.h:234
types.h
Contains the public interface to the types definitions.
ANGLE_setAccelEst_rps2
static void ANGLE_setAccelEst_rps2(ANGLE_Handle handle, const float_t accel_rps2)
Sets the estimated acceleration value.
Definition: angle.h:195
ANGLE_Handle
struct _ANGLE_Obj_ * ANGLE_Handle
Defines the ANGLE handle.
Definition: angle.h:68
ANGLE_getAccelEst_rps2
static float_t ANGLE_getAccelEst_rps2(ANGLE_Handle handle)
Gets the estimated acceleration value.
Definition: angle.h:81
_ANGLE_Obj_::timeStamp
int_least32_t timeStamp
the time stamp for the estimated angle and speed values
Definition: angle.h:52
ANGLE_run
void ANGLE_run(ANGLE_Handle handle, const int_least32_t timeStamp)
Updates the angle value in the angle generator.
ANGLE_getSpeedEst_rps
static float_t ANGLE_getSpeedEst_rps(ANGLE_Handle handle)
Gets the estimated speed value.
Definition: angle.h:147
math.h
Contains the public interface to the math (MATH) module routines.
_ANGLE_Obj_::angleDelayed_sf_sec
float_t angleDelayed_sf_sec
the scale factor for computing angle value considering system delay, sec
Definition: angle.h:61
ANGLE_setTimeStamp
static void ANGLE_setTimeStamp(ANGLE_Handle handle, const int_least32_t timeStamp)
Sets the time stamp value for the estimated data.
Definition: angle.h:298
_ANGLE_Obj_::accelEst_rps2
float_t accelEst_rps2
the estimated angular acceleration value, rad/sec^2
Definition: angle.h:55
ANGLE_setAngleEst_rad
static void ANGLE_setAngleEst_rad(ANGLE_Handle handle, const float_t angle_rad)
Sets the estimated angle value.
Definition: angle.h:221
est.h
Contains the public interface to the estimator (EST) module routines.
ANGLE_getAngleDelayed_sf_sec
static float_t ANGLE_getAngleDelayed_sf_sec(ANGLE_Handle handle)
Gets the scale factor for computing the delayed angle.
Definition: angle.h:125
_ANGLE_Obj_::speed_rps
float_t speed_rps
the predicted angular speed value, rad/sec
Definition: angle.h:59
_ANGLE_Obj_
Defines the angle generator (ANGLE) object.
Definition: angle.h:50
ANGLE_Obj
struct _ANGLE_Obj_ ANGLE_Obj
Defines the angle generator (ANGLE) object.
ANGLE_setSpeedEst_rps
static void ANGLE_setSpeedEst_rps(ANGLE_Handle handle, const float_t speed_rps)
Sets the estimated speed value.
Definition: angle.h:285
ANGLE_getAngleEst_rad
static float_t ANGLE_getAngleEst_rad(ANGLE_Handle handle)
Gets the estimated angle value.
Definition: angle.h:103
_ANGLE_Obj_::angleEst_rad
float_t angleEst_rad
the estimated angle value, rad
Definition: angle.h:53
ANGLE_getSpeed_rps
static float_t ANGLE_getSpeed_rps(ANGLE_Handle handle)
Gets the predicted speed value.
Definition: angle.h:136
cla_ANGLE_setup
void cla_ANGLE_setup(ANGLE_Handle handle, const int_least32_t timeStamp, const float_t angle_rad, const float_t speed_rps, const float_t accel_rps2)
ANGLE_getTimeStampPeriod_sec
static float_t ANGLE_getTimeStampPeriod_sec(ANGLE_Handle handle)
Gets the time stamp period value.
Definition: angle.h:169
_ANGLE_Obj_::speedEst_rps
float_t speedEst_rps
the estimated angular speed value, rad/sec
Definition: angle.h:54
ANGLE_setSpeed_rps
static void ANGLE_setSpeed_rps(ANGLE_Handle handle, const float_t speed_rps)
Sets the predicted speed value.
Definition: angle.h:272
ANGLE_init
ANGLE_Handle ANGLE_init(void *pMemory, const size_t numBytes)
Initializes the angle generator (ANGLE) module.
_ANGLE_Obj_::angle_rad
float_t angle_rad
the predicted angle value, rad
Definition: angle.h:57
_ANGLE_Obj_::angleWithDelay_rad
float_t angleWithDelay_rad
the predicted angle value considering system delay, rad
Definition: angle.h:58
ANGLE_getTimeStamp
static int_least32_t ANGLE_getTimeStamp(ANGLE_Handle handle)
Gets the time stamp value for the estimated data.
Definition: angle.h:158
ANGLE_setParams
void ANGLE_setParams(ANGLE_Handle handle, const float_t timeStampPeriod_sec, const float_t angleDelayed_sf_sec)
Sets the parameters.
cla_ANGLE_init
ANGLE_Handle cla_ANGLE_init(void *pMemory, const size_t numBytes)
ANGLE_setAngleDelayed_sf_sec
static void ANGLE_setAngleDelayed_sf_sec(ANGLE_Handle handle, const float_t angleDelayed_sf_sec)
Sets the scale factor for computing the delayed angle.
Definition: angle.h:247
_ANGLE_Obj_::timeStampPeriod_sec
float_t timeStampPeriod_sec
the time stamp period, sec
Definition: angle.h:62
cla_ANGLE_run
void cla_ANGLE_run(ANGLE_Handle handle, const int_least32_t timeStamp)
cla_ANGLE_setParams
void cla_ANGLE_setParams(ANGLE_Handle handle, const float_t timeStampPeriod_sec, const float_t angleDelayed_sf_sec)
ANGLE_getAngleWithDelay_rad
static float_t ANGLE_getAngleWithDelay_rad(ANGLE_Handle handle)
Gets the updated angle value considering system delay.
Definition: angle.h:114
ANGLE_getAngle_rad
static float_t ANGLE_getAngle_rad(ANGLE_Handle handle)
Gets the predicted angle value.
Definition: angle.h:92
ANGLE_setAngle_rad
static void ANGLE_setAngle_rad(ANGLE_Handle handle, const float_t angle_rad)
Sets the predicted angle value.
Definition: angle.h:208
float_t
float float_t
Defines the portable data type for 32 bit, signed floating-point data.
Definition: types.h:121