ekwilinski / Framework

Framework to interface the High Level Control Algorithm (HLCA) with the physical drone via MavLink.
1 stars 0 forks source link

When a land() is called, it blocks execution of other commands in the queue. #2

Closed justincdavis closed 2 years ago

justincdavis commented 2 years ago

The intended behavior is that a new command can be processed every so often based on the given time_slice. However, when there is a mavsdk call which does not return until completed (such as land) it blocks execution of all calls.

A possible solution could be running actions using lower level asyncio calls, such as create_task (or another that only runs the call once and then exits), which would allow us to store these calls in memory as tasks which we can stop execution of. I could see this working by storing the most recent movement action in memory, and not storing other actions which do not impact movement directly. This would allow movement actions to get updated more dynamically.

justincdavis commented 2 years ago

Could benefit from having a movement vs. other mavlink command thread.

justincdavis commented 2 years ago

According to the documentation for Action in C++, it is up to the user to ensure that a takeoff/land action has completed and not to send additional commands in that time. In this scenario, it is correct that our call to land blocks until completion.

https://mavsdk.mavlink.io/main/en/cpp/guide/taking_off_landing.html

justincdavis commented 2 years ago

Land actions can be preempted through another call since the asynchronous execution has switched to ensure_future which is a non-blocking operation