Control software for the ??SRT telescope
 All Classes Namespaces Functions Variables Enumerations Enumerator Pages
2 #define KALMAN_H_LOADED 1
4 #include "types.h"
16 class Kalman {
17  // This implementation surreptitiously manages _two_ Kalman filters,
18  // one for movement in the positive direction, and another for
19  // movement in the negative direction (since the elevation drive moves
20  // at different speeds going and and going down). We update
21  // either vmax_pos_ or vmax_neg_ in the two cases.
22  // This should be transparent to the caller.
24 private:
26  double theta_;
28  double vmax_pos_;
30  double vmax_neg_;
32  double dtheta2_;
35  double dvmax2_;
37  double dz2_;
39  // Internal covariance matrix
40  double p00_, p01_, p10_, p11_;
42  ms_t t_; // last update time
44  char logchar_; // if not '\0', then be chatty
46 public:
47  Kalman();
48  Kalman(double theta, // initial position
49  double maxthetadot, // initial estimate of actual speed (rad/s) for commanded speed 255
50  double dz,
51  ms_t initial_time);
52  // in both of the following, speed is given as a fraction of full speed
53  void update(ms_t t, double speed);
54  void click(ms_t t, double speed, double click_angle);
56  void reset_angle(double ang);
59  double angle(void) const { return theta_; }
61  double fullspeed_pos(void) const { return vmax_pos_*1000.0; }
63  double fullspeed_neg(void) const { return vmax_neg_*1000.0; }
64  // are the following the best returns, here?
66  double angle_error(void) const { return p00_; }
68  double fullspeed_error(void) const { return p11_; }
77  void verbose(char verbose_char) { logchar_ = verbose_char; }
78 };
81 #endif /* KALMAN_H_LOADED */
double angle_error(void) const
An estimate of the error in angular position, in units of radians-squared.
Definition: kalman.h:66
void update(ms_t t, double speed)
Update the position.
Definition: kalman.cpp:92
void click(ms_t t, double speed, double click_angle)
Update the position with a position measurement.
Definition: kalman.cpp:136
void verbose(char verbose_char)
Enable tracing of the behaviour of the Kalman filter.
Definition: kalman.h:77
double fullspeed_neg(void) const
The current estimate of the reference/maximum speed, when driven in the negative direction.
Definition: kalman.h:63
double fullspeed_error(void) const
An estimate of the error in reference speed.
Definition: kalman.h:68
void reset_angle(double ang)
Set the current estimate of the angle.
Definition: kalman.cpp:78
double fullspeed_pos(void) const
The current estimate of the reference/maximum speed, when driven in the positive direction.
Definition: kalman.h:61
double angle(void) const
The current estimate of the angle.
Definition: kalman.h:59
A one-dimensional Kalman filter, which has as its state variables position, measured in radians from ...
Definition: kalman.h:16
No-arg constructor.
Definition: kalman.cpp:65