long double telemetryDataPoint::units(long double value, int init, int fin){ if (init==unitIndex("kts") && fin==unitIndex("m/s")) return value/0.514; if (init==unitIndex("milli-seconds") && fin==unitIndex("seconds")) return value/1000.; if (init==unitIndex("m") && fin==unitIndex("non-dim")) return value/3.; // take typical commercial GPS accuracy as 3m - good enough guess in 2012 if (init==unitIndex("micro Tesla") && fin==unitIndex("Tesla")) return value/1000000.; return value; }
void SpikeCounter:: AddSpike( int channel, int unit) { int unit_index = unitIndex( channel, unit); _count[unit_index]++; }
int telemetryDataPoint::fieldUnit(int field){ if (field==fieldIndex("Time")) return unitIndex("seconds"); if (field==fieldIndex("Frequency")) return unitIndex("Hz"); if (field==fieldIndex("Acceleration (X)")) return unitIndex("m/s^2"); if (field==fieldIndex("Acceleration (Y)")) return unitIndex("m/s^2"); if (field==fieldIndex("Acceleration (Z)")) return unitIndex("m/s^2"); if (field==fieldIndex("Gyroscope (X)")) return unitIndex("deg/sec"); if (field==fieldIndex("Gyroscope (Y)")) return unitIndex("deg/sec"); if (field==fieldIndex("Gyroscope (Z)")) return unitIndex("deg/sec"); if (field==fieldIndex("Magnetometer (X)")) return unitIndex("Tesla"); if (field==fieldIndex("Magnetometer (Y)")) return unitIndex("Tesla"); if (field==fieldIndex("Magnetometer (Z)")) return unitIndex("Tesla"); if (field==fieldIndex("Roll")) return unitIndex("deg"); if (field==fieldIndex("Pitch")) return unitIndex("deg"); if (field==fieldIndex("Yaw")) return unitIndex("deg"); if (field==fieldIndex("Latitude")) return unitIndex("deg"); if (field==fieldIndex("Longitude")) return unitIndex("deg"); if (field==fieldIndex("Altitude")) return unitIndex("m"); if (field==fieldIndex("x")) return unitIndex("m"); if (field==fieldIndex("y")) return unitIndex("m"); if (field==fieldIndex("z")) return unitIndex("m"); if (field==fieldIndex("Track")) return unitIndex("deg"); if (field==fieldIndex("Speed")) return unitIndex("m/s"); if (field==fieldIndex("hDOP")) return unitIndex("non-dim"); if (field==fieldIndex("vDOP")) return unitIndex("non-dim"); if (field==fieldIndex("mDOP")) return unitIndex("non-dim"); if (field==fieldIndex("Temperature")) return unitIndex("Celcius"); if (field==fieldIndex("Voltage")) return unitIndex("Volts"); return 0; }