Classes | Public Member Functions | Private Types | Private Member Functions | Private Attributes | Static Private Attributes | List of all members
rosflight_firmware::Sensors Class Reference

#include <sensors.h>

Classes

struct  Data
 
class  OutlierFilter
 

Public Member Functions

const Datadata () const
 
void get_filtered_IMU (turbomath::Vector &accel, turbomath::Vector &gyro, uint64_t &stamp_us)
 
bool gyro_calibration_complete (void)
 
void init ()
 
void param_change_callback (uint16_t param_id)
 
bool run ()
 
 Sensors (ROSflight &rosflight)
 
bool should_send_imu_data (void)
 
bool start_baro_calibration (void)
 
bool start_diff_pressure_calibration (void)
 
bool start_gyro_calibration (void)
 
bool start_imu_calibration (void)
 

Private Types

enum  : uint8_t {
  BAROMETER, GNSS, DIFF_PRESSURE, SONAR,
  MAGNETOMETER, NUM_LOW_PRIORITY_SENSORS
}
 

Private Member Functions

void calibrate_accel (void)
 
void calibrate_baro (void)
 
void calibrate_diff_pressure (void)
 
void calibrate_gyro (void)
 
void correct_baro (void)
 
void correct_diff_pressure (void)
 
void correct_imu (void)
 
void correct_mag (void)
 
void init_imu ()
 
void look_for_disabled_sensors (void)
 
bool update_imu (void)
 
void update_other_sensors (void)
 

Private Attributes

turbomath::Vector acc_sum_ = {0, 0, 0}
 
float acc_temp_sum_ = 0.0f
 
float accel_ [3] = {0, 0, 0}
 
uint16_t accel_calibration_count_ = 0
 
turbomath::Vector accel_int_
 
bool baro_calibrated_ = false
 
uint16_t baro_calibration_count_ = 0
 
float baro_calibration_mean_ = 0.0f
 
float baro_calibration_var_ = 0.0f
 
OutlierFilter baro_outlier_filt_
 
bool calibrating_acc_flag_ = false
 
bool calibrating_gyro_flag_ = false
 
Data data_
 
OutlierFilter diff_outlier_filt_
 
bool diff_pressure_calibrated_ = false
 
uint16_t diff_pressure_calibration_count_ = 0
 
float diff_pressure_calibration_mean_ = 0.0f
 
float diff_pressure_calibration_var_ = 0.0f
 
const turbomath::Vector gravity_ = {0.0f, 0.0f, 9.80665f}
 
float ground_pressure_ = 0.0f
 
float gyro_ [3] = {0, 0, 0}
 
uint16_t gyro_calibration_count_ = 0
 
turbomath::Vector gyro_int_
 
turbomath::Vector gyro_sum_ = {0, 0, 0}
 
bool imu_data_sent_
 
uint64_t int_start_us_
 
uint32_t last_baro_cal_iter_ms_ = 0
 
uint32_t last_diff_pressure_cal_iter_ms_ = 0
 
uint32_t last_imu_update_ms_ = 0
 
uint32_t last_time_look_for_disarmed_sensors_ = 0
 
turbomath::Vector max_ = {-1000.0f, -1000.0f, -1000.0f}
 
turbomath::Vector min_ = {1000.0f, 1000.0f, 1000.0f}
 
bool new_imu_data_
 
uint8_t next_sensor_to_update_ = BAROMETER
 
uint64_t prev_imu_read_time_us_
 
ROSflightrf_
 
OutlierFilter sonar_outlier_filt_
 

Static Private Attributes

static const float BARO_MAX_CALIBRATION_VARIANCE = 25.0
 
static const float BARO_MAX_CHANGE_RATE = 200.0f
 
static const float BARO_SAMPLE_RATE = 50.0f
 
static const float DIFF_MAX_CHANGE_RATE = 225.0f
 
static const float DIFF_PRESSURE_MAX_CALIBRATION_VARIANCE = 100.0
 
static const float DIFF_SAMPLE_RATE = 50.0f
 
static const int SENSOR_CAL_CYCLES = 127
 
static const int SENSOR_CAL_DELAY_CYCLES = 128
 
static const float SONAR_MAX_CHANGE_RATE = 100.0f
 
static const float SONAR_SAMPLE_RATE = 50.0f
 

Detailed Description

Definition at line 120 of file sensors.h.

Member Enumeration Documentation

anonymous enum : uint8_t
private
Enumerator
BAROMETER 
GNSS 
DIFF_PRESSURE 
SONAR 
MAGNETOMETER 
NUM_LOW_PRIORITY_SENSORS 

Definition at line 213 of file sensors.h.

Constructor & Destructor Documentation

rosflight_firmware::Sensors::Sensors ( ROSflight rosflight)

Definition at line 58 of file sensors.cpp.

Member Function Documentation

void rosflight_firmware::Sensors::calibrate_accel ( void  )
private

Definition at line 409 of file sensors.cpp.

void rosflight_firmware::Sensors::calibrate_baro ( void  )
private

Definition at line 486 of file sensors.cpp.

void rosflight_firmware::Sensors::calibrate_diff_pressure ( void  )
private

Definition at line 524 of file sensors.cpp.

void rosflight_firmware::Sensors::calibrate_gyro ( void  )
private

Definition at line 356 of file sensors.cpp.

void rosflight_firmware::Sensors::correct_baro ( void  )
private

Definition at line 596 of file sensors.cpp.

void rosflight_firmware::Sensors::correct_diff_pressure ( void  )
private

Definition at line 604 of file sensors.cpp.

void rosflight_firmware::Sensors::correct_imu ( void  )
private

Definition at line 562 of file sensors.cpp.

void rosflight_firmware::Sensors::correct_mag ( void  )
private

Definition at line 577 of file sensors.cpp.

const Data& rosflight_firmware::Sensors::data ( ) const
inline

Definition at line 160 of file sensors.h.

void rosflight_firmware::Sensors::get_filtered_IMU ( turbomath::Vector accel,
turbomath::Vector gyro,
uint64_t &  stamp_us 
)

Definition at line 343 of file sensors.cpp.

bool rosflight_firmware::Sensors::gyro_calibration_complete ( void  )

Definition at line 276 of file sensors.cpp.

void rosflight_firmware::Sensors::init ( )

Definition at line 62 of file sensors.cpp.

void rosflight_firmware::Sensors::init_imu ( )
private

Definition at line 96 of file sensors.cpp.

void rosflight_firmware::Sensors::look_for_disabled_sensors ( void  )
private

Definition at line 220 of file sensors.cpp.

void rosflight_firmware::Sensors::param_change_callback ( uint16_t  param_id)

Definition at line 113 of file sensors.cpp.

bool rosflight_firmware::Sensors::run ( void  )

Definition at line 120 of file sensors.cpp.

bool rosflight_firmware::Sensors::should_send_imu_data ( void  )
inline

Definition at line 178 of file sensors.h.

bool rosflight_firmware::Sensors::start_baro_calibration ( void  )

Definition at line 256 of file sensors.cpp.

bool rosflight_firmware::Sensors::start_diff_pressure_calibration ( void  )

Definition at line 266 of file sensors.cpp.

bool rosflight_firmware::Sensors::start_gyro_calibration ( void  )

Definition at line 247 of file sensors.cpp.

bool rosflight_firmware::Sensors::start_imu_calibration ( void  )

Definition at line 236 of file sensors.cpp.

bool rosflight_firmware::Sensors::update_imu ( void  )
private

Definition at line 283 of file sensors.cpp.

void rosflight_firmware::Sensors::update_other_sensors ( void  )
private

Definition at line 136 of file sensors.cpp.

Member Data Documentation

turbomath::Vector rosflight_firmware::Sensors::acc_sum_ = {0, 0, 0}
private

Definition at line 255 of file sensors.h.

float rosflight_firmware::Sensors::acc_temp_sum_ = 0.0f
private

Definition at line 257 of file sensors.h.

float rosflight_firmware::Sensors::accel_[3] = {0, 0, 0}
private

Definition at line 227 of file sensors.h.

uint16_t rosflight_firmware::Sensors::accel_calibration_count_ = 0
private

Definition at line 254 of file sensors.h.

turbomath::Vector rosflight_firmware::Sensors::accel_int_
private

Definition at line 262 of file sensors.h.

bool rosflight_firmware::Sensors::baro_calibrated_ = false
private

Definition at line 268 of file sensors.h.

uint16_t rosflight_firmware::Sensors::baro_calibration_count_ = 0
private

Definition at line 270 of file sensors.h.

float rosflight_firmware::Sensors::baro_calibration_mean_ = 0.0f
private

Definition at line 272 of file sensors.h.

float rosflight_firmware::Sensors::baro_calibration_var_ = 0.0f
private

Definition at line 273 of file sensors.h.

const float rosflight_firmware::Sensors::BARO_MAX_CALIBRATION_VARIANCE = 25.0
staticprivate

Definition at line 196 of file sensors.h.

const float rosflight_firmware::Sensors::BARO_MAX_CHANGE_RATE = 200.0f
staticprivate

Definition at line 188 of file sensors.h.

OutlierFilter rosflight_firmware::Sensors::baro_outlier_filt_
private

Definition at line 283 of file sensors.h.

const float rosflight_firmware::Sensors::BARO_SAMPLE_RATE = 50.0f
staticprivate

Definition at line 189 of file sensors.h.

bool rosflight_firmware::Sensors::calibrating_acc_flag_ = false
private

Definition at line 230 of file sensors.h.

bool rosflight_firmware::Sensors::calibrating_gyro_flag_ = false
private

Definition at line 231 of file sensors.h.

Data rosflight_firmware::Sensors::data_
private

Definition at line 225 of file sensors.h.

const float rosflight_firmware::Sensors::DIFF_MAX_CHANGE_RATE = 225.0f
staticprivate

Definition at line 190 of file sensors.h.

OutlierFilter rosflight_firmware::Sensors::diff_outlier_filt_
private

Definition at line 284 of file sensors.h.

bool rosflight_firmware::Sensors::diff_pressure_calibrated_ = false
private

Definition at line 276 of file sensors.h.

uint16_t rosflight_firmware::Sensors::diff_pressure_calibration_count_ = 0
private

Definition at line 277 of file sensors.h.

float rosflight_firmware::Sensors::diff_pressure_calibration_mean_ = 0.0f
private

Definition at line 279 of file sensors.h.

float rosflight_firmware::Sensors::diff_pressure_calibration_var_ = 0.0f
private

Definition at line 280 of file sensors.h.

const float rosflight_firmware::Sensors::DIFF_PRESSURE_MAX_CALIBRATION_VARIANCE = 100.0
staticprivate

Definition at line 197 of file sensors.h.

const float rosflight_firmware::Sensors::DIFF_SAMPLE_RATE = 50.0f
staticprivate

Definition at line 191 of file sensors.h.

const turbomath::Vector rosflight_firmware::Sensors::gravity_ = {0.0f, 0.0f, 9.80665f}
private

Definition at line 256 of file sensors.h.

float rosflight_firmware::Sensors::ground_pressure_ = 0.0f
private

Definition at line 269 of file sensors.h.

float rosflight_firmware::Sensors::gyro_[3] = {0, 0, 0}
private

Definition at line 228 of file sensors.h.

uint16_t rosflight_firmware::Sensors::gyro_calibration_count_ = 0
private

Definition at line 252 of file sensors.h.

turbomath::Vector rosflight_firmware::Sensors::gyro_int_
private

Definition at line 263 of file sensors.h.

turbomath::Vector rosflight_firmware::Sensors::gyro_sum_ = {0, 0, 0}
private

Definition at line 253 of file sensors.h.

bool rosflight_firmware::Sensors::imu_data_sent_
private

Definition at line 249 of file sensors.h.

uint64_t rosflight_firmware::Sensors::int_start_us_
private

Definition at line 264 of file sensors.h.

uint32_t rosflight_firmware::Sensors::last_baro_cal_iter_ms_ = 0
private

Definition at line 271 of file sensors.h.

uint32_t rosflight_firmware::Sensors::last_diff_pressure_cal_iter_ms_ = 0
private

Definition at line 278 of file sensors.h.

uint32_t rosflight_firmware::Sensors::last_imu_update_ms_ = 0
private

Definition at line 246 of file sensors.h.

uint32_t rosflight_firmware::Sensors::last_time_look_for_disarmed_sensors_ = 0
private

Definition at line 245 of file sensors.h.

turbomath::Vector rosflight_firmware::Sensors::max_ = {-1000.0f, -1000.0f, -1000.0f}
private

Definition at line 258 of file sensors.h.

turbomath::Vector rosflight_firmware::Sensors::min_ = {1000.0f, 1000.0f, 1000.0f}
private

Definition at line 259 of file sensors.h.

bool rosflight_firmware::Sensors::new_imu_data_
private

Definition at line 248 of file sensors.h.

uint8_t rosflight_firmware::Sensors::next_sensor_to_update_ = BAROMETER
private

Definition at line 232 of file sensors.h.

uint64_t rosflight_firmware::Sensors::prev_imu_read_time_us_
private

Definition at line 265 of file sensors.h.

ROSflight& rosflight_firmware::Sensors::rf_
private

Definition at line 223 of file sensors.h.

const int rosflight_firmware::Sensors::SENSOR_CAL_CYCLES = 127
staticprivate

Definition at line 195 of file sensors.h.

const int rosflight_firmware::Sensors::SENSOR_CAL_DELAY_CYCLES = 128
staticprivate

Definition at line 194 of file sensors.h.

const float rosflight_firmware::Sensors::SONAR_MAX_CHANGE_RATE = 100.0f
staticprivate

Definition at line 192 of file sensors.h.

OutlierFilter rosflight_firmware::Sensors::sonar_outlier_filt_
private

Definition at line 285 of file sensors.h.

const float rosflight_firmware::Sensors::SONAR_SAMPLE_RATE = 50.0f
staticprivate

Definition at line 193 of file sensors.h.


The documentation for this class was generated from the following files:


rosflight_firmware
Author(s): Daniel Koch , James Jackson
autogenerated on Wed Jul 3 2019 19:59:31