Jaeyoung-Lim / mavros_controllers

Aggressive trajectory tracking using mavros for PX4 enabled vehicles
BSD 3-Clause "New" or "Revised" License
398 stars 164 forks source link

Obstacle avoidance Model Predictive Control #209

Closed brunopinto900 closed 2 years ago

brunopinto900 commented 2 years ago

Hello,

I am integrating https://github.com/llanesc/lqr-tracking into this package. I can leverage that to implement a Model Predictive Controller. The goal is to use the MPC as an obstacle avoidance local planner, rather than just a plain controller. However this gets out the scope of this package. Can you give me advice/suggestions on how to approach this?

Thank you.

Jaeyoung-Lim commented 2 years ago

@brunopinto900 Not sure if I understand this correctly.

The state dependent LQR is not a predictive controller. How would this be related to a Model Predictive Controller?

However this gets out the scope of this package

I am not aware of what the scope of this package should be :smile: Could you elaborate?

brunopinto900 commented 2 years ago

@Jaeyoung-Lim the idea is to convert the state dependent LQR into a model predictive controller. So two new controllers: LQR, Linear MPC.

The scope of this package so far is offboard control. I am proposing obsctacle avoidance for offboard.

Jaeyoung-Lim commented 2 years ago

@brunopinto900 I would not try to jump on architectures until we have something working. We can always rip the components out into a separate repo if there is a need for it.

On obstacle avoidance, I am still unsure if these topics are related. A Linear MPC still sounds to me like a controller and not necessarily something that can be used for obstacle avoidance.

brunopinto900 commented 2 years ago

Agreed. First we get the LQR working.

A linear MPC can be used for obstacle avoidance when hard constraints can be created by considering obstacles as polygons. Or, in non linear MPC, obstacle avoidance can be implemented by adding collision penalties in the cost function. So my overall goal is:

Create a global path avoiding obstacles using RRT with OMPL; Implement a spline (bezier or cartesian polynomial) minimizing jerk; The map can be octomap or an esdf; Give the final trajectory to a controller (this repo)

This is the base for obstacle avoidance. The goal would be to couple the controller with the spline trajectory generation with a non linear MPC.

I know how to do all of this, i've done on a Python simulator. Now i want to implement it on real life using PX4 as the flight controller. For that i found some repositories. The main problem is what packages to use and how to start the project.

Given this project , how would you approach this? I would love some advice on this.

My approach so far is: Code MPC on this repo; Then use either Fast Planner https://github.com/HKUST-Aerial-Robotics/Fast-Planner Or voxblox planner

Jaeyoung-Lim commented 2 years ago

@brunopinto900 Any updates regarding the LQR?

brunopinto900 commented 2 years ago

@Jaeyoung-Lim Already coded everything. Compiles and the logic is correct, however the SITL says on the terminal that the battery is below the limit haha. I was working on the PX4 Obstacle Avoidance.

Jaeyoung-Lim commented 2 years ago

@brunopinto900 Thanks for the update! Could you make a PR? I can probably move it forward on top of what you did

brunopinto900 commented 2 years ago

@Jaeyoung-Lim Yes. Will do it in the next minutes.

Jaeyoung-Lim commented 2 years ago

PR: https://github.com/Jaeyoung-Lim/mavros_controllers/pull/210