• Main Page
  • Namespaces
  • Classes
  • Files
  • File List
  • File Members

/home/jgoppert/Projects/ap/libraries/AP_ADC/AP_ADC_HIL.cpp

Go to the documentation of this file.
00001 #include "AP_ADC_HIL.h"
00002 #include "WProgram.h"
00003 
00004 /*
00005         AP_ADC_HIL.cpp
00006         Author: James Goppert
00007 
00008         License:
00009         This library is free software; you can redistribute it and/or
00010         modify it under the terms of the GNU Lesser General Public
00011         License as published by the Free Software Foundation; either
00012         version 2.1 of the License, or (at your option) any later version.
00013 */
00014 
00015 const uint8_t AP_ADC_HIL::sensors[6] = {1,2,0,4,5,6};           
00016 const int8_t AP_ADC_HIL::sensorSign[6]  = { 1, -1, -1,-1,  1,  1};
00017 const float AP_ADC_HIL::gyroBias[3]     = {1665,1665,1665};
00018 const float AP_ADC_HIL::accelBias[3]    = {2025,2025,2025};
00019 // gyroScale = 1/[GyroGain*pi/180]   GyroGains (0.4,0.41,0.41)
00020 const float AP_ADC_HIL::gyroScale[3] = {143.239, 139.746, 139.746}; 
00021 const float AP_ADC_HIL::accelScale[3] = {418,418,418}; // adcPerG
00022 
00023 AP_ADC_HIL::AP_ADC_HIL()
00024 {
00025         // gyros set to zero for calibration
00026         setGyro(0,0);
00027         setGyro(1,0);
00028         setGyro(2,0);
00029 
00030         // accels set to zero for calibration
00031         setAccel(0,0);
00032         setAccel(1,0);
00033         setAccel(2,0);
00034 
00035         // set diff press and temp to zero
00036         setGyroTemp(0);
00037         setPressure(0);
00038 }
00039 
00040 void AP_ADC_HIL::Init(void)
00041 {
00042 }
00043 
00044 // Read one channel value
00045 int AP_ADC_HIL::Ch(unsigned char ch_num)         
00046 {
00047   return adcValue[ch_num];
00048 }
00049 
00050 // Set one channel value
00051 int AP_ADC_HIL::setHIL(int16_t p, int16_t q, int16_t r, int16_t gyroTemp,
00052     int16_t aX, int16_t aY, int16_t aZ, int16_t diffPress)
00053 {
00054     // gyros
00055         setGyro(0,p);
00056         setGyro(1,q);
00057         setGyro(2,r);
00058 
00059         // temp
00060         setGyroTemp(gyroTemp);
00061 
00062         // accel
00063         setAccel(0,aX);
00064         setAccel(1,aY);
00065         setAccel(2,aZ);
00066 
00067     // differential pressure
00068         setPressure(diffPress);
00069 }

Generated for ArduPilot Libraries by doxygen