From 049ccf4a21885948ff39afda4b886d4733ff4bc8 Mon Sep 17 00:00:00 2001 From: Mooyeol Baek Date: Wed, 10 Apr 2019 23:33:57 +0900 Subject: [PATCH 1/2] fix for save --- pypcd/numpy_pc2.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pypcd/numpy_pc2.py b/pypcd/numpy_pc2.py index 1f772e6..ea4bf3c 100644 --- a/pypcd/numpy_pc2.py +++ b/pypcd/numpy_pc2.py @@ -39,6 +39,7 @@ __docformat__ = "restructuredtext en" import numpy as np +import numpy.lib.recfunctions as recfuncs from sensor_msgs.msg import PointField from sensor_msgs.msg import PointCloud2 @@ -134,8 +135,8 @@ def pointcloud2_to_array(cloud_msg, split_rgb=False, remove_padding=True): # remove the dummy fields that were added if remove_padding: - cloud_arr = cloud_arr[ - [fname for fname, _type in dtype_list if not (fname[:len(DUMMY_FIELD_PREFIX)] == DUMMY_FIELD_PREFIX)]] + cloud_arr=recfuncs.repack_fields(cloud_arr[ + [fname for fname, _type in dtype_list if not (fname[:len(DUMMY_FIELD_PREFIX)] == DUMMY_FIELD_PREFIX)]]) if split_rgb: cloud_arr = split_rgb_field(cloud_arr) From 151c8f03c4542337e844f2abe7430d3e0abfc5cb Mon Sep 17 00:00:00 2001 From: Mooyeol Baek Date: Wed, 10 Apr 2019 23:38:55 +0900 Subject: [PATCH 2/2] convention --- pypcd/numpy_pc2.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pypcd/numpy_pc2.py b/pypcd/numpy_pc2.py index ea4bf3c..7b5ba97 100644 --- a/pypcd/numpy_pc2.py +++ b/pypcd/numpy_pc2.py @@ -135,7 +135,7 @@ def pointcloud2_to_array(cloud_msg, split_rgb=False, remove_padding=True): # remove the dummy fields that were added if remove_padding: - cloud_arr=recfuncs.repack_fields(cloud_arr[ + cloud_arr = recfuncs.repack_fields(cloud_arr[ [fname for fname, _type in dtype_list if not (fname[:len(DUMMY_FIELD_PREFIX)] == DUMMY_FIELD_PREFIX)]]) if split_rgb: