Go to the documentation of this file.00001
00010 #ifndef SENSOR_DATA
00011 #define SENSOR_DATA
00012 #include <global.h>
00013 #include <tf/tf.h>
00014
00015
00016
00017 class SensorData{
00018
00019 private:
00020 static const unsigned char GPS_FIX = 0x04;
00021 float accX, accY, accZ;
00022 float acc_error;
00023 float gyrX, gyrY, gyrZ;
00024 float gyr_error;
00025 float magX, magY, magZ;
00026 float mTemperature, mPressure;
00027 float q0, q1, q2, q3;
00028 float eroll, epitch, eyaw;
00029 float roll_error, pitch_error, yaw_error;
00030 float acc_noise, gyr_noise;
00031 unsigned int ts;
00032 tf::Quaternion q_orientation;
00033
00034
00035 float m_hdop, m_vdop, m_gdop, m_pdop, m_tdop, m_ndop, m_edop, m_itow;
00036 float mPositionAccuracy, mSpeedAccuracy;
00037 int mSatelliteNumber, mGpsFixStatus;
00038
00039 float mAltitude, mLongitude, mLatitude;
00040 float mVelocityNorth, mVelocityEast, mVelocityDown;
00041 float mVelocityX, mVelocityY, mVelocityZ;
00042 float gpsVelocityX, gpsVelocityY, gpsVelocityZ;
00043 unsigned char mStatus;
00044 uint32_t mHorizontalAccuracy, mVerticalAccuracy;
00045 std::string frameId_string;
00046
00047 public:
00048
00049
00050 float hdop(){ return m_hdop;}
00051 float vdop(){ return m_vdop;}
00052 float gdop(){ return m_gdop;}
00053 float pdop(){ return m_pdop;}
00054 float tdop(){ return m_tdop;}
00055 float ndop(){ return m_ndop;}
00056 float edop(){ return m_edop;}
00057 float itow(){ return m_itow;}
00058
00059
00060 float accError() {return acc_error;}
00061 float gyrError() {return gyr_error;}
00062 float rollError() {return roll_error;}
00063 float pitchError() {return pitch_error;}
00064 float yawError() {return yaw_error;}
00065 float to_rad_sqr(float x){return (x*x*PI*PI/(180*180));}
00066
00067
00068 float calculateAccErrorSquared(float noise_density, float freq);
00069 float calculateGyrErrorSquared(float noise_density, float freq);
00070
00071 void getOrientationQuaternion(tf::Quaternion * q){
00072 *q = tf::Quaternion(q1, q2, q3, q0);
00073 }
00074
00075 float PositionAccuracy() { return mPositionAccuracy; }
00076 float SpeedAccuracy() { return mSpeedAccuracy; }
00077
00078 int SatelliteNumber() { return mSatelliteNumber; }
00079 int GpsFixStatus() { return mGpsFixStatus;}
00080
00081 float accelerometer_x() { return accX; }
00082 float accelerometer_y() { return accY; }
00083 float accelerometer_z() { return accZ; }
00084
00085 float gyroscope_x() { return gyrX; }
00086 float gyroscope_y() { return gyrY; }
00087 float gyroscope_z() { return gyrZ; }
00088
00089 float magnetic_x() { return magX; }
00090 float magnetic_y() { return magY; }
00091 float magnetic_z() { return magZ; }
00092
00093 float temperature() { return mTemperature; }
00094 float pressure() { return mPressure; }
00095
00096 float quaternion_x() { return q1; }
00097 float quaternion_y() { return q2; }
00098 float quaternion_z() { return q3; }
00099 float quaternion_w() { return q0; }
00100
00101 float roll() { return eroll; }
00102 float pitch() { return epitch; }
00103 float yaw() { return eyaw; }
00104
00105 float altitude() { return mAltitude; }
00106 float longitude() { return mLongitude; }
00107 float latitude() { return mLatitude; }
00108
00109
00110 float velocity_x() { return mVelocityX; }
00111 float velocity_y() { return mVelocityY; }
00112 float velocity_z() { return mVelocityZ; }
00113
00114
00115 float gps_velocity_x() { return gpsVelocityX; }
00116 float gps_velocity_y() { return gpsVelocityY; }
00117 float gps_velocity_z() { return gpsVelocityZ; }
00118
00119 float velocityNorth() { return mVelocityNorth; }
00120 float velocityEast() { return mVelocityEast; }
00121 float velocityDown() { return mVelocityDown; }
00122
00123 bool GPSFix() { return mGpsFixStatus; }
00124
00125 uint32_t horizontalAccuracy() { return mHorizontalAccuracy; }
00126 uint32_t verticalAccuracy() { return mVerticalAccuracy; }
00127
00128 std::string frameId() { return frameId_string; }
00129
00130 SensorData(outputSettings &mSettings);
00131 SensorData();
00132
00133 void fillData(XsDataPacket *);
00134
00135 };
00136
00137 #endif