@@ -69,8 +69,8 @@ def compute_camera_calibration_matrix(input_camera):
69
69
alpha = 0.
70
70
resX = input_camera .resolution [0 ]
71
71
resY = input_camera .resolution [1 ]
72
- pX = 2. * np .tan (input_camera .fieldOfView / 2.0 )
73
- pY = 2. * np .tan (input_camera .fieldOfView * resY / resX / 2.0 )
72
+ pX = 2. * np .tan (input_camera .fieldOfView [ 0 ] / 2.0 )
73
+ pY = 2. * np .tan (input_camera .fieldOfView [ 0 ] * resY / resX / 2.0 )
74
74
dX = resX / pX
75
75
dY = resY / pY
76
76
up = resX / 2.
@@ -145,18 +145,18 @@ def cob_converter_test_function(show_plots, cameraResolution, centerOfBrightness
145
145
sigma_CB = rbk .C2MRP (dcm_CB )
146
146
147
147
# Create the input messages.
148
- inputCamera = messaging .CameraConfigMsgPayload ()
148
+ inputCamera = messaging .CameraModelMsgPayload ()
149
149
inputCob = messaging .OpNavCOBMsgPayload ()
150
150
inputFilter = messaging .FilterMsgPayload ()
151
151
inputAtt = messaging .NavAttMsgPayload ()
152
152
inputEphem = messaging .EphemerisMsgPayload ()
153
153
154
154
# Set camera parameters
155
- inputCamera .fieldOfView = np .deg2rad (20.0 )
155
+ inputCamera .fieldOfView = [ np .deg2rad (20.0 ), np . deg2rad ( 20.0 )]
156
156
inputCamera .resolution = cameraResolution
157
- inputCamera .sigma_CB = sigma_CB
158
- inputCamera .ppFocalLength = 0.10
159
- camInMsg = messaging .CameraConfigMsg ().write (inputCamera )
157
+ inputCamera .bodyToCameraMrp = sigma_CB
158
+ inputCamera .focalLength = 0.10
159
+ camInMsg = messaging .CameraModelMsg ().write (inputCamera )
160
160
module .cameraConfigInMsg .subscribeTo (camInMsg )
161
161
162
162
# Set center of brightness
@@ -211,7 +211,7 @@ def cob_converter_test_function(show_plots, cameraResolution, centerOfBrightness
211
211
goodPixels = 0
212
212
cob_true = [inputCob .centerOfBrightness [0 ], inputCob .centerOfBrightness [1 ]]
213
213
num_pixels = inputCob .pixelsFound
214
- dcm_CB = rbk .MRP2C (inputCamera .sigma_CB )
214
+ dcm_CB = rbk .MRP2C (inputCamera .bodyToCameraMrp )
215
215
dcm_BN = rbk .MRP2C (inputAtt .sigma_BN )
216
216
dcm_NC = np .dot (dcm_CB , dcm_BN ).T
217
217
@@ -238,8 +238,8 @@ def cob_converter_test_function(show_plots, cameraResolution, centerOfBrightness
238
238
phi = np .arctan2 (shat_C [1 ], shat_C [0 ]) # sun direction in image plane
239
239
K = compute_camera_calibration_matrix (inputCamera )
240
240
dX = K [0 , 0 ]
241
- Kx = dX / inputCamera .ppFocalLength
242
- Rc = R_object * Kx * inputCamera .ppFocalLength / np .linalg .norm (r_BdyZero_N ) # object radius in pixels
241
+ Kx = dX / inputCamera .focalLength
242
+ Rc = R_object * Kx * inputCamera .focalLength / np .linalg .norm (r_BdyZero_N ) # object radius in pixels
243
243
com_true = [None ] * 2 # COM location in image
244
244
com_true [0 ] = cob_true [0 ] - gamma * Rc * np .cos (phi ) * goodPixels
245
245
com_true [1 ] = cob_true [1 ] - gamma * Rc * np .sin (phi ) * goodPixels
0 commit comments