uci-uav-forge / uavf_2024

Flight software for Student Unmanned Aerial Systems 2024 competition
MIT License
4 stars 0 forks source link

Obstacle Detection/Avoidance #171

Open MinhxNguyen7 opened 7 months ago

MinhxNguyen7 commented 7 months ago

Description

We will develop and design logic for obstacle avoidance to be integrated with the current code base in GNC's commander node. Specifically within the commander node's execute waypoints function in the while loop on line 197. This loop is true while the mission isnt complete. We can use it to iteratively check if avoidance is nessecary.

https://github.com/uci-uav-forge/uavf_2024/blob/91407356cdef50d920176aaa87c106782d2b025e/uavf_2024/gnc/commander_node.py#L135-L198

Design

Integration

The approach taken will be to identify whether or not avoidance is needed via a vision system and drone ID. This will be quantified in seconds till collision. We will calculate this metric based on estimated positions of detected targets by using a Kalman Filter to forward future object state predictions. As of now the Unscented Kalman Filter is the decided approach from @EricPedley.

We can return s = -1 if there are no targets in-sight but for all non negative values of s we can decide a threshold to trigger obstacle avoidance. In general terms, if we are less than s seconds from collision trigger avoidance logic.

The obstacle avoidance will be implemented in a custom flight mode that the commander node can switch into (MISSION ---> AVOIDANCE ---> MISSION) inbetween the mission. More information about that interface is documented here

Important caveats about the obstacle avoidance approach

When the vehicle switches to avoidance mode there will be a manuver calculated to avoid the object based on the state of our vehicle when we initalized avoidance mode and the predictions. The calculated manuver trajectory is fixed and does not update based on new information, we are going under the assumption we have decent forward predictions of the object's movement.

Avoidance mode sends a series of waypoints and is "Completed" once it reaches the final waypoint. Our navigation logic will wait for avoidance mode to complete before continuing the execute waypoint function.

the calculated path will not dynamically update every second, its calcualted only once per avoidance mode trigger @EricPedley

Architecture

image

Development

waiting for us to finalize this methodology before we assign specific tasks, open to modifications / improvements @EricPedley @MinhxNguyen7

Tasks

Localize other drones via DRONEID and VISION in ENU frame

Prediction

Risk assessment

sketch of intersection scenerio example drawio

Obstacle Avoidance

https://gitlab.com/vince-cs/graph-of-convex-sets-ros2-quadrotor-avoidance/-/tree/main/AvoidanceMode?ref_type=heads

trajectory planning solver used

Issues

MinhxNguyen7 commented 7 months ago

@EricPedley @Vince-C156 Can you guys add what we need to do and, optionally, who's doing it, so we all get an idea of what lays ahead?

MinhxNguyen7 commented 6 months ago

Predictor gives a list of 3-tuples of matrix A, vector b, and time t, where the constraint is Ax < b, where x is our drone's equation, and t is the minimum time to intersecting the no-go zone.

Fly up if time is less than a certain threshold, we try to fly straight up. Otherwise, attempt our collision avoidance algorithm.

@Vince-C156 @EricPedley

Vince-C156 commented 6 months ago

good stuff, working on a continuous time obstacle avoidance trajectory planner so the solver doesn't phase through the constraint