1 from . import DifferentiableManifold, MatrixLieGroup, SO, se, R, contract
2 from .. import (SE3_from_SE2, assert_allclose, pose_from_rotation_translation,
3 rotation_translation_from_pose, extract_pieces, se2_from_SE2, SE2_from_se2,
4 SE2_from_translation_angle)
8 '''
9 This is the Special Euclidean group SE(n)
10 describing roto-translations of Euclidean space.
11 Implemented only for n=2,3.
12
13 Note that you have to supply a coefficient *alpha* that
14 weights rotation and translation when defining distances.
15 '''
16
17 @contract(N='int,(2|3)')
31
33 return 'SE%s' % (self.n - 1)
34
35 @contract(x='array[NxN]')
37
38 assert x.shape == (self.n, self.n)
39 R, t, zero, one = extract_pieces(x)
40 self.SOn.belongs(R)
41 assert_allclose(zero, 0, err_msg='I expect the lower row to be 0.')
42 assert_allclose(one, 1)
43
49
53
54
55
61
67
69 if self.n == 3:
70 return [
71 SE2_from_translation_angle([0, 0], 0),
72 SE2_from_translation_angle([0, 0], 0.1),
73 SE2_from_translation_angle([0, 0], -0.1),
74 SE2_from_translation_angle([1, 0.1], 0),
75 ]
76 elif self.n == 4:
77
78 return [
79 SE3_from_SE2(SE2_from_translation_angle([0, 0], 0)),
80 SE3_from_SE2(SE2_from_translation_angle([0, 0], 0.1)),
81 SE3_from_SE2(SE2_from_translation_angle([0, 0], -0.1)),
82 SE3_from_SE2(SE2_from_translation_angle([1, 0.1], 0)),
83 ]
84 else:
85 assert False
86