![]() |
QP
0.7-SNAPSHOT
Control software for the ??SRT telescope
|
A one-dimensional Kalman filter, which has as its state variables position, measured in radians from some implied reference point, and a reference speed, in radians per unit time, which is the actual maximum speed when the telescope motors are full on (ie, corresponding to commanded speed 1.0). More...
#include <kalman.h>
Public Member Functions | |
Kalman () | |
No-arg constructor. | |
Kalman (double theta, double maxthetadot, double dz, ms_t initial_time) | |
Create a one-dimensional Kalman filter for angular position. More... | |
void | update (ms_t t, double speed) |
Update the position. More... | |
void | click (ms_t t, double speed, double click_angle) |
Update the position with a position measurement. More... | |
void | reset_angle (double ang) |
Set the current estimate of the angle. More... | |
double | angle (void) const |
The current estimate of the angle. | |
double | fullspeed_pos (void) const |
The current estimate of the reference/maximum speed, when driven in the positive direction. | |
double | fullspeed_neg (void) const |
The current estimate of the reference/maximum speed, when driven in the negative direction. | |
double | angle_error (void) const |
An estimate of the error in angular position, in units of radians-squared. | |
double | fullspeed_error (void) const |
An estimate of the error in reference speed. | |
void | verbose (char verbose_char) |
Enable tracing of the behaviour of the Kalman filter. More... | |
A one-dimensional Kalman filter, which has as its state variables position, measured in radians from some implied reference point, and a reference speed, in radians per unit time, which is the actual maximum speed when the telescope motors are full on (ie, corresponding to commanded speed 1.0).
The 'speeds' provided to this class, in the range [-1.0,1.0], are relative to this reference speed.
Kalman::Kalman | ( | double | theta, |
double | maxthetadot, | ||
double | dz, | ||
ms_t | initial_time | ||
) |
Create a one-dimensional Kalman filter for angular position.
The filter manages estimates for the position and the angular reference speed. This speed is the speed in rad/s which corresponds to relative speed 1.0.
The filter is reasonably insensitive to the initial values chosen here; indeed part of the point of it is to improve these and their estimated errors. The filter does not (currently) maintain an estimate of the error dz
. Note that if this dz
error is estimated too small, the filter becomes rather unstable.
The angle is not normalised to stay in any particular range.
theta | the initial estimate of the angle (rad) |
maxthetadot | the initial estimate of the reference speed (rad/s), corresponding to commanded speed 1.0 |
dz | an estimate of the error in the actual positions of the reed switches (rad) |
initial_time | the start time of the filter (ms) |
void Kalman::click | ( | ms_t | t, |
double | speed, | ||
double | ref_angle | ||
) |
Update the position with a position measurement.
The provided speed is taken to have been constant over the interval from the last update to now.
t | the current time (ms) |
speed | the current speed (fractional speed) |
ref_angle | the current actual angle (rad) |
void Kalman::reset_angle | ( | double | ang | ) |
Set the current estimate of the angle.
This is not an update of the position estimate, but an unequivocal reset of the value.
ang | the current angle |
void Kalman::update | ( | ms_t | t, |
double | speed | ||
) |
Update the position.
The provided speed is taken to have been constant over the interval from the last update to now. This is equivalent to the click method but with an infinite measurement variance, and hence a trivial (effectively absent) corrector step.
t | the current time (ms) |
speed | the current speed (fractional speed) |
|
inline |
Enable tracing of the behaviour of the Kalman filter.
After this method is called with a character argument, updates to the filter result in a tracing line written to the serial port, which starts with that character. The format of these is not currently documented here: see the code for details.