@@ -52,25 +52,49 @@ def test_sunSafePoint(show_plots, case):
52
52
unitTestSim .AddModelToTask (unitTaskName , sun_safe_point )
53
53
54
54
# Initialize sunSafePoint module configuration data
55
- sHat_Cmd_B = np .array ([0.0 , 0.0 , 1.0 ])
56
- if case == 5 :
57
- sHat_Cmd_B = np .array ([1.0 , 0.0 , 0.0 ])
58
- sun_safe_point .setSHatBdyCmd (sHat_Cmd_B )
59
55
sun_safe_point .setMinUnitMag (0.1 )
60
- if case == 2 :
56
+ sun_safe_point .setSmallAngle (0.01 * mc .D2R )
57
+
58
+ sHat_Cmd_B = []
59
+ sunVec_B = []
60
+ if case == 1 : # Sun visible, vectors not aligned
61
+ sHat_Cmd_B = np .array ([0.0 , 0.0 , 1.0 ])
62
+ sunVec_B = np .array ([1.0 , 1.0 , 0.0 ])
63
+
64
+ if case == 2 : # Sun not visible, search rate specified
65
+ sHat_Cmd_B = np .array ([0.0 , 0.0 , 1.0 ])
66
+ sunVec_B = np .array ([0.0 , sun_safe_point .getMinUnitMag () / 2 , 0.0 ])
67
+
61
68
omega_RN_B_Search = np .array ([0.0 , 0.0 , 0.1 ])
62
69
sun_safe_point .setOmega_RN_B (omega_RN_B_Search )
63
- sun_safe_point .setSmallAngle (0.01 * mc .D2R )
64
70
65
- # Create sunSafePoint sun direction input messages
66
- inputSunVecData = messaging .NavAttMsgPayload ()
67
- sunVec_B = np .array ([1.0 , 1.0 , 0.0 ])
68
- if case == 2 or case == 6 : # No sun visible, providing a near zero norm direction vector
69
- sunVec_B = [0.0 , sun_safe_point .getMinUnitMag () / 2 , 0.0 ]
70
- if case == 3 :
71
+ elif case == 3 : # Sun visible, vectors aligned
72
+ sHat_Cmd_B = np .array ([0.0 , 0.0 , 1.0 ])
71
73
sunVec_B = sHat_Cmd_B
72
- if case == 4 or case == 5 :
74
+
75
+ elif case == 4 : # Sun visible, vectors oppositely aligned
76
+ sHat_Cmd_B = np .array ([0.0 , 0.0 , 1.0 ])
77
+ sunVec_B = - sHat_Cmd_B
78
+
79
+ elif case == 5 : # Sun visible, vectors oppositely aligned, sHatCmd is along b1
80
+ sHat_Cmd_B = np .array ([1.0 , 0.0 , 0.0 ])
73
81
sunVec_B = - sHat_Cmd_B
82
+
83
+ elif case == 6 : # Sun not visible, no search rate specified
84
+ sHat_Cmd_B = np .array ([0.0 , 0.0 , 1.0 ])
85
+ sunVec_B = np .array ([0.0 , sun_safe_point .getMinUnitMag () / 2 , 0.0 ])
86
+
87
+ else : # Sun visible, spin rate about sun heading vector specified
88
+ sHat_Cmd_B = np .array ([0.0 , 0.0 , 1.0 ])
89
+ sunVec_B = np .array ([1.0 , 1.0 , 0.0 ])
90
+
91
+ sun_safe_point .setSunAxisSpinRate (1.5 * mc .D2R )
92
+ omega_RN_B_Search = sunVec_B / np .linalg .norm (sunVec_B ) * sun_safe_point .getSunAxisSpinRate ()
93
+
94
+ sun_safe_point .setSHatBdyCmd (sHat_Cmd_B )
95
+
96
+ # Create sunSafePoint sun direction input messages
97
+ inputSunVecData = messaging .NavAttMsgPayload ()
74
98
inputSunVecData .vehSunPntBdy = sunVec_B
75
99
sunInMsg = messaging .NavAttMsg ().write (inputSunVecData )
76
100
@@ -80,10 +104,6 @@ def test_sunSafePoint(show_plots, case):
80
104
inputIMUData .omega_BN_B = omega_BN_B
81
105
imuInMsg = messaging .NavAttMsg ().write (inputIMUData )
82
106
83
- if case == 7 :
84
- sun_safe_point .setSunAxisSpinRate (1.5 * mc .D2R )
85
- omega_RN_B_Search = sunVec_B / np .linalg .norm (sunVec_B ) * sun_safe_point .getSunAxisSpinRate ()
86
-
87
107
# Set up data logging
88
108
attGuidOutMsgDataLog = sun_safe_point .attGuidanceOutMsg .recorder ()
89
109
unitTestSim .AddModelToTask (unitTaskName , attGuidOutMsgDataLog )
0 commit comments