mirror of
https://gitee.com/xiaohuolufeihua/bizhang_-obav.git
synced 2026-05-22 09:28:58 +00:00
simulated sensors minor cleanup
- mavlink receiver use PX4Accelerometer/PX4Gyroscope for hil_sensor and hil_state_quaternion - simulator module remove unnecessary fake scaling - sih module remove unnecessary fake scaling
This commit is contained in:
@@ -195,26 +195,20 @@ void Simulator::update_sensors(const hrt_abstime &time, const mavlink_hil_sensor
|
||||
|
||||
// gyro
|
||||
if (!_param_sim_gyro_block.get()) {
|
||||
static constexpr float scaling = 1000.0f;
|
||||
_px4_gyro.set_scale(1 / scaling);
|
||||
_px4_gyro.set_temperature(imu.temperature);
|
||||
_px4_gyro.update(time, imu.xgyro * scaling, imu.ygyro * scaling, imu.zgyro * scaling);
|
||||
_px4_gyro.update(time, imu.xgyro, imu.ygyro, imu.zgyro);
|
||||
}
|
||||
|
||||
// accel
|
||||
if (!_param_sim_accel_block.get()) {
|
||||
static constexpr float scaling = 1000.0f;
|
||||
_px4_accel.set_scale(1 / scaling);
|
||||
_px4_accel.set_temperature(imu.temperature);
|
||||
_px4_accel.update(time, imu.xacc * scaling, imu.yacc * scaling, imu.zacc * scaling);
|
||||
_px4_accel.update(time, imu.xacc, imu.yacc, imu.zacc);
|
||||
}
|
||||
|
||||
// magnetometer
|
||||
if (!_param_sim_mag_block.get()) {
|
||||
static constexpr float scaling = 1000.0f;
|
||||
_px4_mag.set_scale(1 / scaling);
|
||||
_px4_mag.set_temperature(imu.temperature);
|
||||
_px4_mag.update(time, imu.xmag * scaling, imu.ymag * scaling, imu.zmag * scaling);
|
||||
_px4_mag.update(time, imu.xmag, imu.ymag, imu.zmag);
|
||||
}
|
||||
|
||||
// baro
|
||||
|
||||
Reference in New Issue
Block a user