38 #include "rosflight.h" 88 ground_pressure_ = 101325.0f*
static_cast<float>(pow((1-2.25694e-5 * alt), 5.2553));
366 if (gyro_bias.
norm() < 1.0)
397 a.
y > b.
y ? a.
y : b.
y,
398 a.
z > b.
z ? a.
z : b.
z);
404 a.
y < b.
y ? a.
y : b.
y,
405 a.
z < b.
z ? a.
z : b.
z);
451 if (accel_bias.
norm() < 3.0)
466 static_cast<uint32_t>(accel_bias.
norm()),
467 static_cast<uint32_t>(accel_bias.
norm()*1000)%1000);
609 float atm = 101325.0f;
618 max_change_ = max_change_rate / update_rate;
626 float diff = new_val - center_;
627 if (fabsf(diff) < window_size_ * max_change_)
632 if (window_size_ > 1)
const turbomath::Vector gravity_
void calibrate_accel(void)
virtual bool gnss_has_new_data()=0
static volatile int16_t gyro[3]
float baro_calibration_mean_
turbomath::Vector vector_min(turbomath::Vector a, turbomath::Vector b)
uint16_t baro_calibration_count_
void param_change_callback(uint16_t param_id)
virtual void sensors_init()=0
turbomath::Quaternion fcu_orientation
static const float DIFF_SAMPLE_RATE
static const float SONAR_SAMPLE_RATE
virtual void imu_not_responding_error()=0
virtual bool diff_pressure_present()=0
float diff_pressure_velocity
turbomath::Vector vector_max(turbomath::Vector a, turbomath::Vector b)
static const float DIFF_MAX_CHANGE_RATE
void reset_adaptive_bias()
void correct_diff_pressure(void)
turbomath::Vector gyro_sum_
static const float BARO_MAX_CALIBRATION_VARIANCE
void set_event(Event event)
bool start_imu_calibration(void)
virtual void diff_pressure_update()=0
virtual bool new_imu_data()=0
float baro_calibration_var_
bool diff_pressure_calibrated_
virtual void sonar_update()=0
uint32_t last_baro_cal_iter_ms_
OutlierFilter baro_outlier_filt_
static const float DIFF_PRESSURE_MAX_CALIBRATION_VARIANCE
bool set_param_float(uint16_t id, float value)
Sets the value of a floating point parameter by ID and calls the parameter callback.
uint16_t diff_pressure_calibration_count_
virtual void diff_pressure_read(float *diff_pressure, float *temperature)=0
CommManager comm_manager_
virtual void mag_update()=0
float diff_pressure_calibration_mean_
bool update(float new_val, float *val)
OutlierFilter diff_outlier_filt_
virtual void baro_read(float *pressure, float *temperature)=0
virtual void gnss_update()=0
bool diff_pressure_present
virtual bool sonar_present()=0
virtual GNSSRaw gnss_raw_read()=0
void calibrate_diff_pressure(void)
float get_param_float(uint16_t id) const
Get the value of a floating point parameter by id.
uint64_t prev_imu_read_time_us_
virtual void mag_read(float mag[3])=0
virtual GNSSData gnss_read()=0
static volatile int16_t accel[3]
bool calibrating_acc_flag_
void calibrate_baro(void)
static const float BARO_SAMPLE_RATE
static const int SENSOR_CAL_CYCLES
void add_callback(std::function< void(int)> callback, uint16_t param_id)
bool start_gyro_calibration(void)
bool start_baro_calibration(void)
bool gyro_calibration_complete(void)
virtual uint64_t clock_micros()=0
const State & state() const
bool calibrating_gyro_flag_
void set_error(uint16_t error)
rosflight_firmware::ROSflight * rosflight
float diff_pressure_calibration_var_
virtual void baro_update()=0
uint32_t last_diff_pressure_cal_iter_ms_
void clear_error(uint16_t error)
uint32_t last_imu_update_ms_
static const float BARO_MAX_CHANGE_RATE
turbomath::Vector accel_int_
virtual bool gnss_present()=0
void log(CommLink::LogSeverity severity, const char *fmt,...)
void get_filtered_IMU(turbomath::Vector &accel, turbomath::Vector &gyro, uint64_t &stamp_us)
uint16_t gyro_calibration_count_
void init(float max_change_rate, float update_rate, float center)
void look_for_disabled_sensors(void)
virtual uint32_t clock_millis()=0
uint16_t accel_calibration_count_
Sensors(ROSflight &rosflight)
turbomath::Vector gyro_int_
virtual float sonar_read()=0
virtual bool imu_read(float accel[3], float *temperature, float gyro[3], uint64_t *time)=0
bool start_diff_pressure_calibration(void)
StateManager state_manager_
turbomath::Vector acc_sum_
uint32_t last_time_look_for_disarmed_sensors_
virtual bool baro_present()=0
virtual bool mag_present()=0
static const float SONAR_MAX_CHANGE_RATE
void calibrate_gyro(void)
static const int SENSOR_CAL_DELAY_CYCLES
void update_other_sensors(void)
OutlierFilter sonar_outlier_filt_
uint8_t next_sensor_to_update_