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

[WIP] lqr controller #19079

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft

Conversation

mkolodziejczyk-piap
Copy link

There's always been interest in PX4 community in implementing model-based controllers like LQR, but none of the efforts transformed into actual PR. This PR aims to introduce simple LQR controller for multicopters as an alternative to current PID controllers. There's no intention to replace current PID stack, rather create a reference implementation or an option for researchers. This is most basic LQR version and further enhancement will probably require at least some exteranal lib like Eigen or even a QP solver lib.

@@ -0,0 +1,315 @@
/****************************************************************************
*
* Copyright (c) 2018 - 2019 PX4 Development Team. All rights reserved.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* Copyright (c) 2018 - 2019 PX4 Development Team. All rights reserved.
* Copyright (c) 2022 PX4 Development Team. All rights reserved.

############################################################################

px4_add_library(Takeoff
Takeoff.cpp
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this a direct copy of the existing takeoff helper? If so we can move it under lib and rename to mc_takeoff or something.

add_subdirectory(Takeoff)

px4_add_module(
MODULE modules__mc_lqr_control
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe include something in the name to indicate it's a position controller?

@dagar
Copy link
Member

dagar commented Jan 27, 2022

Can you add this to a board and we'll add a parameter to select which modules start at runtime?

@dagar
Copy link
Member

dagar commented Jan 27, 2022

This is most basic LQR version and further enhancement will probably require at least some exteranal lib like Eigen or even a QP solver lib.

I'd be up for trying to properly bring in Eigen if you're interested. I think we're now in a much better position to address c++ dependency issues in NuttX.

@potaito
Copy link
Contributor

potaito commented Jan 28, 2022

@mkolodziejczyk-piap cool! Could you add more details to your PR description like what the cost function is?

@mkolodziejczyk-piap
Copy link
Author

Sorry, this is a bit rough right now. I'll provide more details today and fill missing parts

@mkolodziejczyk-piap mkolodziejczyk-piap changed the title lqr controller [WIP] lqr controller Jan 28, 2022
@potaito
Copy link
Contributor

potaito commented Jan 28, 2022

No need to rush 😄

@mengchaoheng
Copy link

I'd be up for trying to properly bring in Eigen if you're interested.

Is there any plan for this?

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

Successfully merging this pull request may close these issues.

4 participants