rosflight_sim/src/sil_board.cpp
// sensors
/// TODO these sensors have noise, no bias
/// noise params are hard coded
sensors
TODO these sensors have noise, no bias
noise params are hard coded
sensors TODO these sensors have noise no bias noise params are hard coded
void SIL_Board::sensors_init()
{
  GZ_COMPAT_SET_X(gyro_bias_, gyro_bias_range_*uniform_distribution_(random_generator_));
  GZ_COMPAT_SET_Y(gyro_bias_, gyro_bias_range_*uniform_distribution_(random_generator_));
  GZ_COMPAT_SET_Z(gyro_bias_, gyro_bias_range_*uniform_distribution_(random_generator_));
  GZ_COMPAT_SET_X(acc_bias_, acc_bias_range_*uniform_distribution_(random_generator_));
  GZ_COMPAT_SET_Y(acc_bias_, acc_bias_range_*uniform_distribution_(random_generator_));
  GZ_COMPAT_SET_Z(acc_bias_, acc_bias_range_*uniform_distribution_(random_generator_));
  double inclination_ = 1.14316156541;
  double declination_ = 0.198584539676;
  GZ_COMPAT_SET_Z(inertial_magnetic_field_, sin(-inclination_));
  GZ_COMPAT_SET_X(inertial_magnetic_field_, cos(-inclination_)*cos(-declination_));
  GZ_COMPAT_SET_Y(inertial_magnetic_field_, cos(-inclination_)*sin(-declination_));
}
void SIL_Board :: sensors_init ( ) { GZ_COMPAT_SET_X ( gyro_bias_ , gyro_bias_range_ * uniform_distribution_ ( random_generator_ ) ) ; GZ_COMPAT_SET_Y ( gyro_bias_ , gyro_bias_range_ * uniform_distribution_ ( random_generator_ ) ) ; GZ_COMPAT_SET_Z ( gyro_bias_ , gyro_bias_range_ * uniform_distribution_ ( random_generator_ ) ) ; GZ_COMPAT_SET_X ( acc_bias_ , acc_bias_range_ * uniform_distribution_ ( random_generator_ ) ) ; GZ_COMPAT_SET_Y ( acc_bias_ , acc_bias_range_ * uniform_distribution_ ( random_generator_ ) ) ; GZ_COMPAT_SET_Z ( acc_bias_ , acc_bias_range_ * uniform_distribution_ ( random_generator_ ) ) ; double inclination_ = 1.14316156541 ; double declination_ = 0.198584539676 ; GZ_COMPAT_SET_Z ( inertial_magnetic_field_ , sin ( - inclination_ ) ) ; GZ_COMPAT_SET_X ( inertial_magnetic_field_ , cos ( - inclination_ ) * cos ( - declination_ ) ) ; GZ_COMPAT_SET_Y ( inertial_magnetic_field_ , cos ( - inclination_ ) * sin ( - declination_ ) ) ; }
sensors
TODO these sensors have noise, no bias
noise params are hard coded
sensors TODO these sensors have noise no bias noise params are hard coded
// Initialize the Biases // Gazebo coordinates is NWU and Earth's magnetic field is defined in NED, hence the negative signs