You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Sorry for the late reply. You can use a LiDAR-based 3D detector (such as the model in OpenPCDet) and then publish the detection results using ROS. The code is as follows:
from std_msgs.msg import Float64MultiArray
from sensor_msgs.msg import PointCloud2
import ros_numpy
# publisher
detect3d_pub = rospy.Publisher("/detect3d", Float64MultiArray)
# specify your detector
detector = YOUR_DETECTOR()
def get_boxes(databin):
result = detector.detect(databin) # [[type, x, y, z, l, w, h, yaw, score], ...,[type, x, y, z, l, w, h, yaw, score]]
return result
def Callback_pcvelo(msg):
assert isinstance(msg, PointCloud2)
# receive pointcloud data
points = ros_numpy.numpify(msg)
frame_timestamp = msg.header.stamp.to_sec()
# get detection results
result = np.array(get_boxes(points))
result_1d = np.array(result).reshape(-1)
data_send = np.array([frame_timestamp] + list(result_1d)) # [timestamp, [type, x, y, z, l, w, h, yaw, score], ...,[type, x, y, z, l, w, h, yaw, score]]
# publish detection results
detect3d_pub.publish(Float64MultiArray(data=data_send))
if __name__ == "__main__":
# subscribe to the point cloud topic
sub_pcvelo = rospy.Subscriber("velodyne_points", PointCloud2, Callback_pcvelo)
rospy.spin()
No description provided.
The text was updated successfully, but these errors were encountered: