| 1 |
import numpy as np |
| 2 |
|
| 3 |
import pycolmap |
| 4 |
|
| 5 |
|
| 6 |
def test_pose_prior_coordinate_system_enum(): |
| 7 |
assert pycolmap.PosePriorCoordinateSystem.UNDEFINED is not None |
| 8 |
assert pycolmap.PosePriorCoordinateSystem.WGS84 is not None |
| 9 |
assert pycolmap.PosePriorCoordinateSystem.CARTESIAN is not None |
| 10 |
|
| 11 |
|
| 12 |
def test_pose_prior_default_init(): |
| 13 |
pose_prior = pycolmap.PosePrior() |
| 14 |
assert pose_prior is not None |
| 15 |
|
| 16 |
|
| 17 |
def test_pose_prior_position_readwrite(): |
| 18 |
pose_prior = pycolmap.PosePrior() |
| 19 |
pose_prior.position = np.array([1.0, 2.0, 3.0]) |
| 20 |
np.testing.assert_array_almost_equal(pose_prior.position, [1.0, 2.0, 3.0]) |
| 21 |
|
| 22 |
|
| 23 |
def test_pose_prior_position_covariance_readwrite(): |
| 24 |
pose_prior = pycolmap.PosePrior() |
| 25 |
covariance = np.eye(3) * 0.5 |
| 26 |
pose_prior.position_covariance = covariance |
| 27 |
np.testing.assert_array_almost_equal( |
| 28 |
pose_prior.position_covariance, covariance |
| 29 |
) |
| 30 |
|
| 31 |
|
| 32 |
def test_pose_prior_coordinate_system_readwrite(): |
| 33 |
pose_prior = pycolmap.PosePrior() |
| 34 |
pose_prior.coordinate_system = pycolmap.PosePriorCoordinateSystem.WGS84 |
| 35 |
assert ( |
| 36 |
pose_prior.coordinate_system == pycolmap.PosePriorCoordinateSystem.WGS84 |
| 37 |
) |
| 38 |
|
| 39 |
|
| 40 |
def test_pose_prior_gravity_readwrite(): |
| 41 |
pose_prior = pycolmap.PosePrior() |
| 42 |
gravity = np.array([0.0, 0.0, -9.81]) |
| 43 |
pose_prior.gravity = gravity |
| 44 |
np.testing.assert_array_almost_equal(pose_prior.gravity, gravity) |
| 45 |
|
| 46 |
|
| 47 |
def test_pose_prior_has_position(): |
| 48 |
pose_prior = pycolmap.PosePrior() |
| 49 |
assert isinstance(pose_prior.has_position(), bool) |
| 50 |
|
| 51 |
|
| 52 |
def test_pose_prior_has_position_cov(): |
| 53 |
pose_prior = pycolmap.PosePrior() |
| 54 |
assert isinstance(pose_prior.has_position_cov(), bool) |
| 55 |
|
| 56 |
|
| 57 |
def test_pose_prior_has_gravity(): |
| 58 |
pose_prior = pycolmap.PosePrior() |
| 59 |
assert isinstance(pose_prior.has_gravity(), bool) |
| 60 |
|
| 61 |
|
| 62 |
def test_pose_prior_pose_prior_id_readwrite(): |
| 63 |
pose_prior = pycolmap.PosePrior() |
| 64 |
pose_prior.pose_prior_id = 42 |
| 65 |
assert pose_prior.pose_prior_id == 42 |
| 66 |
|
| 67 |
|
| 68 |
def test_pose_prior_corr_data_id_readwrite(): |
| 69 |
pose_prior = pycolmap.PosePrior() |
| 70 |
data_id = pycolmap.data_t( |
| 71 |
pycolmap.sensor_t(pycolmap.SensorType.CAMERA, 0), 5 |
| 72 |
) |
| 73 |
pose_prior.corr_data_id = data_id |
| 74 |
assert pose_prior.corr_data_id == data_id |