Skip to content

Commit

Permalink
Tools: added a test for serial over CAN
Browse files Browse the repository at this point in the history
download a log with mavproxy from a serial over CAN port which then
comes out as UDP
  • Loading branch information
tridge committed Nov 22, 2023
1 parent f30ac40 commit d23c633
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 0 deletions.
1 change: 1 addition & 0 deletions Tools/autotest/arducopter.py
Original file line number Diff line number Diff line change
Expand Up @@ -10672,6 +10672,7 @@ def tests2b(self): # this block currently around 9.5mins here
def testcan(self):
ret = ([
self.CANGPSCopterMission,
self.TestLogDownloadMAVProxyCAN,
])
return ret

Expand Down
32 changes: 32 additions & 0 deletions Tools/autotest/vehicle_test_suite.py
Original file line number Diff line number Diff line change
Expand Up @@ -4166,6 +4166,38 @@ def TestLogDownloadMAVProxyNetwork(self, upload_logs=False):
self.stop_mavproxy(mavproxy)
self.context_pop()

def TestLogDownloadMAVProxyCAN(self, upload_logs=False):
"""Download latest log over CAN serial port"""
self.context_push()
self.set_parameters({
"CAN_P1_DRIVER": 1,
"LOG_DISARMED": 1,
})
self.reboot_sitl()
self.set_parameters({
"CAN_D1_UC_SER_EN": 1,
"CAN_D1_UC_S1_NOD": 125,
"CAN_D1_UC_S1_IDX": 4,
"CAN_D1_UC_S1_BD": 57600,
"CAN_D1_UC_S1_PRO": 2,
})
self.reboot_sitl()
filename = "MAVProxy-downloaded-can-log.BIN"
# port 15550 is in SITL_Periph_State.h as SERIAL4 udpclient:127.0.0.1:15550
mavproxy = self.start_mavproxy(master=':15550')
mavproxy.expect("Detected vehicle")
self.mavproxy_load_module(mavproxy, 'log')
mavproxy.send("log list\n")
mavproxy.expect("numLogs")
self.wait_heartbeat()
self.wait_heartbeat()
mavproxy.send("set shownoise 0\n")
mavproxy.send("log download latest %s\n" % filename)
mavproxy.expect("Finished downloading", timeout=120)
self.mavproxy_unload_module(mavproxy, 'log')
self.stop_mavproxy(mavproxy)
self.context_pop()

def show_gps_and_sim_positions(self, on_off):
"""Allow to display gps and actual position on map."""
if on_off is True:
Expand Down

0 comments on commit d23c633

Please sign in to comment.