|
Paparazzi UAS
v5.18.0_stable
Paparazzi is a free software Unmanned Aircraft System.
|
Go to the documentation of this file.
47 #ifndef DRAGSPEED_SEND_ABI_MESSAGE
48 #define DRAGSPEED_SEND_ABI_MESSAGE TRUE
51 #ifndef DRAGSPEED_ACCEL_ID
52 #define DRAGSPEED_ACCEL_ID ABI_BROADCAST
55 #ifndef DRAGSPEED_COEFF_X
56 #define DRAGSPEED_COEFF_X 1.0
59 #ifndef DRAGSPEED_COEFF_Y
60 #define DRAGSPEED_COEFF_Y 1.0
64 #define DRAGSPEED_R 0.25
67 #ifndef DRAGSPEED_FILTER
68 #define DRAGSPEED_FILTER 0.8
88 #ifdef DRAGSPEED_ZERO_X
91 #ifdef DRAGSPEED_ZERO_Y
94 #if defined(DRAGSPEED_ZERO_X) && defined(DRAGSPEED_ZERO_Y)
134 #if DRAGSPEED_SEND_ABI_MESSAGE
157 static bool calibrate_prev =
FALSE;
159 static int num_samples_x = 0;
160 static int num_samples_y = 0;
176 "[dragspeed] Error: zero measurement should be calibrated before drag coefficient!\n");
186 + sinf(att->
psi) * vel_ins->
x, -sinf(att->
psi) * vel_ins->
y
187 + cosf(att->
psi) * vel_ins->
x };
189 if (fabsf(vel_ins_body.
x) > 0.5) {
192 coeff.
x = (coeff.
x * num_samples_x + this_coeff) / (num_samples_x + 1);
195 if (fabsf(vel_ins_body.
y) > 0.5) {
198 coeff.
y = (coeff.
y * num_samples_y + this_coeff) / (num_samples_y + 1);
202 if (num_samples_x > 1000 && num_samples_y > 1000 && coeff.
x != 0
219 static bool calibrate_prev =
FALSE;
221 static int num_samples = 0;
235 float ins_speed = sqrtf(vel_ins->
x * vel_ins->
x + vel_ins->
y * vel_ins->
y);
236 if (ins_speed < 0.1) {
243 if (num_samples > 1000) {
257 + sinf(att->
psi) * vel_ins->
x, -sinf(att->
psi) * vel_ins->
y
258 + cosf(att->
psi) * vel_ins->
x };
261 &vel_ins_body.
x, &vel_ins_body.
y);
struct dragspeed_t dragspeed
static void calibrate_zero(struct Int32Vect3 *accel)
Calibrate zero velocity by measuring the accelerations while the drone hovers in-place.
bool dragspeed_is_calibrating(void)
bool dragspeed_calibrate_zero(void)
void dragspeed_init(void)
Event structure to store callbacks in a linked list.
static struct FloatEulers * stateGetNedToBodyEulers_f(void)
Get vehicle body attitude euler angles (float).
static void calibrate_coeff(struct Int32Vect3 *accel)
Calibrate drag coefficient by comparing accelerometer measurements to INS velocities.
bool dragspeed_calibrate_coeff(void)
#define DRAGSPEED_ACCEL_ID
#define ACCEL_FLOAT_OF_BFP(_ai)
static abi_event accel_ev
static const struct usb_device_descriptor dev
#define DRAGSPEED_COEFF_X
int8_t register_periodic_telemetry(struct periodic_telemetry *_pt, uint8_t _id, telemetry_cb _cb)
Register a telemetry callback function.
vector in East North Up coordinates Units: meters
static void accel_cb(uint8_t sender_id, uint32_t stamp, struct Int32Vect3 *accel)
static void send_dragspeed(struct transport_tx *trans, struct link_device *dev)
static struct EnuCoor_f * stateGetSpeedEnu_f(void)
Get ground speed in local ENU coordinates (float).
#define DefaultPeriodic
Set default periodic telemetry.
#define DRAGSPEED_COEFF_Y