Skip to content

Commit 40106d6

Browse files
committed
Fixed tiny issue with reflectivity range
1 parent 86d8045 commit 40106d6

2 files changed

Lines changed: 57 additions & 32 deletions

File tree

GEMstack/onboard/perception/point_pillars_node.py

Lines changed: 30 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,10 @@ def pc2_to_numpy_with_intensity(pc2_msg, want_rgb=False):
2929
# Convert the ROS message to a numpy structured array
3030
pc = ros_numpy.point_cloud2.pointcloud2_to_array(pc2_msg)
3131
reflectivity = np.array(pc['reflectivity']).ravel()
32-
32+
intensity = np.array(pc['intensity']).ravel()
33+
3334
# Normalize reflectivity to 0-1 range
34-
reflectivity_max = np.max(reflectivity)
35-
if reflectivity_max > 1.0:
36-
normalized_reflectivity = reflectivity / reflectivity_max
37-
else:
38-
normalized_reflectivity = reflectivity
35+
normalized_reflectivity = reflectivity / 255.0
3936

4037
# Stack x,y,z, r fields to a (N,4) array
4138
pts = np.stack((np.array(pc['x']).ravel(),
@@ -198,6 +195,20 @@ def synchronized_callback(self, image_msg, lidar_msg):
198195
# Extract center position and dimensions
199196
x, y, z, l, w, h, yaw = bbox
200197

198+
if self.debug:
199+
print("X LIDAR")
200+
print(x)
201+
print("L")
202+
print(l)
203+
print("Y LIDAR")
204+
print(y)
205+
print("W")
206+
print(w)
207+
print("Z LIDAR")
208+
print(z)
209+
print("H")
210+
print(h)
211+
201212
# Transform from LiDAR to vehicle coordinates
202213
center_lidar = np.array([x, y, z, 1.0])
203214
center_vehicle = self.T_l2v @ center_lidar
@@ -213,19 +224,19 @@ def synchronized_callback(self, image_msg, lidar_msg):
213224
box.header.frame_id = 'velodyne'
214225
box.header.stamp = lidar_msg.header.stamp
215226

216-
if self.debug:
217-
print("X VEHICLE")
218-
print(x_vehicle)
219-
print("L")
220-
print(l)
221-
print("Y VEHICLE")
222-
print(y_vehicle)
223-
print("W")
224-
print(w)
225-
print("Z VEHICLE")
226-
print(z_vehicle)
227-
print("H")
228-
print(h)
227+
# if self.debug:
228+
# print("X VEHICLE")
229+
# print(x_vehicle)
230+
# print("L")
231+
# print(l)
232+
# print("Y VEHICLE")
233+
# print(y_vehicle)
234+
# print("W")
235+
# print(w)
236+
# print("Z VEHICLE")
237+
# print(z_vehicle)
238+
# print("H")
239+
# print(h)
229240

230241
# Set the pose (position and orientation)
231242
box.pose.position.x = float(x_vehicle)

GEMstack/onboard/perception/yolo_node.py

Lines changed: 27 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -433,6 +433,20 @@ def synchronized_callback(self, image_msg, lidar_msg):
433433
center = obb.center
434434
dims = tuple(obb.extent)
435435
R_lidar = obb.R.copy()
436+
437+
if self.debug:
438+
print("X")
439+
print(center[0])
440+
print("L")
441+
print(dims[0])
442+
print("Y")
443+
print(center[1])
444+
print("W")
445+
print(dims[1])
446+
print("Z")
447+
print(center[2])
448+
print("H")
449+
print(dims[2])
436450

437451
# Transform from LiDAR to vehicle coordinates
438452
center_hom = np.append(center, 1)
@@ -465,19 +479,19 @@ def synchronized_callback(self, image_msg, lidar_msg):
465479
box_msg.dimensions.y = float(dims[1]) # width
466480
box_msg.dimensions.z = float(dims[2]) # height
467481

468-
if self.debug:
469-
print("X")
470-
print(center_vehicle[0])
471-
print("L")
472-
print(dims[0])
473-
print("Y")
474-
print(center_vehicle[1])
475-
print("W")
476-
print(dims[1])
477-
print("Z")
478-
print(center_vehicle[2])
479-
print("H")
480-
print(dims[2])
482+
# if self.debug:
483+
# print("X")
484+
# print(center_vehicle[0])
485+
# print("L")
486+
# print(dims[0])
487+
# print("Y")
488+
# print(center_vehicle[1])
489+
# print("W")
490+
# print(dims[1])
491+
# print("Z")
492+
# print(center_vehicle[2])
493+
# print("H")
494+
# print(dims[2])
481495

482496
# Add confidence score and label
483497
box_msg.value = float(conf_scores[i])

0 commit comments

Comments
 (0)