@@ -30,7 +30,25 @@ def PID():
3030 KD_rot = np .matrix (1 * np .diag ([50 ,50 ,50 ]))
3131 KI_rot = np .matrix (1 * np .diag ([20 ,20 ,10 ]))
3232
33- return [number_of_states ,size_DATA ,KP_tran ,KD_tran ,KI_tran ,KP_rot ,KD_rot ,KI_rot ]
33+ # ----------------------------------------------------------------
34+ # Safety Mechanism Parameters
35+ # ----------------------------------------------------------------
36+
37+ # Mu - sphere intersection
38+ sphereEpsilon = 1e-2
39+ maximumThrust = 85 # [N] 85
40+
41+ # Mu - elliptic cone intersection
42+ EllipticConeEpsilon = 1e-2
43+ maximumRollAngle = math .radians (32 ) # [rad] 25
44+ maximumPitchAngle = math .radians (32 ) # [rad] 25
45+
46+ # Mu - plane intersection
47+ planeEpsilon = 1e-2
48+ alphaPlane = 0.95 # [-] coefficient for setting the 'height' of the bottom plane. Must be >0 and <1.
49+
50+ return [number_of_states ,size_DATA ,KP_tran ,KD_tran ,KI_tran ,KP_rot ,KD_rot ,KI_rot ,sphereEpsilon ,maximumThrust ,
51+ EllipticConeEpsilon ,maximumRollAngle ,maximumPitchAngle ,planeEpsilon ,alphaPlane ]
3452 # ================================================================================================================================================================
3553 # end of PID
3654 # ================================================================================================================================================================
@@ -1336,10 +1354,11 @@ def FunnelTwoLayerMRACwithBASELINE(mass_total_estimated,air_density_estimated,su
13361354 def MRACwithBASELINE_SafetyMechanism (mass_total_estimated ,air_density_estimated ,surface_area_estimated ,drag_coefficient_matrix_estimated ):
13371355
13381356 # Number of states to be integrated by RK4
1339- number_of_states = 100
1357+ # number_of_states = 100
1358+ number_of_states = 106
13401359 # Length of the array vector that will be exported
1341- size_DATA = 74
1342- # size_DATA = 94 # OLD data format
1360+ # size_DATA = 74
1361+ size_DATA = 86
13431362
13441363 # ----------------------------------------------------------------
13451364 # Baseline Parameters
@@ -1355,14 +1374,23 @@ def MRACwithBASELINE_SafetyMechanism(mass_total_estimated,air_density_estimated,
13551374 KD_tran_PD_baseline = np .matrix (1 * np .diag ([8 ,8 ,3 ]))
13561375
13571376 # **Rotational** baseline parameters
1358- 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 ]))
13591382
13601383 # **Rotational** parameters for the PI baseline controller (Moment_baseline_PI)
1361- 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 ]))
13621388 KD_rot_PI_baseline = np .matrix (0 * np .diag ([1 ,1 ,0.5 ]))
1363- 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 ]))
13641390
1365- 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 ]))
13661394
13671395 # ----------------------------------------------------------------
13681396 # Translational Parameters MRAC
@@ -1413,13 +1441,17 @@ def MRACwithBASELINE_SafetyMechanism(mass_total_estimated,air_density_estimated,
14131441 B_ref_rot = np .matrix (np .eye (3 ))
14141442
14151443 # **Rotational** parameters Lyapunov equation
1416- 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 ]))
14171446 P_rot = np .matrix (linalg .solve_continuous_lyapunov (A_ref_rot .T , - Q_rot ))
14181447
14191448 # **Rotational** adaptive parameters
1420- Gamma_x_rot = np .matrix (1e1 * np .diag ([1 ,1 ,10 ])) # Adaptive rates
1421- Gamma_r_rot = np .matrix (1e-4 * np .diag ([1 ,1 ,1 ])) # Adaptive rates
1422- 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
14231455
14241456 # ----------------------------------------------------------------
14251457 # Safety Mechanism Parameters
@@ -1431,16 +1463,16 @@ def MRACwithBASELINE_SafetyMechanism(mass_total_estimated,air_density_estimated,
14311463
14321464 # Mu - elliptic cone intersection
14331465 EllipticConeEpsilon = 1e-2
1434- maximumRollAngle = math .radians (20 ) # [rad] 25
1435- maximumPitchAngle = math .radians (20 ) # [rad] 25
1466+ maximumRollAngle = math .radians (60 ) # [rad] 25 - 32
1467+ maximumPitchAngle = math .radians (60 ) # [rad] 25 - 32
14361468
14371469 # Mu - plane intersection
14381470 planeEpsilon = 1e-2
14391471 alphaPlane = 0.95 # [-] coefficient for setting the 'height' of the bottom plane. Must be >0 and <1.
14401472
14411473
1442- 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 ,
1443- 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 ,
14441476 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 ,
14451477 B_rot ,A_ref_rot ,B_ref_rot ,Q_rot ,P_rot ,Gamma_x_rot ,Gamma_r_rot ,Gamma_Theta_rot ,sphereEpsilon ,maximumThrust ,
14461478 EllipticConeEpsilon ,maximumRollAngle ,maximumPitchAngle ,planeEpsilon ,alphaPlane ]
0 commit comments