Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gpslag: cope with GPS instances #763

Merged
merged 1 commit into from
Dec 28, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions tools/mavgpslag.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
parser = ArgumentParser(description=__doc__)
parser.add_argument("--plot", action='store_true', default=False, help="plot errors")
parser.add_argument("--minspeed", type=float, default=6, help="minimum speed")
parser.add_argument("--gps", default='', help="GPS number")
parser.add_argument("--gps", type=int, default=0, help="GPS number")
parser.add_argument("logs", metavar="LOG", nargs="+")

args = parser.parse_args()
Expand Down Expand Up @@ -83,20 +83,26 @@ def gps_lag(logfile):
dtcount = 0

while True:
m = mlog.recv_match(type=['GPS'+args.gps,'IMU','ATT','GPA'+args.gps])
m = mlog.recv_match(type=['GPS','IMU','ATT','GPA'])
if m is None:
break
t = m.get_type()
if t.startswith('GPS') and m.Status >= 3 and m.Spd>args.minspeed:
if m.I != args.gps:
continue
GPS = m;
elif t.startswith('GPA') and GPS is not None and GPS.TimeUS == m.TimeUS:
if m.I != args.gps:
continue
v = Vector3(GPS.Spd*cos(radians(GPS.GCrs)), GPS.Spd*sin(radians(GPS.GCrs)), GPS.VZ)
vel.append(v)
timestamps.append(m.SMS*0.001)
accel_indexes.append(max(len(gaccel)-1,0))
elif t == 'ATT':
ATT = m
elif t == 'IMU':
if m.I != 0:
continue
if ATT is not None:
ga = earth_accel_df(m, ATT)
ga.z += 9.80665
Expand Down