mirror of
https://github.com/paparazzi/paparazzi.git
synced 2026-06-04 22:17:01 +08:00
nps: fill imu_aspirin accel and gyro buffers from imu_feed_gyro_accel
This commit is contained in:
@@ -201,7 +201,7 @@
|
|||||||
<section name="SIMULATOR" prefix="NPS_">
|
<section name="SIMULATOR" prefix="NPS_">
|
||||||
<define name="ACTUATOR_NAMES" value="{"front_motor", "back_motor", "right_motor", "left_motor"}"/>
|
<define name="ACTUATOR_NAMES" value="{"front_motor", "back_motor", "right_motor", "left_motor"}"/>
|
||||||
<define name="INITIAL_CONDITITONS" value=""reset00""/>
|
<define name="INITIAL_CONDITITONS" value=""reset00""/>
|
||||||
<define name="SENSORS_PARAMS" value=""nps_sensors_params_booz2_a1.h""/>
|
<define name="SENSORS_PARAMS" value=""nps_sensors_params_aspirin.h""/>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
<section name="AUTOPILOT">
|
<section name="AUTOPILOT">
|
||||||
|
|||||||
@@ -34,18 +34,37 @@ void imu_aspirin_arch_init(void) {
|
|||||||
|
|
||||||
void imu_feed_gyro_accel(void) {
|
void imu_feed_gyro_accel(void) {
|
||||||
|
|
||||||
/* do something similar to this, fill imu_aspirin.i2c_trans_gyro and
|
#if 1
|
||||||
* imu_aspirin.accel_rx_buf
|
// the high byte is in buf[0], low byte in buf[1], etc.
|
||||||
*/
|
imu_aspirin.i2c_trans_gyro.buf[0] = ((int16_t)sensors.gyro.value.x) >> 8;
|
||||||
#if 0
|
imu_aspirin.i2c_trans_gyro.buf[1] = ((int16_t)sensors.gyro.value.x) & 0xff;
|
||||||
max1168_values[IMU_GYRO_P_CHAN] = sensors.gyro.value.x;
|
imu_aspirin.i2c_trans_gyro.buf[2] = ((int16_t)sensors.gyro.value.y) >> 8;
|
||||||
max1168_values[IMU_GYRO_Q_CHAN] = sensors.gyro.value.y;
|
imu_aspirin.i2c_trans_gyro.buf[3] = ((int16_t)sensors.gyro.value.y) & 0xff;
|
||||||
max1168_values[IMU_GYRO_R_CHAN] = sensors.gyro.value.z;
|
imu_aspirin.i2c_trans_gyro.buf[4] = ((int16_t)sensors.gyro.value.z) >> 8;
|
||||||
max1168_values[IMU_ACCEL_X_CHAN] = sensors.accel.value.x;
|
imu_aspirin.i2c_trans_gyro.buf[5] = ((int16_t)sensors.gyro.value.z) & 0xff;
|
||||||
max1168_values[IMU_ACCEL_Y_CHAN] = sensors.accel.value.y;
|
|
||||||
max1168_values[IMU_ACCEL_Z_CHAN] = sensors.accel.value.z;
|
// low byte in buf[1], high byte in buf[2], etc...
|
||||||
max1168_status = STA_MAX1168_DATA_AVAILABLE;
|
imu_aspirin.accel_rx_buf[1] = ((int16_t)sensors.accel.value.x) & 0xff;
|
||||||
|
imu_aspirin.accel_rx_buf[2] = ((int16_t)sensors.accel.value.x) >> 8;
|
||||||
|
imu_aspirin.accel_rx_buf[3] = ((int16_t)sensors.accel.value.y) & 0xff;
|
||||||
|
imu_aspirin.accel_rx_buf[4] = ((int16_t)sensors.accel.value.y) >> 8;
|
||||||
|
imu_aspirin.accel_rx_buf[5] = ((int16_t)sensors.accel.value.z) & 0xff;
|
||||||
|
imu_aspirin.accel_rx_buf[6] = ((int16_t)sensors.accel.value.z) >> 8;
|
||||||
|
|
||||||
|
// set availability flags...
|
||||||
|
imu_aspirin.accel_available = true;
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
RATES_ASSIGN(imu.gyro_unscaled, sensors.gyro.value.x, sensors.gyro.value.y, sensors.gyro.value.z);
|
||||||
|
VECT3_ASSIGN(imu.accel_unscaled, sensors.accel.value.x, sensors.accel.value.y, sensors.accel.value.z);
|
||||||
|
|
||||||
|
// set availability flags...
|
||||||
|
imu_aspirin.accel_available = true;
|
||||||
|
imu_aspirin.gyro_available_blaaa = true;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user