27 :
moveCommand(), m_x0(x0), m_v0(v0), m_xtarget(xtarget), m_amax(amax), m_vmax(vmax)
52 if (fabs(delta) >= fabs(delta1))
61 else if (fabs(delta) >= fabs(delta2))
71 else if (fabs(delta) > 0)
98 double vstern =
m_v0 * 0.707106781;
100 if (fabs(delta) >= fabs(delta1))
109 else if (fabs(
m_vmax) >= fabs(vstern))
211 if (TimeElapsed <=
m_T1)
213 return m_x0 +
m_v0 * TimeElapsed + 0.5 *
m_a1 * TimeElapsed * TimeElapsed;
223 if (TimeElapsed <=
m_T1)
225 return m_x0 +
m_v0 * TimeElapsed + 0.5 *
m_a1 * TimeElapsed * TimeElapsed;
227 else if (TimeElapsed <=
m_T1 +
m_T2)
250 if (TimeElapsed <=
m_T1)
261 if (TimeElapsed <=
m_T1)
265 else if (TimeElapsed <=
m_T1 +
m_T2)
297 double& acc,
double&
vel)
310 double delta = xtarget - x0;
313 amax = (delta >= 0) ? amax : -amax;
315 double d1 = fabs(v0) * TG - 0.5 * T3 * fabs(v0);
316 double d2h = (v0 > 0) ? -T3 * v0 + v0 * sqrt(2 * T3 * TG) : -T3 * v0 - v0 * sqrt(2 * T3 * TG);
317 double d2l = (v0 > 0) ? -T3 * v0 - v0 * sqrt(2 * T3 * TG) : -T3 * v0 + v0 * sqrt(2 * T3 * TG);
319 double d3 = 0.5 * v0 * v0 / amax;
329 if (fabs(delta) >= d1)
337 double a = (TG / T3 - 1.0);
338 double b = v0 - delta /
T3;
339 double c = -0.5 * v0 * v0;
343 vel = (-b + sqrt(b * b - 4.0 * a * c)) / (2.0 * a);
345 vel = (-b - sqrt(b * b - 4.0 * a * c)) / (2.0 * a);
350 else if (delta >= d2h || delta <= d2l)
359 double b = -delta - T3 * v0;
360 double c = 0.5 * v0 * v0 *
T3;
364 vel = (-b + sqrt(b * b - 4.0 * a * c)) / (2.0 * a);
366 vel = (-b - sqrt(b * b - 4.0 * a * c)) / (2.0 * a);
371 else if (fabs(delta) >= d3)
386 vel = (2 * acc * delta - v0 * v0) / (2 * acc * TG - 2 * v0);
387 else if (-4 * acc * delta + acc * acc * TG * TG + 2 * acc * TG * v0 - v0 * v0 >= 0)
391 vel = 0.5 * (acc * TG + v0 - sqrt(-4 * acc * delta + acc * acc * TG * TG + 2 * acc * TG * v0 - v0 * v0));
396 vel = 0.5 * (acc * TG + v0 + sqrt(-4 * acc * delta + acc * acc * TG * TG + 2 * acc * TG * v0 - v0 * v0));
418 if (4 * delta * delta - 4 * delta * TG * v0 + 2 * TG * TG * v0 * v0 >= 0)
421 acc = (-2.0 * delta + TG * v0 + sqrt(4 * delta * delta - 4 * delta * TG * v0 + 2 * TG * TG * v0 * v0)) / (TG * TG);
423 acc = (-2.0 * delta + TG * v0 - sqrt(4 * delta * delta - 4 * delta * TG * v0 + 2 * TG * TG * v0 * v0)) / (TG * TG);
virtual double getPos(double TimeElapsed)
returns the planned position for TimeElapsed (seconds)
RampCommand * m_nachumkehr
RampCommand(double x0, double v0, double xtarget, double amax, double vmax)
virtual double getTotalTime()
returns the planned total time for the movement (in seconds)
static void calculateAV(double x0, double v0, double xtarget, double time, double T3, double amax, double vmax, double &a, double &v)
Calculate the necessary a and v of a rampmove, so that the move will take the desired time...
virtual double vel()
returns the planned velocity at time of function call (desired velocitys)
virtual double getVel(double TimeElapsed)
returns the planned velocity for TimeElapsed (seconds)
virtual RampCommand & operator=(const RampCommand &rc)