#include <stop_line.h>
Public Member Functions | |
result_t | control (pilot_command_t &pcmd, float topspeed=3.0) |
void | reset (void) |
StopLine (Navigator *navptr, int _verbose) | |
~StopLine () | |
Private Member Functions | |
void | reset_me (void) |
Private Attributes | |
bool | creeping |
double | initial_speed |
double | max_creep_distance |
bool | stopping |
Definition at line 15 of file stop_line.h.
StopLine::StopLine | ( | Navigator * | navptr, | |
int | _verbose | |||
) |
This is based on the unpublished "Control Tutorial" draft dated January 26, 2004 by Dr. Benjamin Kuypers, section 5: "The Stopping Controller". He recommends a constant deceleration instead of the simpler exponential decay. The dynamical system is:
x_dot = -k * sqrt(x)
Solving analytically with initial condition x(0) = D and v(0) = V yields these equations of motion:
x(t) = (sqrt(D) - V*t/(2*sqrt(D)))**2 (parabolic drop) v(t) = dx/dt = (V**2/2*D)*t + V (linear velocity) a(t) = dv/dt = V**2/(2*D) = A (constant deceleration)
Note that the initial velocity V is negative in these equations, because it represents motion from positive x to zero. The system stops in finite time T = -2*D/V, with x(T) = 0, and v(T) = 0.
For example, when D = 10m from stop line and V = -5m/s, the vehicle stops in 4 seconds at a constant 1.25m/s/s deceleration.
Definition at line 42 of file stop_line.cc.
StopLine::~StopLine | ( | ) |
Definition at line 48 of file stop_line.cc.
Controller::result_t StopLine::control | ( | pilot_command_t & | pcmd, | |
float | topspeed = 3.0 | |||
) |
Set speed for steady deceleration to stop way-point
pcmd | contains desired heading and speed, assuming it is not yet time to stop, updated on exit | |
topspeed | velocity limit |
Definition at line 63 of file stop_line.cc.
void StopLine::reset | ( | void | ) | [virtual] |
Reimplemented from Controller.
Definition at line 156 of file stop_line.cc.
void StopLine::reset_me | ( | void | ) | [private, virtual] |
Reimplemented from Controller.
Definition at line 163 of file stop_line.cc.
bool StopLine::creeping [private] |
Definition at line 28 of file stop_line.h.
double StopLine::initial_speed [private] |
Definition at line 29 of file stop_line.h.
double StopLine::max_creep_distance [private] |
Definition at line 30 of file stop_line.h.
bool StopLine::stopping [private] |
Definition at line 27 of file stop_line.h.