Skip to content

Commit c218ae2

Browse files
committed
Force all points to be floats
1 parent 11be9d0 commit c218ae2

File tree

2 files changed

+14
-14
lines changed

2 files changed

+14
-14
lines changed

traj_upload.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@ def prepare_for_sending(traj):
1111
s = [int(a.timestamp) for a in traj]
1212
us = [int((a.timestamp - int(a.timestamp))*1e6) for a in traj]
1313

14-
x = list(zip(s, us, (a.x for a in traj)))
15-
y = list(zip(s, us, (a.y for a in traj)))
16-
theta = list(zip(s, us, (a.theta for a in traj)))
17-
speed = list(zip(s, us, (a.speed for a in traj)))
18-
omega = list(zip(s, us, (a.omega for a in traj)))
14+
x = list(zip(s, us, (float(a.x) for a in traj)))
15+
y = list(zip(s, us, (float(a.y) for a in traj)))
16+
theta = list(zip(s, us, (float(a.theta) for a in traj)))
17+
speed = list(zip(s, us, (float(a.speed) for a in traj)))
18+
omega = list(zip(s, us, (float(a.omega) for a in traj)))
1919

2020
return [x, y, theta, speed, omega]
2121

traj_upload_test.py

+9-9
Original file line numberDiff line numberDiff line change
@@ -9,21 +9,21 @@ def test_can_create_traj_point(self):
99
timestamp=1.4)
1010

1111
def test_can_prepare_trajectory(self):
12-
traj = [TrajectoryPoint(x='x', y='y', theta='t', speed='s',
13-
omega='o', timestamp=float(i))
12+
traj = [TrajectoryPoint(x=1., y=2., theta=3., speed=4.,
13+
omega=5., timestamp=float(i))
1414
for i in range(10)]
1515

1616
traj_transformed = prepare_for_sending(traj)
1717

18-
self.assertEqual(traj_transformed[0], [(i, 0, 'x') for i in range(10)])
19-
self.assertEqual(traj_transformed[1], [(i, 0, 'y') for i in range(10)])
20-
self.assertEqual(traj_transformed[2], [(i, 0, 't') for i in range(10)])
21-
self.assertEqual(traj_transformed[3], [(i, 0, 's') for i in range(10)])
22-
self.assertEqual(traj_transformed[4], [(i, 0, 'o') for i in range(10)])
18+
self.assertEqual(traj_transformed[0], [(i, 0, 1.) for i in range(10)])
19+
self.assertEqual(traj_transformed[1], [(i, 0, 2.) for i in range(10)])
20+
self.assertEqual(traj_transformed[2], [(i, 0, 3.) for i in range(10)])
21+
self.assertEqual(traj_transformed[3], [(i, 0, 4.) for i in range(10)])
22+
self.assertEqual(traj_transformed[4], [(i, 0, 5.) for i in range(10)])
2323

2424
def test_can_send(self):
25-
traj = [TrajectoryPoint(x='x', y='y', theta='t', speed='s',
26-
omega='o', timestamp=float(i))
25+
traj = [TrajectoryPoint(x=1., y=2., theta=3., speed=4.,
26+
omega=5., timestamp=float(i))
2727
for i in range(10)]
2828

2929
preprocessed_traj = prepare_for_sending(traj)

0 commit comments

Comments
 (0)