[wls] make WLS lib, add support for guidance_indi_hybrid (#3115)

* [wls] make WLS lib, add support for guidance_indi_hybrid

* [wls] update test program

* [wls] restore static matrix size for WLS

* [wls] update test prog

* [indi] ABI thrust message to 3D vector (#3116)

* [indi] ABI thrust message to 3D vector

Common WLS for innerloop and outerloop

Co-authored-by: Christophe De Wagter <dewagter@gmail.com>

* Bound defaults to min in case of NaN

---------

Co-authored-by: Christophe De Wagter <dewagter@gmail.com>

* [guidance_indi] lift effectiveness and set stabilization limits in WEAK (#3117)

* do not allow code to run with insufficient matrix sizes

* Prefer not to roll when able.

* [wls] only check size if WLS is used

---------

Co-authored-by: Christophe De Wagter <dewagter@gmail.com>
Co-authored-by: Ewoud Smeur <e.j.j.smeur@tudelft.nl>
This commit is contained in:
Gautier Hattenberger
2023-10-01 23:15:36 +02:00
committed by GitHub
parent 59fac571a6
commit 01ac335eb7
16 changed files with 244 additions and 89 deletions
+9 -3
View File
@@ -5,6 +5,11 @@
<description>
Guidance controller for hybrids using INDI
</description>
<section name="GUIDANCE_INDI_HYBRID" prefix="GUIDANCE_INDI_HYBRID_">
<define name="USE_WLS" value="FALSE|TRUE" description="use WLS allocation instead of matrix inversion (default: FALSE)"/>
<define name="WLS_PRIORITIES" value="{100., 100., 1.}" description="WLS priorities on control objectives"/>
<define name="WLS_WU" value="{1., 1., 1.}" description="WLS weighting on outputs"/>
</section>
</doc>
<settings>
<dl_settings>
@@ -17,14 +22,15 @@
<dl_setting var="gih_params.speed_gain" min="0" step="0.1" max="10.0" shortname="kd" param="GUIDANCE_INDI_SPEED_GAIN" persistent="true"/>
<dl_setting var="gih_params.speed_gainz" min="0" step="0.1" max="10.0" shortname="kd_z" param="GUIDANCE_INDI_SPEED_GAINZ" persistent="true"/>
<dl_setting var="gih_params.heading_bank_gain" min="0" step="0.1" max="30.0" shortname="bank gain" param="GUIDANCE_INDI_HEADING_BANK_GAIN" persistent="true"/>
<dl_setting var="guidance_indi_max_airspeed" min="12.0" step="1.0" max="30.0" shortname="cruise_airspeed"/>
<dl_setting var="guidance_indi_max_bank" min="10.0" step="1.0" max="50.0" shortname="max_bank"/>
<dl_setting var="guidance_indi_max_airspeed" min="12.0" step="1.0" max="30.0" shortname="cruise_airspeed" param="GUIDANCE_INDI_MAX_AIRSPEED"/>
<dl_setting var="guidance_indi_max_bank" min="10.0" step="1.0" max="50.0" shortname="max_bank" param="GUIDANCE_H_MAX_BANK"/>
<dl_setting var="guidance_indi_min_pitch" min="-130.0" step="1.0" max="-30.0" shortname="min_pitch" param="GUIDANCE_INDI_MIN_PITCH"/>
<dl_setting var="take_heading_control" min="0" step="1" max="1" values="OFF|ON" shortname="take_heading"/>
</dl_settings>
</dl_settings>
</settings>
<dep>
<depends>@navigation,guidance_rotorcraft</depends>
<depends>@navigation,guidance_rotorcraft,wls</depends>
<provides>guidance,attitude_command</provides>
</dep>
<header>
+1 -6
View File
@@ -55,7 +55,7 @@
</dl_settings>
</settings>
<dep>
<depends>stabilization_rotorcraft,@attitude_command</depends>
<depends>stabilization_rotorcraft,@attitude_command,wls</depends>
<provides>commands</provides>
</dep>
<header>
@@ -65,15 +65,10 @@
<makefile target="ap|nps" firmware="rotorcraft">
<file name="stabilization_indi.c" dir="$(SRC_FIRMWARE)/stabilization"/>
<file name="stabilization_attitude_quat_indi.c" dir="$(SRC_FIRMWARE)/stabilization"/>
<file name="wls_alloc.c" dir="$(SRC_FIRMWARE)/stabilization/wls"/>
<file name="qr_solve.c" dir="math/qr_solve"/>
<file name="r8lib_min.c" dir="math/qr_solve"/>
<configure name="INDI_OUTPUTS" default="4"/>
<configure name="INDI_NUM_ACT" default="4"/>
<define name="INDI_OUTPUTS" value="$(INDI_OUTPUTS)"/>
<define name="INDI_NUM_ACT" value="$(INDI_NUM_ACT)"/>
<define name="CA_N_V" value="$(INDI_OUTPUTS)"/>
<define name="CA_N_U" value="$(INDI_NUM_ACT)"/>
<define name="STABILIZATION_ATTITUDE_TYPE_INT"/>
<define name="STABILIZATION_ATTITUDE_TYPE_H" value="stabilization/stabilization_attitude_quat_indi.h" type="string"/>
<define name="STABILIZATION_ATTITUDE_INDI_FULL" value="true"/>
+27
View File
@@ -0,0 +1,27 @@
<!DOCTYPE module SYSTEM "module.dtd">
<module name="wls" task="core">
<doc>
<description>
Weighted Least Square optimization algorithm.
Used for dynamic allocation of actuators, in particular
with INDI-based control algorithms.
The size of the matrix (output vs. objectives) must be defined large
enough for all the controllers
</description>
<define name="WLS_N_U" value="4" description="size of the control output vector (default: 6)"/>
<define name="WLS_N_V" value="4" description="size of the control objectives vector (default: 4)"/>
</doc>
<header>
<file name="wls_alloc.h" dir="math/wls"/>
</header>
<makefile>
<file name="wls_alloc.c" dir="math/wls"/>
<file name="qr_solve.c" dir="math/qr_solve"/>
<file name="r8lib_min.c" dir="math/qr_solve"/>
<test/>
</makefile>
</module>