kopia lustrzana https://github.com/cyoung/stratux
Change calcGPSValidity() to isGPSGroundTrackValid(). Replace existing isGPSGroundTrackValid() function.
rodzic
9839e88e71
commit
c0a79700b8
18
main/gps.go
18
main/gps.go
|
@ -1855,19 +1855,19 @@ func makeAHRSGDL90Report() {
|
||||||
// AHRS code uses 36727/10 for an invalid value.
|
// AHRS code uses 36727/10 for an invalid value.
|
||||||
if mySituation.AHRSPitch < 360 {
|
if mySituation.AHRSPitch < 360 {
|
||||||
pitch = roundToInt16(mySituation.AHRSPitch * 10)
|
pitch = roundToInt16(mySituation.AHRSPitch * 10)
|
||||||
}
|
}
|
||||||
if mySituation.AHRSRoll < 360 {
|
if mySituation.AHRSRoll < 360 {
|
||||||
roll = roundToInt16(mySituation.AHRSRoll * 10)
|
roll = roundToInt16(mySituation.AHRSRoll * 10)
|
||||||
}
|
}
|
||||||
if mySituation.AHRSGyroHeading < 360 {
|
if mySituation.AHRSGyroHeading < 360 {
|
||||||
hdg = roundToInt16(mySituation.AHRSGyroHeading * 10) // TODO westphae: switch to AHRSMagHeading?
|
hdg = roundToInt16(mySituation.AHRSGyroHeading * 10) // TODO westphae: switch to AHRSMagHeading?
|
||||||
}
|
}
|
||||||
if mySituation.AHRSSlipSkid < 360 {
|
if mySituation.AHRSSlipSkid < 360 {
|
||||||
slip_skid = roundToInt16(-mySituation.AHRSSlipSkid * 10)
|
slip_skid = roundToInt16(-mySituation.AHRSSlipSkid * 10)
|
||||||
}
|
}
|
||||||
if mySituation.AHRSTurnRate < 360 {
|
if mySituation.AHRSTurnRate < 360 {
|
||||||
yaw_rate = roundToInt16(mySituation.AHRSTurnRate * 10)
|
yaw_rate = roundToInt16(mySituation.AHRSTurnRate * 10)
|
||||||
}
|
}
|
||||||
if mySituation.AHRSTurnRate < 360 {
|
if mySituation.AHRSTurnRate < 360 {
|
||||||
g = roundToInt16(mySituation.AHRSGLoad * 10)
|
g = roundToInt16(mySituation.AHRSGLoad * 10)
|
||||||
}
|
}
|
||||||
|
@ -1994,7 +1994,7 @@ If false, 'GPSFixQuality` is set to 0 ("No fix"), as is the number of satellites
|
||||||
|
|
||||||
func isGPSValid() bool {
|
func isGPSValid() bool {
|
||||||
isValid := false
|
isValid := false
|
||||||
if (stratuxClock.Since(mySituation.GPSLastFixLocalTime) < 15*time.Second) && globalStatus.GPS_connected && mySituation.GPSFixQuality > 0 {
|
if (stratuxClock.Since(mySituation.GPSLastFixLocalTime) < 3*time.Second) && globalStatus.GPS_connected && mySituation.GPSFixQuality > 0 {
|
||||||
isValid = true
|
isValid = true
|
||||||
} else {
|
} else {
|
||||||
mySituation.GPSFixQuality = 0
|
mySituation.GPSFixQuality = 0
|
||||||
|
@ -2006,8 +2006,14 @@ func isGPSValid() bool {
|
||||||
return isValid
|
return isValid
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
isGPSGroundTrackValid returns true only if a valid ground track was obtained in the last 3 seconds,
|
||||||
|
and if NACp >= 9.
|
||||||
|
*/
|
||||||
|
|
||||||
func isGPSGroundTrackValid() bool {
|
func isGPSGroundTrackValid() bool {
|
||||||
return stratuxClock.Since(mySituation.GPSLastGroundTrackTime) < 15*time.Second
|
return isGPSValid() &&
|
||||||
|
(mySituation.GPSHorizontalAccuracy >= 30)
|
||||||
}
|
}
|
||||||
|
|
||||||
func isGPSClockValid() bool {
|
func isGPSClockValid() bool {
|
||||||
|
|
|
@ -236,7 +236,7 @@ func sensorAttitudeSender() {
|
||||||
}
|
}
|
||||||
|
|
||||||
m.TW = float64(mySituation.GPSLastGroundTrackTime.UnixNano()/1000) / 1e6
|
m.TW = float64(mySituation.GPSLastGroundTrackTime.UnixNano()/1000) / 1e6
|
||||||
m.WValid = calcGPSValidity()
|
m.WValid = isGPSGroundTrackValid()
|
||||||
if m.WValid {
|
if m.WValid {
|
||||||
m.W1 = mySituation.GPSGroundSpeed * math.Sin(float64(mySituation.GPSTrueCourse)*ahrs.Deg)
|
m.W1 = mySituation.GPSGroundSpeed * math.Sin(float64(mySituation.GPSTrueCourse)*ahrs.Deg)
|
||||||
m.W2 = mySituation.GPSGroundSpeed * math.Cos(float64(mySituation.GPSTrueCourse)*ahrs.Deg)
|
m.W2 = mySituation.GPSGroundSpeed * math.Cos(float64(mySituation.GPSTrueCourse)*ahrs.Deg)
|
||||||
|
@ -329,11 +329,6 @@ func updateExtraLogging() {
|
||||||
logMap["BaroVerticalSpeed"] = float64(mySituation.BaroVerticalSpeed)
|
logMap["BaroVerticalSpeed"] = float64(mySituation.BaroVerticalSpeed)
|
||||||
}
|
}
|
||||||
|
|
||||||
func calcGPSValidity() bool {
|
|
||||||
return (stratuxClock.Time.Sub(mySituation.GPSLastGroundTrackTime) < 3000*time.Millisecond) &&
|
|
||||||
(mySituation.GPSNACp >= 9)
|
|
||||||
}
|
|
||||||
|
|
||||||
func makeSensorRotationMatrix(g [3]float64) (rotmat *[3][3]float64) {
|
func makeSensorRotationMatrix(g [3]float64) (rotmat *[3][3]float64) {
|
||||||
f := globalSettings.IMUMapping
|
f := globalSettings.IMUMapping
|
||||||
if globalSettings.IMUMapping[0] == 0 { // if unset, default to some standard orientation
|
if globalSettings.IMUMapping[0] == 0 { // if unset, default to some standard orientation
|
||||||
|
@ -419,8 +414,8 @@ func updateAHRSStatus() {
|
||||||
<-ticker.C
|
<-ticker.C
|
||||||
msg = 0
|
msg = 0
|
||||||
|
|
||||||
// GPS valid
|
// GPS ground track valid?
|
||||||
if calcGPSValidity() {
|
if isGPSGroundTrackValid() {
|
||||||
msg++
|
msg++
|
||||||
}
|
}
|
||||||
// IMU is being used
|
// IMU is being used
|
||||||
|
|
Ładowanie…
Reference in New Issue