Speed option for AHRS replay.

pull/96/head
Christopher Young 2015-10-19 13:08:27 -04:00
rodzic fbcfddc006
commit 663fe90ae8
1 zmienionych plików z 10 dodań i 4 usunięć

Wyświetl plik

@ -342,8 +342,8 @@ func heartBeatSender() {
func main() {
crcInit()
if len(os.Args) < 4 {
fmt.Printf("%s <start second> <ahrs file> <gps file>\n", os.Args[0])
if len(os.Args) < 5 {
fmt.Printf("%s <start second> <ahrs file> <gps file> <replay speed>\n", os.Args[0])
return
}
startsec, err := strconv.Atoi(os.Args[1])
@ -352,6 +352,12 @@ func main() {
return
}
replayspeed, err := strconv.Atoi(os.Args[4])
if err != nil {
fmt.Printf("invalid: %s\n", os.Args[4])
return
}
startnsec := int64(startsec) * 1000000000
ahrsfp, ahrsIdx, err := seekTimestampInAHRS(os.Args[2], startnsec, 1000000000) // Find the index with 1.00s tolerance.
@ -414,9 +420,9 @@ func main() {
fmt.Printf("%f %f\n", pitch, roll)
s := fmt.Sprintf("XATTStratux,%f,%f,%f", gps.Course, pitch, roll)
outConn.Write([]byte(s))
time.Sleep(time.Duration(ahrs.Timestamp - lastTs))
time.Sleep(time.Duration((ahrs.Timestamp - lastTs)/int64(replayspeed)))
lastTs = ahrs.Timestamp
// Now we're working with synced samples.
}
}
}