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

get_entries() gets stuck #662

Closed
M4ster00gway opened this issue Mar 5, 2024 · 8 comments
Closed

get_entries() gets stuck #662

M4ster00gway opened this issue Mar 5, 2024 · 8 comments

Comments

@M4ster00gway
Copy link

M4ster00gway commented Mar 5, 2024

When attempting to download logs after conducting multiple, relatively long flights, I am encountering a problem where the get_entries() function becomes unresponsive. It neither returns any log entries nor generates any errors. I have tried using MAVSDK versions 2.1.0 and 1.4.9 and i use the PX4 autopilot system.

async def download_log_file(drone, entry):
    date_without_colon = entry.date.replace(":", "-")
    filename = f"./log-{date_without_colon}.ulog"
    print(f"Downloading: log {entry.id} from {entry.date} to {filename}")
    previous_progress = -1
    async for progress in drone.log_files.download_log_file(entry, filename):
        new_progress = round(progress.progress * 100)
        if new_progress != previous_progress:
            sys.stdout.write(f"\r{new_progress} %")
            sys.stdout.flush()
            previous_progress = new_progress
    print("\nDownload completed.")

async def download_all_logs(drone):
    entries = await drone.log_files.get_entries()
    if not entries:
        print("No log entries found.")
        return

    download_tasks = [download_log_file(drone, entry) for entry in entries]
    await asyncio.gather(*download_tasks)
    ```
    print(f"Downloading: log {entry.id} from {entry.date} to {filename}")
    previous_progress = -1
    async for progress in drone.log_files.download_log_file(entry, filename):
        new_progress = round(progress.progress * 100)
        if new_progress != previous_progress:
            sys.stdout.write(f"\r{new_progress} %")
            sys.stdout.flush()
            previous_progress = new_progress
    print("\nDownload completed.")

async def download_all_logs(drone):
    entries = await drone.log_files.get_entries()
    if not entries:
        print("No log entries found.")
        return

    download_tasks = [download_log_file(drone, entry) for entry in entries]
    await asyncio.gather(*download_tasks)

This is where it gets stuck:

entries = await drone.log_files.get_entries()

Any ideas on how to solve this?

@julianoes
Copy link
Collaborator

Thanks for the issue. Does it work in QGC?

@M4ster00gway
Copy link
Author

M4ster00gway commented Mar 6, 2024

Yes i can see the logs in QGC when i use high-latency on comm links and connect via TCP. When i dont use the high-latency option i cant connect.

Could it be related to this: mavlink/MAVSDK#2234 ?

@julianoes
Copy link
Collaborator

@M4ster00gway could yes. Worth trying again. We just need to push a mavsdk-python update.

@julianoes
Copy link
Collaborator

#664

@julianoes
Copy link
Collaborator

@M4ster00gway
Copy link
Author

M4ster00gway commented Mar 14, 2024

Thanks and sorry for the late reply! @julianoes

Getting the entries works better now, however after retrieving the entries, mavsdk throws this error:

terminate called after throwing an instance of 'std::future_error'
  what():  std::future_error: Promise already satisfied

Which causes the mavsdk server to crash so i cant proceed to run download_log_file.

@julianoes
Copy link
Collaborator

Any chance you can get a backtrace using gdb?

@julianoes
Copy link
Collaborator

I'm assuming this has been fixed. If it still exists, let me know.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants