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

autotest: add test that tracker can use moving baseline yaw #26276

Merged
Merged
Show file tree
Hide file tree
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
25 changes: 25 additions & 0 deletions Tools/autotest/antennatracker.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,30 @@ def disabled_tests(self):
"CPUFailsafe": " tracker doesn't have a CPU failsafe",
}

def GPSForYaw(self):
'''Moving baseline GPS yaw'''
self.context_push()

self.load_default_params_file("tracker-gps-for-yaw.parm")
self.reboot_sitl()

self.wait_gps_fix_type_gte(6, message_type="GPS2_RAW", verbose=True)
tstart = self.get_sim_time()
while True:
if self.get_sim_time_cached() - tstart > 20:
break
m_gps_raw = self.assert_receive_message("GPS2_RAW", verbose=True)
m_sim = self.assert_receive_message("SIMSTATE", verbose=True)
gps_raw_hdg = m_gps_raw.yaw * 0.01
sim_hdg = mavextra.wrap_360(math.degrees(m_sim.yaw))
if abs(gps_raw_hdg - sim_hdg) > 5:
raise NotAchievedException("GPS_RAW not tracking simstate yaw")
self.progress(f"yaw match ({gps_raw_hdg} vs {sim_hdg}")

self.context_pop()

self.reboot_sitl()

def tests(self):
'''return list of all tests'''
ret = super(AutoTestTracker, self).tests()
Expand All @@ -186,5 +210,6 @@ def tests(self):
self.NMEAOutput,
self.SCAN,
self.BaseMessageSet,
self.GPSForYaw,
])
return ret
11 changes: 11 additions & 0 deletions Tools/autotest/default_params/tracker-gps-for-yaw.parm
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# SITL GPS-for-yaw using two simulated UBlox GPSs
EK3_SRC1_YAW 2
GPS_AUTO_CONFIG 0
GPS_TYPE 17
GPS_TYPE2 18
GPS_POS1_Y -0.2
GPS_POS2_Y 0.2
SIM_GPS_POS_Y -0.2
SIM_GPS2_POS_Y 0.2
SIM_GPS2_DISABLE 0
SIM_GPS2_HDG 1
Loading