34 #include <sys/types.h> 39 #endif // HAVE_CONFIG_H 66 double d, q, r, ang, rad;
68 r = sqrt((spur->
x - odm->
x) * (spur->
x - odm->
x) + (spur->
y - odm->
y) * (spur->
y - odm->
y));
70 ang = atan2((odm->
y - spur->
y), (odm->
x - spur->
x));
74 d = fabs(spur->
radius) - r;
77 if (r < fabs(spur->
radius))
86 return regurator(d, q, rad, spur->
v, spur->
w, spur);
94 d = (spur->
x - odm->
x) * sin(spur->
theta) - (spur->
y - odm->
y) * cos(spur->
theta);
98 return regurator(d, q, 1000, spur->
v, spur->
w, spur);
114 if (wref > fabs(w_max))
116 else if (wref < -fabs(w_max))
167 spur->
vref = spur->
v;
175 r = sqrt((spur->
x - odm->
x) * (spur->
x - odm->
x) + (spur->
y - odm->
y) * (spur->
y - odm->
y));
194 a = (x - spur->
x) * cos(spur->
theta) + (y - spur->
y) * sin(spur->
theta);
235 v = sqrt(2 * acc * fabs(_err));
238 vel_ref_next = -
SIGN(_err) * fabs(vel_max);
242 vel_ref_next = -
SIGN(_err) * v;
261 v = sqrt(vel_end * vel_end + 2 * acc * fabs(_err));
263 if (fabs(vel_max) < fabs(vel_end))
265 if (fabs(err) < (vel_end * vel_end - vel_max * vel_max) / (2.0 * acc))
266 _vel_max = fabs(vel_end);
double trans_q(double theta)
double circle_follow(OdometryPtr odm, SpurUserParamsPtr spur)
double p(YPSpur_param id, enum motor_id motor)
double dist_pos(OdometryPtr odm, SpurUserParamsPtr spur)
int stop_line(OdometryPtr odm, SpurUserParamsPtr spur)
double spin(OdometryPtr odm, SpurUserParamsPtr spur)
double timeoptimal_servo2(double err, double vel_max, double vel, double acc, double vel_end)
double line_follow(OdometryPtr odm, SpurUserParamsPtr spur)
double orient(OdometryPtr odm, SpurUserParamsPtr spur)
double regurator(double d, double q, double r, double v_max, double w_max, SpurUserParamsPtr spur)
double timeoptimal_servo(double err, double vel_max, double vel, double acc)