00001
00002
00003
00004
00005
00006
00007
00008
00060
00061
00062
00063
00064
00068
00069
00070
00074 #define FWIDTH 3000
00075 #define FHEIGHT 2100
00076 #define SET_POINT_A(p) SET_POINT((p), 0.0, 0.0)
00077 #define SET_POINT_B(p) SET_POINT((p), FWIDTH, 0.0)
00078 #define SET_POINT_C(p) SET_POINT((p), FWIDTH, FHEIGHT)
00079 #define SET_POINT_D(p) SET_POINT((p), 0.0, FHEIGHT)
00080 #define SET_POINT_E(p) SET_POINT((p), FWIDTH/2, 0)
00081 #define SET_POINT_F(p) SET_POINT((p), FWIDTH/2, FHEIGHT)
00082 #define SET_POINT_G(p) SET_POINT((p), FWIDTH/2, FHEIGHT/4)
00083 #define SET_POINT_H(p) SET_POINT((p), FWIDTH/2, FHEIGHT/4*3)
00084
00085
00086 #ifdef USE_RED_REFLECTORS
00087 #define SET_POINT_K(p) SET_POINT((p), FWIDTH, FHEIGHT/2)
00088 #define SET_POINT_L(p) SET_POINT((p), 0, FHEIGHT/2)
00089 #define SET_POINT_R1(p) SET_POINT_K(p)
00090 #define SET_POINT_R2(p) SET_POINT_A(p)
00091 #define SET_POINT_R3(p) SET_POINT_D(p)
00092
00093 #else
00094 #define SET_POINT_K(p) SET_POINT((p), 0, FHEIGHT/2)
00095 #define SET_POINT_L(p) SET_POINT((p), FWIDTH, FHEIGHT/2)
00096 #define SET_POINT_R1(p) SET_POINT_K(p)
00097 #define SET_POINT_R2(p) SET_POINT_B(p)
00098 #define SET_POINT_R3(p) SET_POINT_C(p)
00099 #endif
00100
00104 #define TIME2ANGLE(p,t) (((double)t)/((double)p)*2*M_PI)
00105 #define SET_POINT(p,a,b) ({(p).x=(a); (p).y=(b);})
00106
00107
00108 struct pln_point {
00109 double x;
00110 double y;
00111 };
00112
00113
00114 struct pln_line {
00115 double k;
00116 double q;
00117 };
00118
00119
00120 struct pln_compl {
00121 double real;
00122 double imag;
00123 };
00124
00125
00126 struct pln_circle {
00127 double x0;
00128 double y0;
00129 double radius;
00130 };
00131
00132
00133
00134 struct pln_fquad_2var {
00135 double ax;
00136 double cx;
00137 double bx;
00138 double ay;
00139 double by;
00140 double cy;
00141 double rs;
00142 };
00143
00144
00145 struct pln_fquad {
00146 double a;
00147 double b;
00148 double c;
00149 };
00150
00151
00152 struct pln_circ {
00153 double angle;
00154
00155 struct pln_point pl;
00156 struct pln_point pc;
00157 struct pln_point pr;
00158 };
00159
00160
00161 struct pln_pos_state {
00162 double x;
00163 double y;
00164 double head;
00165 };
00166
00167
00168 struct pln_time_state {
00169
00170 double t_theta[3];
00171 double period;
00172 };
00173
00174
00175 struct pln_aangle_state {
00176 double theta[3];
00177 double head;
00178 };
00179
00180
00181 struct pln_angle_state {
00182 double alfa;
00183 double beta;
00184 double gama;
00185 };
00186
00187
00188 struct pln_angle_eval {
00189 double angle;
00190 double eval;
00191 };
00192
00193
00194 struct pln_point A, B, C, D, E, F, G, H, K, L, R1, R2, R3;
00195
00199 double evaluate_gaussian(double val, double sigma);
00200 void pln_get_position(struct pln_angle_state as, struct pln_pos_state *pos);
00201 void pln_set_points();
00202 void pln_pos2ang(struct pln_pos_state ps, struct pln_aangle_state *aas);
00203 void pln_coordinate(struct pln_pos_state estpos, struct pln_aangle_state aas,
00204 struct pln_angle_state *as);
00205 void pln_sel_angles(struct pln_pos_state estpos, double *angles,
00206 int angcount, struct pln_aangle_state *maas);
00207 void pln_cal_position(unsigned int *times, unsigned int timecnt,
00208 struct pln_pos_state act_pos,
00209 struct pln_pos_state *est_pos);