mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-05-12 12:57:35 +08:00
Change folder name
This commit is contained in:
committed by
Mathieu Bresciani
parent
b9dd1e54c5
commit
00cd720a66
@@ -0,0 +1,44 @@
|
||||
#include "Imu.h"
|
||||
|
||||
namespace sensor_simulator::sensor
|
||||
{
|
||||
|
||||
Imu::Imu(Ekf* ekf):Sensor(ekf)
|
||||
{
|
||||
}
|
||||
|
||||
Imu::~Imu()
|
||||
{
|
||||
}
|
||||
|
||||
void Imu::send(uint32_t time)
|
||||
{
|
||||
// fill imu sample with stored data
|
||||
imuSample imu_sample;
|
||||
imu_sample.time_us = time;
|
||||
imu_sample.delta_ang_dt = (time - _time_last_data_sent) * 1.e-6f;
|
||||
imu_sample.delta_ang = _gyro_data * imu_sample.delta_ang_dt;
|
||||
imu_sample.delta_vel_dt = (time - _time_last_data_sent) * 1.e-6f;
|
||||
imu_sample.delta_vel = _accel_data * imu_sample.delta_vel_dt;
|
||||
|
||||
_ekf->setIMUData(imu_sample);
|
||||
_time_last_data_sent = time;
|
||||
}
|
||||
|
||||
void Imu::setData(Vector3f accel, Vector3f gyro)
|
||||
{
|
||||
setAccelData(accel);
|
||||
setGyroData(gyro);
|
||||
}
|
||||
|
||||
void Imu::setAccelData(Vector3f accel)
|
||||
{
|
||||
_accel_data = accel;
|
||||
}
|
||||
|
||||
void Imu::setGyroData(Vector3f gyro)
|
||||
{
|
||||
_gyro_data = gyro;
|
||||
}
|
||||
|
||||
} // namespace sensor_simulator::sensor
|
||||
Reference in New Issue
Block a user