1/*
2 * VisionControl.h
3 *
4 * Classroom License -- for classroom instructional use only. Not for
5 * government, commercial, academic research, or other organizational use.
6 *
7 * Code generation for model "VisionControl".
8 *
9 * Model version : 1.14
10 * Simulink Coder version : 8.11 (R2016b) 25-Aug-2016
11 * C source code generated on : Thu Dec 01 15:18:37 2016
12 *
13 * Target selection: ert.tlc
14 * Note: GRT includes extra infrastructure and instrumentation for prototyping
15 * Embedded hardware selection: ARM Compatible->ARM Cortex
16 * Code generation objectives: Unspecified
17 * Validation result: Not run
18 */
19
20#ifndef RTW_HEADER_VisionControl_h_
21#define RTW_HEADER_VisionControl_h_
22#include <math.h>
23#include <string.h>
24#include <float.h>
25#include <stddef.h>
26#ifndef VisionControl_COMMON_INCLUDES_
27# define VisionControl_COMMON_INCLUDES_
28#include "rtwtypes.h"
29#include "rtw_extmode.h"
30#include "sysran_types.h"
31#include "rtw_continuous.h"
32#include "rtw_solver.h"
33#include "dt_info.h"
34#include "ext_work.h"
35#endif /* VisionControl_COMMON_INCLUDES_ */
36
37#include "VisionControl_types.h"
38
39/* Shared type includes */
40#include "multiword_types.h"
41#include "rt_nonfinite.h"
42#include "rtGetInf.h"
43
44/* Macros for accessing real-time model data structure */
45#ifndef rtmGetFinalTime
46# define rtmGetFinalTime(rtm) ((rtm)->Timing.tFinal)
47#endif
48
49#ifndef rtmGetRTWExtModeInfo
50# define rtmGetRTWExtModeInfo(rtm) ((rtm)->extModeInfo)
51#endif
52
53#ifndef rtmGetErrorStatus
54# define rtmGetErrorStatus(rtm) ((rtm)->errorStatus)
55#endif
56
57#ifndef rtmSetErrorStatus
58# define rtmSetErrorStatus(rtm, val) ((rtm)->errorStatus = (val))
59#endif
60
61#ifndef rtmGetStopRequested
62# define rtmGetStopRequested(rtm) ((rtm)->Timing.stopRequestedFlag)
63#endif
64
65#ifndef rtmSetStopRequested
66# define rtmSetStopRequested(rtm, val) ((rtm)->Timing.stopRequestedFlag = (val))
67#endif
68
69#ifndef rtmGetStopRequestedPtr
70# define rtmGetStopRequestedPtr(rtm) (&((rtm)->Timing.stopRequestedFlag))
71#endif
72
73#ifndef rtmGetT
74# define rtmGetT(rtm) ((rtm)->Timing.taskTime0)
75#endif
76
77#ifndef rtmGetTFinal
78# define rtmGetTFinal(rtm) ((rtm)->Timing.tFinal)
79#endif
80
81/* Block signals (auto storage) */
82typedef struct {
83 real_T DataTypeConversion1; /* '<S1>/Data Type Conversion1' */
84 real_T DataTypeConversion2; /* '<S1>/Data Type Conversion2' */
85 real_T Saturate[2]; /* '<S4>/Saturate' */
86 real_T MagManlinearization_o1[16]; /* '<S3>/MagMan linearization' */
87 real_T MagManlinearization_o2; /* '<S3>/MagMan linearization' */
88 real_T Safetyswitch[16]; /* '<Root>/Safety switch' */
89 real_T X; /* '<Root>/Position transformation' */
90 real_T Y; /* '<Root>/Position transformation' */
91 real_T pw[16]; /* '<Root>/PWM calculation' */
92 real_T Ao[32]; /* '<S3>/Embedded MATLAB Function' */
93 real_T y[16];
94 real_T i[16]; /* '<Root>/Current' */
95 real_T y_m[4];
96 int32_T Sharedmemorycameraposition_o1;/* '<S1>/Shared memory camera position' */
97 int32_T Sharedmemorycameraposition_o2;/* '<S1>/Shared memory camera position' */
98} B_VisionControl_T;
99
100/* Block states (auto storage) for system '<Root>' */
101typedef struct {
102 real_T Sharedmemorycameraposition_DSTA;/* '<S1>/Shared memory camera position' */
103 real_T Integrator_DSTATE[2]; /* '<S4>/Integrator' */
104 real_T Filter_DSTATE[2]; /* '<S4>/Filter' */
105 real_T MagManCoils_DSTATE; /* '<Root>/MagMan Coils' */
106 struct {
107 void *LoggedData[2];
108 } Forcescope_PWORK; /* '<Root>/Force scope' */
109
110 struct {
111 void *LoggedData[2];
112 } Normalizedposition_PWORK; /* '<Root>/Normalized position' */
113
114 struct {
115 void *LoggedData[2];
116 } Rawposition_PWORK; /* '<Root>/Raw position' */
117} DW_VisionControl_T;
118
119/* Parameters (auto storage) */
120struct P_VisionControl_T_ {
121 real_T km4piCam[9]; /* Variable: km4piCam
122 * Referenced by: '<Root>/Raspicam Calibration matrix'
123 */
124 real_T PIDController2DOF1_D; /* Mask Parameter: PIDController2DOF1_D
125 * Referenced by: '<S4>/Derivative Gain'
126 */
127 real_T PIDController2DOF1_I; /* Mask Parameter: PIDController2DOF1_I
128 * Referenced by: '<S4>/Integral Gain'
129 */
130 real_T PIDController2DOF1_Kb; /* Mask Parameter: PIDController2DOF1_Kb
131 * Referenced by: '<S4>/Kb'
132 */
133 real_T PIDController2DOF1_LowerSaturat;/* Mask Parameter: PIDController2DOF1_LowerSaturat
134 * Referenced by: '<S4>/Saturate'
135 */
136 real_T PIDController2DOF1_N; /* Mask Parameter: PIDController2DOF1_N
137 * Referenced by: '<S4>/Filter Coefficient'
138 */
139 real_T PIDController2DOF1_P; /* Mask Parameter: PIDController2DOF1_P
140 * Referenced by: '<S4>/Proportional Gain'
141 */
142 real_T PIDController2DOF1_UpperSaturat;/* Mask Parameter: PIDController2DOF1_UpperSaturat
143 * Referenced by: '<S4>/Saturate'
144 */
145 real_T PIDController2DOF1_b; /* Mask Parameter: PIDController2DOF1_b
146 * Referenced by: '<S4>/Setpoint Weighting (Proportional)'
147 */
148 real_T PIDController2DOF1_c; /* Mask Parameter: PIDController2DOF1_c
149 * Referenced by: '<S4>/Setpoint Weighting (Derivative)'
150 */
151 real_T Refereceposition_Value[2]; /* Expression: [3.5, 3.5]
152 * Referenced by: '<Root>/Referece position'
153 */
154 real_T Integrator_gainval; /* Computed Parameter: Integrator_gainval
155 * Referenced by: '<S4>/Integrator'
156 */
157 real_T Integrator_IC; /* Expression: InitialConditionForIntegrator
158 * Referenced by: '<S4>/Integrator'
159 */
160 real_T Filter_gainval; /* Computed Parameter: Filter_gainval
161 * Referenced by: '<S4>/Filter'
162 */
163 real_T Filter_IC; /* Expression: InitialConditionForFilter
164 * Referenced by: '<S4>/Filter'
165 */
166};
167
168/* Real-time Model Data Structure */
169struct tag_RTM_VisionControl_T {
170 const char_T *errorStatus;
171 RTWExtModeInfo *extModeInfo;
172
173 /*
174 * Sizes:
175 * The following substructure contains sizes information
176 * for many of the model attributes such as inputs, outputs,
177 * dwork, sample times, etc.
178 */
179 struct {
180 uint32_T checksums[4];
181 } Sizes;
182
183 /*
184 * SpecialInfo:
185 * The following substructure contains special information
186 * related to other components that are dependent on RTW.
187 */
188 struct {
189 const void *mappingInfo;
190 } SpecialInfo;
191
192 /*
193 * Timing:
194 * The following substructure contains information regarding
195 * the timing information for the model.
196 */
197 struct {
198 time_T taskTime0;
199 uint32_T clockTick0;
200 uint32_T clockTickH0;
201 time_T stepSize0;
202 time_T tFinal;
203 boolean_T stopRequestedFlag;
204 } Timing;
205};
206
207/* Block parameters (auto storage) */
208extern P_VisionControl_T VisionControl_P;
209
210/* Block signals (auto storage) */
211extern B_VisionControl_T VisionControl_B;
212
213/* Block states (auto storage) */
214extern DW_VisionControl_T VisionControl_DW;
215
216/* Model entry point functions */
217extern void VisionControl_initialize(void);
218extern void VisionControl_step(void);
219extern void VisionControl_terminate(void);
220
221/* Real-time Model object */
222extern RT_MODEL_VisionControl_T *const VisionControl_M;
223
224/*-
225 * The generated code includes comments that allow you to trace directly
226 * back to the appropriate location in the model. The basic format
227 * is <system>/block_name, where system is the system number (uniquely
228 * assigned by Simulink) and block_name is the name of the block.
229 *
230 * Use the MATLAB hilite_system command to trace the generated code back
231 * to the model. For example,
232 *
233 * hilite_system('<S3>') - opens system 3
234 * hilite_system('<S3>/Kp') - opens and selects block Kp which resides in S3
235 *
236 * Here is the system hierarchy for this model
237 *
238 * '<Root>' : 'VisionControl'
239 * '<S1>' : 'VisionControl/Camera position from shared memory'
240 * '<S2>' : 'VisionControl/Current'
241 * '<S3>' : 'VisionControl/Linearization'
242 * '<S4>' : 'VisionControl/PID Controller (2DOF)1'
243 * '<S5>' : 'VisionControl/PWM calculation'
244 * '<S6>' : 'VisionControl/Position transformation'
245 * '<S7>' : 'VisionControl/Linearization/Embedded MATLAB Function'
246 */
247#endif /* RTW_HEADER_VisionControl_h_ */
248