Skip to content

Commit

Permalink
calibration and draw process test passed
Browse files Browse the repository at this point in the history
  • Loading branch information
ShisatoYano committed Dec 8, 2023
1 parent 7e18c97 commit bc8fc45
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions test/test_ukf_params_calibrator.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,17 @@
from pathlib import Path

sys.path.append(str(Path(__file__).absolute().parent) + "/../src/components/sensors/lidar")
sys.path.append(str(Path(__file__).absolute().parent) + "/../src/components/common")
from ukf_ext_params_calibrator import UkfExtParamsCalibrator
from matrix_lib import hom_mat_33


class MockState:
def __init__(self):
pass

def x_y_yaw(self):
return np.array([[0.0], [0.0], [0.0]])


def test_initialization():
Expand Down Expand Up @@ -44,3 +54,29 @@ def test_initialization():
assert calibrator.cov[0, 0] == 1.0
assert calibrator.cov[1, 1] == 1.0
assert calibrator.cov[2, 2] == 1.0


def test_calibrate_extrinsic_params():
calibrator = UkfExtParamsCalibrator()

sensor_odom_tf = hom_mat_33(0.0, 0.0, 0.0)
vehicle_odom_tf = hom_mat_33(0.0, 0.0, 0.0)
calibrator.calibrate_extrinsic_params(sensor_odom_tf, vehicle_odom_tf)

assert calibrator.state[0, 0] == 0.0
assert calibrator.state[1, 0] == 0.0
assert calibrator.state[2, 0] == 0.0
assert calibrator.cov[0, 0] != 1.0
assert calibrator.cov[1, 1] != 1.0
assert calibrator.cov[2, 2] != 1.0


def test_draw_calib_result():
calibrator = UkfExtParamsCalibrator()

plt.clf()
plt.close()
figure = plt.figure(figsize=(8, 8))
axes = figure.add_subplot(111)

calibrator.draw_calib_result(axes, [], MockState(), 0.0, 0.0, 0.0)

0 comments on commit bc8fc45

Please sign in to comment.