Skip to content

Commit

Permalink
Fix multisweep dtype (nutonomy#581)
Browse files Browse the repository at this point in the history
* Fix multisweep dtype

* Add error message

Co-authored-by: Holger Caesar <holger.caesar@motional.com>
  • Loading branch information
holger-motional and Holger Caesar authored Apr 12, 2021
1 parent 41e2ea5 commit 36f52d3
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion python-sdk/nuscenes/utils/data_classes.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ def from_file_multisweep(cls,
:return: (all_pc, all_times). The aggregated point cloud and timestamps.
"""
# Init.
points = np.zeros((cls.nbr_dims(), 0))
points = np.zeros((cls.nbr_dims(), 0), dtype=np.float32)
all_pc = cls(points)
all_times = np.zeros((1, 0))

Expand Down Expand Up @@ -127,6 +127,9 @@ def from_file_multisweep(cls,
else:
current_sd_rec = nusc.get('sample_data', current_sd_rec['prev'])

# Check that the multisweep pointcloud has the same dtype as individual pointclouds.
assert all_pc.points.dtype == np.float32, 'Error: Invalid dtype for multisweep pointcloud!'

return all_pc, all_times

def nbr_points(self) -> int:
Expand Down

0 comments on commit 36f52d3

Please sign in to comment.