19 PKG =
'uuv_trajectory_control' 20 roslib.load_manifest(PKG)
25 from uuv_trajectory_generator
import TrajectoryPoint
26 from uuv_control_msgs.msg
import TrajectoryPoint
as TrajectoryPointMsg
32 self.assertEquals(p.pos.size, 3,
'Position vector len() is incorrect')
33 self.assertTrue(np.array_equal(p.pos, [0, 0, 0]),
'Position initialization failed')
38 self.assertEquals(p.pos[0], 1,
'X position was initialized wrong')
39 self.assertEquals(p.pos[1], 2,
'Y position was initialized wrong')
40 self.assertEquals(p.pos[2], 3,
'Z position was initialized wrong')
44 self.assertEquals(p.rotq.size, 4,
'Quaternion vector len() is incorrect')
45 self.assertTrue(np.array_equal(p.rotq, [0, 0, 0, 1]),
'Quaternion initialization failed')
48 p0 = TrajectoryPoint()
51 p0.rotq = [0, 0, 1, 1]
52 p0.vel = [1, 2, 3, 4, 5, 6]
53 p0.acc = [1, 2, 3, 4, 5, 6]
55 p1 = TrajectoryPoint()
56 p1.from_message(p0.to_message())
58 self.assertEquals(p0, p1,
'Point to message conversion failed')
61 p0 = TrajectoryPoint()
64 p0.rotq = [0, 0, 1, 1]
65 p0.vel = [1, 2, 3, 4, 5, 6]
66 p0.acc = [1, 2, 3, 4, 5, 6]
68 p1 = TrajectoryPoint()
69 p1.from_dict(p0.to_dict())
71 self.assertEquals(p0, p1,
'Point to dict conversion failed')
73 if __name__ ==
'__main__':
75 rosunit.unitrun(PKG,
'test_trajectory_point', TestTrajectoryPoint)
def test_set_pos_vector(self)
def test_init_pos_vector(self)
def test_to_message(self)
def test_init_quat_vector(self)