diff --git a/pypcd/numpy_pc2.py b/pypcd/numpy_pc2.py index 7b5ba97..00140e7 100644 --- a/pypcd/numpy_pc2.py +++ b/pypcd/numpy_pc2.py @@ -131,7 +131,7 @@ def pointcloud2_to_array(cloud_msg, split_rgb=False, remove_padding=True): dtype_list = pointcloud2_to_dtype(cloud_msg) # parse the cloud into an array - cloud_arr = np.fromstring(cloud_msg.data, dtype_list) + cloud_arr = np.fromstring(cloud_msg.data.tobytes(), dtype_list) # remove the dummy fields that were added if remove_padding: diff --git a/pypcd/pypcd.py b/pypcd/pypcd.py index 68d199d..9459238 100644 --- a/pypcd/pypcd.py +++ b/pypcd/pypcd.py @@ -24,7 +24,7 @@ HAS_SENSOR_MSGS = True try: from sensor_msgs.msg import PointField - import numpy_pc2 # needs sensor_msgs + from . import numpy_pc2 # needs sensor_msgs except ImportError: HAS_SENSOR_MSGS = False