Skip to content

Commit 5b6e8ee

Browse files
author
tteil
committed
update cob unit test
1 parent ec6948d commit 5b6e8ee

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

src/fswAlgorithms/opticalNavigation/cobConverter/_UnitTest/test_cobConverter.py

+10-10
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,8 @@ def compute_camera_calibration_matrix(input_camera):
6969
alpha = 0.
7070
resX = input_camera.resolution[0]
7171
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)
7474
dX = resX / pX
7575
dY = resY / pY
7676
up = resX / 2.
@@ -145,18 +145,18 @@ def cob_converter_test_function(show_plots, cameraResolution, centerOfBrightness
145145
sigma_CB = rbk.C2MRP(dcm_CB)
146146

147147
# Create the input messages.
148-
inputCamera = messaging.CameraConfigMsgPayload()
148+
inputCamera = messaging.CameraModelMsgPayload()
149149
inputCob = messaging.OpNavCOBMsgPayload()
150150
inputFilter = messaging.FilterMsgPayload()
151151
inputAtt = messaging.NavAttMsgPayload()
152152
inputEphem = messaging.EphemerisMsgPayload()
153153

154154
# Set camera parameters
155-
inputCamera.fieldOfView = np.deg2rad(20.0)
155+
inputCamera.fieldOfView = [np.deg2rad(20.0), np.deg2rad(20.0)]
156156
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)
160160
module.cameraConfigInMsg.subscribeTo(camInMsg)
161161

162162
# Set center of brightness
@@ -211,7 +211,7 @@ def cob_converter_test_function(show_plots, cameraResolution, centerOfBrightness
211211
goodPixels = 0
212212
cob_true = [inputCob.centerOfBrightness[0], inputCob.centerOfBrightness[1]]
213213
num_pixels = inputCob.pixelsFound
214-
dcm_CB = rbk.MRP2C(inputCamera.sigma_CB)
214+
dcm_CB = rbk.MRP2C(inputCamera.bodyToCameraMrp)
215215
dcm_BN = rbk.MRP2C(inputAtt.sigma_BN)
216216
dcm_NC = np.dot(dcm_CB, dcm_BN).T
217217

@@ -238,8 +238,8 @@ def cob_converter_test_function(show_plots, cameraResolution, centerOfBrightness
238238
phi = np.arctan2(shat_C[1], shat_C[0]) # sun direction in image plane
239239
K = compute_camera_calibration_matrix(inputCamera)
240240
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
243243
com_true = [None] * 2 # COM location in image
244244
com_true[0] = cob_true[0] - gamma * Rc * np.cos(phi) * goodPixels
245245
com_true[1] = cob_true[1] - gamma * Rc * np.sin(phi) * goodPixels

0 commit comments

Comments
 (0)