Skip to content

Commit

Permalink
LQG docs and scope
Browse files Browse the repository at this point in the history
  • Loading branch information
Neil T. Dantam committed Apr 6, 2015
1 parent 5c71c6f commit 42b0646
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 25 deletions.
16 changes: 9 additions & 7 deletions include/reflex/lqg.h
Expand Up @@ -91,14 +91,15 @@ void rfx_lqg_kf_correct_cov
/* The next few typedefs define functions for computing state updates,
* expected measurements, and linearizing the system */

/** Function to compute process update and linearization.
/**
* Function to compute process update and linearization.
*
* \f[ x \approx F x \f]
*
* @param cx context struct
* @param x state vector
* @param u input vector
* @param F linearized process model
* @param[in,out] cx context struct
* @param[in,out] x state vector
* @param[in] u input vector
* @param[out] F linearized process model
*
* @pre
* - x contains the prior state estimate
Expand All @@ -108,7 +109,8 @@ void rfx_lqg_kf_correct_cov
*/
typedef int (*rfx_lqg_ekf_process_fun)( void *cx, double *x, const double *u, double *F );

/** Function to compute innovation and linearization.
/**
* Function to compute innovation and linearization.
*
* \f[ y = h(x) \f]
*
Expand All @@ -117,7 +119,7 @@ typedef int (*rfx_lqg_ekf_process_fun)( void *cx, double *x, const double *u, do
* @param cx context struct
* @param x state vector
* @param y predicted measurement
* @param F linearized measurement model
* @param H linearized measurement model
*
* @post
* - y contains the predicted measurement for state x
Expand Down
40 changes: 22 additions & 18 deletions src/lqg/lqg.c
Expand Up @@ -177,26 +177,30 @@ int rfx_lqg_ekf_correct
{
int i;

double y[n_z];
double H[n_z*n_x];
i = measure(cx, x, y, H);
if(i) return i;

double K[n_x*n_z];
i = rfx_lqg_kf_correct_gain( n_x, n_z, H, P, W, K );
if(i) return i;

i = innovate(cx, x, z, y);
if(i) return i;

double Ky[n_x];
cblas_dgemv( CblasColMajor, CblasNoTrans,
(int)n_x, (int)n_z,
1.0, K, (int)n_x,
y, 1,
0.0, Ky, 1 );

i = update(cx, x, Ky);
{
double y[n_z];
i = measure(cx, x, y, H);
if(i) return i;

i = rfx_lqg_kf_correct_gain( n_x, n_z, H, P, W, K );
if(i) return i;

i = innovate(cx, x, z, y);
if(i) return i;

{
double Ky[n_x];
cblas_dgemv( CblasColMajor, CblasNoTrans,
(int)n_x, (int)n_z,
1.0, K, (int)n_x,
y, 1,
0.0, Ky, 1 );

i = update(cx, x, Ky);
}
}

rfx_lqg_kf_correct_cov( n_x, n_z, H, P, K );

Expand Down

0 comments on commit 42b0646

Please sign in to comment.