MAVSDK-Python: download_log_file() not working

Hi,

I want to download log files in my px4, and I can see from 0 to 465 log files in QGroundControl.

#!/usr/bin/env python3

import asyncio
from mavsdk import System
from mavsdk.action import OrbitYawBehavior
from mavsdk.log_files import Entry
from mavsdk.log_files import LogFiles

async def run():
    drone = System()
    await drone.connect(system_address="udp://:14540")
    
    print("Waiting for drone to connect...")
    async for state in drone.core.connection_state():
        if state.is_connected:
            print(f"Drone discovered with UUID: {state.uuid}")
            break

    print("Waiting for drone to have a global position estimate...")
    async for health in drone.telemetry.health():
        if health.is_global_position_ok:
            print("Global position estimate ok")
            break

    print("Fetching amsl altitude at home location....")
    async for terrain_info in drone.telemetry.home():
        absolute_altitude = terrain_info.absolute_altitude_m
        break

    
    print("Log Download")
    drone.log_files.download_log_file(412, "C:\\Users\\user\\Desktop\\Logs\\")
    print("Done")
  

if __name__ == "__main__":
    loop = asyncio.get_event_loop()
    loop.run_until_complete(run())

I use this code to get No. 412 log file, but It nothing happened.

Is there any way I can get log file from px4?

No error occurs and i can see both “Log Download” and “Done” text…

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 15

Most upvoted comments

I have speed problem, but I can download it. Thanks for your help!!