Skip to content

Commit 0b81184

Browse files
tuned MRACwithbaseline_safetyMechanism
1 parent 444ce11 commit 0b81184

File tree

5 files changed

+133
-60
lines changed

5 files changed

+133
-60
lines changed

GainsController.py

Lines changed: 27 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1354,10 +1354,11 @@ def FunnelTwoLayerMRACwithBASELINE(mass_total_estimated,air_density_estimated,su
13541354
def MRACwithBASELINE_SafetyMechanism(mass_total_estimated,air_density_estimated,surface_area_estimated,drag_coefficient_matrix_estimated):
13551355

13561356
# Number of states to be integrated by RK4
1357-
number_of_states = 100
1357+
# number_of_states = 100
1358+
number_of_states = 106
13581359
# Length of the array vector that will be exported
1359-
size_DATA = 74
1360-
# size_DATA = 94 # OLD data format
1360+
# size_DATA = 74
1361+
size_DATA = 86
13611362

13621363
# ----------------------------------------------------------------
13631364
# Baseline Parameters
@@ -1373,14 +1374,23 @@ def MRACwithBASELINE_SafetyMechanism(mass_total_estimated,air_density_estimated,
13731374
KD_tran_PD_baseline = np.matrix(1 * np.diag([8,8,3]))
13741375

13751376
# **Rotational** baseline parameters
1376-
KP_rot = np.matrix(1e2 * np.diag([1,1,0.5]))
1377+
# KP_rot = np.matrix(1e2 * np.diag([1,1,0.5]))
1378+
# KP_rot = np.matrix(5e1 * np.diag([0.1,0.1,0.5]))
1379+
KP_rot = np.matrix(5e1 * np.diag([0.05,0.05,0.5]))
1380+
# KI_rot = np.matrix(1e2 * np.diag([1,1,1]))
1381+
KI_rot = np.matrix(1e2 * np.diag([1,1,1]))
13771382

13781383
# **Rotational** parameters for the PI baseline controller (Moment_baseline_PI)
1379-
KP_rot_PI_baseline = np.matrix(40 * np.diag([1,1,1]))
1384+
# KP_rot_PI_baseline = np.matrix(40 * np.diag([1,1,1]))
1385+
# KD_rot_PI_baseline = np.matrix(0 * np.diag([1,1,0.5]))
1386+
# KI_rot_PI_baseline = np.matrix(1e-1 * np.diag([1,1,0.5]))
1387+
KP_rot_PI_baseline = np.matrix(200 * np.diag([1,1,0.3]))
13801388
KD_rot_PI_baseline = np.matrix(0 * np.diag([1,1,0.5]))
1381-
KI_rot_PI_baseline = np.matrix(0.1 * np.diag([1,1,0.5]))
1389+
KI_rot_PI_baseline = np.matrix(1e2 * np.diag([10,10,0.5]))
13821390

1383-
K_P_omega_ref = np.matrix(1.5e-1 * np.diag([5,5,10]))
1391+
# K_P_omega_ref = np.matrix(1.5e-1 * np.diag([5,5,10]))
1392+
K_P_omega_ref = np.matrix(1.5e0 * np.diag([50,50,10]))
1393+
K_I_omega_ref = np.matrix(1e2 * np.diag([1,1,1]))
13841394

13851395
# ----------------------------------------------------------------
13861396
# Translational Parameters MRAC
@@ -1431,13 +1441,17 @@ def MRACwithBASELINE_SafetyMechanism(mass_total_estimated,air_density_estimated,
14311441
B_ref_rot = np.matrix(np.eye(3))
14321442

14331443
# **Rotational** parameters Lyapunov equation
1434-
Q_rot = np.matrix(7e-3 * np.diag([1,1,2]))
1444+
# Q_rot = np.matrix(7e-3 * np.diag([1,1,2]))
1445+
Q_rot = np.matrix(7e-3 * np.diag([2,2,2]))
14351446
P_rot = np.matrix(linalg.solve_continuous_lyapunov(A_ref_rot.T, -Q_rot))
14361447

14371448
# **Rotational** adaptive parameters
1438-
Gamma_x_rot = np.matrix(1e1 * np.diag([1,1,10])) # Adaptive rates
1439-
Gamma_r_rot = np.matrix(1e-4 * np.diag([1,1,1])) # Adaptive rates
1440-
Gamma_Theta_rot = np.matrix(1e0 * np.diag([1,1,1,1,1,1])) # Adaptive rates
1449+
# Gamma_x_rot = np.matrix(1e1 * np.diag([1,1,10])) # Adaptive rates
1450+
# Gamma_r_rot = np.matrix(1e-4 * np.diag([1,1,1])) # Adaptive rates
1451+
# Gamma_Theta_rot = np.matrix(1e0 * np.diag([1,1,1,1,1,1])) # Adaptive rates
1452+
Gamma_x_rot = np.matrix(1e4 * np.diag([1,1,1])) # Adaptive rates
1453+
Gamma_r_rot = np.matrix(1e1 * np.diag([1,1,1])) # Adaptive rates
1454+
Gamma_Theta_rot = np.matrix(1e2 * np.diag([1,1,1,1,1,1])) # Adaptive rates
14411455

14421456
# ----------------------------------------------------------------
14431457
# Safety Mechanism Parameters
@@ -1457,8 +1471,8 @@ def MRACwithBASELINE_SafetyMechanism(mass_total_estimated,air_density_estimated,
14571471
alphaPlane = 0.95 # [-] coefficient for setting the 'height' of the bottom plane. Must be >0 and <1.
14581472

14591473

1460-
return [number_of_states,size_DATA,KP_tran,KD_tran,KI_tran,KP_tran_PD_baseline,KD_tran_PD_baseline,KP_rot,KP_rot_PI_baseline,
1461-
KD_rot_PI_baseline,KI_rot_PI_baseline,K_P_omega_ref,A_tran,B_tran,A_tran_bar,Lambda_bar,Theta_tran_adaptive_bar,
1474+
return [number_of_states,size_DATA,KP_tran,KD_tran,KI_tran,KP_tran_PD_baseline,KD_tran_PD_baseline,KP_rot,KI_rot,KP_rot_PI_baseline,
1475+
KD_rot_PI_baseline,KI_rot_PI_baseline,K_P_omega_ref,K_I_omega_ref,A_tran,B_tran,A_tran_bar,Lambda_bar,Theta_tran_adaptive_bar,
14621476
A_ref_tran,B_ref_tran,Gamma_x_tran,Gamma_r_tran,Gamma_Theta_tran,Gamma_Theta_tran,Q_tran,P_tran,K_x_tran_bar,K_r_tran_bar,A_rot,
14631477
B_rot,A_ref_rot,B_ref_rot,Q_rot,P_rot,Gamma_x_rot,Gamma_r_rot,Gamma_Theta_rot,sphereEpsilon,maximumThrust,
14641478
EllipticConeEpsilon,maximumRollAngle,maximumPitchAngle,planeEpsilon,alphaPlane]

0 commit comments

Comments
 (0)