Paparazzi UAS v7.0_unstable
Paparazzi is a free software Unmanned Aircraft System.
Loading...
Searching...
No Matches
nps_sensor_accel.c
Go to the documentation of this file.
1#include "nps_sensor_accel.h"
2
3#include "nps_fdm.h"
4#include "nps_random.h"
5#include "nps_sensors.h"
7
26
27void nps_sensor_accel_run_step(struct NpsSensorAccel *accel, double time, struct DoubleRMat *body_to_imu)
28{
29 if (time < accel->next_update) {
30 return;
31 }
32
33 /* transform to imu frame */
36
37 /* compute accelero readings */
39 VECT3_ADD(accel->value, accel->neutral);
40
41 /* Compute sensor error */
43 /* constant bias */
45 /* white noise */
47 /* scale */
48 struct DoubleVect3 gain = {accel->sensitivity.m[0], accel->sensitivity.m[4], accel->sensitivity.m[8]};
50 /* add error */
52
53 /* round signal to account for adc discretisation */
55 /* saturate */
56 VECT3_BOUND_CUBE(accel->value, accel->min, accel->max);
57
58 accel->next_update += NPS_ACCEL_DT;
59 accel->data_available = TRUE;
60}
61
#define DOUBLE_VECT3_ROUND(_v)
rotation matrix
#define FLOAT_VECT3_ZERO(_v)
#define FLOAT_MAT33_DIAG(_m, _d00, _d11, _d22)
#define VECT3_BOUND_CUBE(_v, _min, _max)
#define VECT3_EW_MUL(_vo, _va, _vb)
#define MAT33_VECT3_MUL(_vout, _mat, _vin)
#define VECT3_ASSIGN(_a, _x, _y, _z)
#define VECT3_COPY(_a, _b)
#define VECT3_ADD(_a, _b)
uint16_t foo
Definition main_demo5.c:58
struct DoubleVect3 body_accel
acceleration in body frame as measured by an accelerometer (incl.
Definition nps_fdm.h:87
struct NpsFdm fdm
Holds all necessary NPS FDM state information.
void double_vect3_add_gaussian_noise(struct DoubleVect3 *vect, struct DoubleVect3 *std_dev)
Definition nps_random.c:34
void nps_sensor_accel_init(struct NpsSensorAccel *accel, double time)
void nps_sensor_accel_run_step(struct NpsSensorAccel *accel, double time, struct DoubleRMat *body_to_imu)
struct DoubleVect3 noise_std_dev
struct DoubleVect3 neutral
struct DoubleMat33 sensitivity
struct DoubleVect3 bias
struct DoubleVect3 value
Paparazzi fixed point algebra.
#define TRUE
Definition std.h:4
#define FALSE
Definition std.h:5