@@ -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 )
0 commit comments