Change float32 types to float64 types to match AHRS library outputs.

pull/624/head
Christopher Young 2017-06-05 16:19:45 -04:00
rodzic 215b6034d6
commit ca4ae22c42
3 zmienionych plików z 22 dodań i 22 usunięć

Wyświetl plik

@ -250,7 +250,7 @@ func degreesHdg(angle float64) float64 {
}
// roundToInt16 cheaply rounds a float64 to an int16, rather than truncating
func roundToInt16(in float32) (out int16) {
func roundToInt16(in float64) (out int16) {
if in >= 0 {
out = int16(in + 0.5)
} else {

Wyświetl plik

@ -87,15 +87,15 @@ type SituationData struct {
// From AHRS source.
muAttitude *sync.Mutex
AHRSPitch float32
AHRSRoll float32
AHRSGyroHeading float32
AHRSMagHeading float32
AHRSSlipSkid float32
AHRSTurnRate float32
AHRSGLoad float32
AHRSGLoadMin float32
AHRSGLoadMax float32
AHRSPitch float64
AHRSRoll float64
AHRSGyroHeading float64
AHRSMagHeading float64
AHRSSlipSkid float64
AHRSTurnRate float64
AHRSGLoad float64
AHRSGLoadMin float64
AHRSGLoadMax float64
AHRSLastAttitudeTime time.Time
AHRSStatus uint8
}
@ -1874,7 +1874,7 @@ func makeAHRSGDL90Report() {
}
if isTempPressValid() {
palt = uint16(mySituation.BaroPressureAltitude + 5000.5)
vs = roundToInt16(mySituation.BaroVerticalSpeed)
vs = roundToInt16(float64(mySituation.BaroVerticalSpeed))
}
// Roll.
@ -1936,9 +1936,9 @@ func gpsAttitudeSender() {
mySituation.muGPSPerformance.Lock()
index := len(myGPSPerfStats) - 1
if index > 1 {
mySituation.AHRSPitch = float32(myGPSPerfStats[index].gpsPitch)
mySituation.AHRSRoll = float32(myGPSPerfStats[index].gpsRoll)
mySituation.AHRSGyroHeading = mySituation.GPSTrueCourse
mySituation.AHRSPitch = myGPSPerfStats[index].gpsPitch
mySituation.AHRSRoll = myGPSPerfStats[index].gpsRoll
mySituation.AHRSGyroHeading = float64(mySituation.GPSTrueCourse)
mySituation.AHRSLastAttitudeTime = stratuxClock.Time
makeAHRSGDL90Report()

Wyświetl plik

@ -278,15 +278,15 @@ func sensorAttitudeSender() {
mySituation.muAttitude.Lock()
if s.Valid() {
roll, pitch, heading = s.RollPitchHeading()
mySituation.AHRSRoll = float32(roll / ahrs.Deg)
mySituation.AHRSPitch = float32(pitch / ahrs.Deg)
mySituation.AHRSGyroHeading = float32(heading / ahrs.Deg)
mySituation.AHRSRoll = roll / ahrs.Deg
mySituation.AHRSPitch = pitch / ahrs.Deg
mySituation.AHRSGyroHeading = heading / ahrs.Deg
// TODO westphae: until magnetometer calibration is performed, no mag heading
mySituation.AHRSMagHeading = ahrs.Invalid
mySituation.AHRSSlipSkid = float32(s.SlipSkid())
mySituation.AHRSTurnRate = float32(s.RateOfTurn())
mySituation.AHRSGLoad = float32(s.GLoad())
mySituation.AHRSSlipSkid = s.SlipSkid()
mySituation.AHRSTurnRate = s.RateOfTurn()
mySituation.AHRSGLoad = s.GLoad()
if mySituation.AHRSGLoad < mySituation.AHRSGLoadMin || mySituation.AHRSGLoadMin == 0 {
mySituation.AHRSGLoadMin = mySituation.AHRSGLoad
}
@ -462,6 +462,6 @@ func updateAHRSStatus() {
}
}
func isAHRSInvalidValue(val float32) bool {
return math.Abs(float64(val)-float64(ahrs.Invalid)) < 0.01
func isAHRSInvalidValue(val float64) bool {
return math.Abs(val-ahrs.Invalid) < 0.01
}