Browse Source

Full HIL working!

git-svn-id: https://arducopter.googlecode.com/svn/trunk@963 f9c3cf11-9bcb-44bc-f272-b75c42450872
master
james.goppert 14 years ago
parent
commit
7a0fcd6f59
  1. 19
      libraries/AP_ADC/AP_ADC_HIL.cpp
  2. 4
      libraries/AP_ADC/AP_ADC_HIL.h

19
libraries/AP_ADC/AP_ADC_HIL.cpp

@ -20,8 +20,21 @@ const float AP_ADC_HIL::accelBias[3] = {2025,2025,2025}; @@ -20,8 +20,21 @@ const float AP_ADC_HIL::accelBias[3] = {2025,2025,2025};
const float AP_ADC_HIL::gyroScale[3] = {142.239, 139.746, 139.746};
const float AP_ADC_HIL::accelScale[3] = {418,418,418}; // adcPerG
AP_ADC_HIL::AP_ADC_HIL() : adcValue()
AP_ADC_HIL::AP_ADC_HIL()
{
// gyros set to zero for calibration
setGyro(0,0);
setGyro(1,0);
setGyro(2,0);
// accels set to zero for calibration
setAccel(0,0);
setAccel(1,0);
setAccel(2,0);
// set diff press and temp to zero
setGyroTemp(0);
setPressure(0);
}
void AP_ADC_HIL::Init(void)
@ -48,8 +61,8 @@ int AP_ADC_HIL::setHIL(int16_t p, int16_t q, int16_t r, int16_t gyroTemp, @@ -48,8 +61,8 @@ int AP_ADC_HIL::setHIL(int16_t p, int16_t q, int16_t r, int16_t gyroTemp,
// accel
setAccel(0,aX);
setAccel(0,aY);
setAccel(0,aZ);
setAccel(1,aY);
setAccel(2,aZ);
// differential pressure
setPressure(diffPress);

4
libraries/AP_ADC/AP_ADC_HIL.h

@ -63,7 +63,7 @@ class AP_ADC_HIL : public AP_ADC @@ -63,7 +63,7 @@ class AP_ADC_HIL : public AP_ADC
// @param index the axis for the gyro(0-x,1-y,2-z)
inline void setGyro(uint8_t index, int16_t val) {
int16_t temp = val * gyroScale[index] / 1000 + gyroBias[index];
adcValue[index] = (sensorSign[index] < 0) ? -temp : temp;
adcValue[sensors[index]] = (sensorSign[index] < 0) ? -temp : temp;
}
///
@ -72,7 +72,7 @@ class AP_ADC_HIL : public AP_ADC @@ -72,7 +72,7 @@ class AP_ADC_HIL : public AP_ADC
// @param index the axis for the accelerometer(0-x,1-y,2-z)
inline void setAccel(uint8_t index, int16_t val) {
int16_t temp = val * accelScale[index] / 1000 + accelBias[index];
adcValue[index+3] = (sensorSign[index+3] < 0) ? -temp : temp;
adcValue[sensors[index+3]] = (sensors[index+3] < 0) ? -temp : temp;
}
///

Loading…
Cancel
Save