diff --git a/nebula_hw_interfaces/src/nebula_hesai_hw_interfaces/hesai_hw_interface.cpp b/nebula_hw_interfaces/src/nebula_hesai_hw_interfaces/hesai_hw_interface.cpp index e71366831..f5815fc40 100644 --- a/nebula_hw_interfaces/src/nebula_hesai_hw_interfaces/hesai_hw_interface.cpp +++ b/nebula_hw_interfaces/src/nebula_hesai_hw_interfaces/hesai_hw_interface.cpp @@ -178,11 +178,9 @@ void HesaiHwInterface::ReceiveCloudPacketCallback(const std::vector & b PrintDebug("Invalid Packet: " + std::to_string(buffer.size())); return; } - uint32_t buffer_size = buffer.size(); - std::array packet_data{}; - std::copy_n(std::make_move_iterator(buffer.begin()), buffer_size, packet_data.begin()); + const uint32_t buffer_size = buffer.size(); pandar_msgs::msg::PandarPacket pandar_packet; - pandar_packet.data = packet_data; + std::copy_n(std::make_move_iterator(buffer.begin()), buffer_size, pandar_packet.data.begin()); pandar_packet.size = buffer_size; auto now = std::chrono::system_clock::now(); auto now_secs = std::chrono::duration_cast(now.time_since_epoch()).count(); diff --git a/nebula_hw_interfaces/src/nebula_velodyne_hw_interfaces/velodyne_hw_interface.cpp b/nebula_hw_interfaces/src/nebula_velodyne_hw_interfaces/velodyne_hw_interface.cpp index 6bc174660..f9df2840f 100644 --- a/nebula_hw_interfaces/src/nebula_velodyne_hw_interfaces/velodyne_hw_interface.cpp +++ b/nebula_hw_interfaces/src/nebula_velodyne_hw_interfaces/velodyne_hw_interface.cpp @@ -64,15 +64,13 @@ Status VelodyneHwInterface::RegisterScanCallback( void VelodyneHwInterface::ReceiveCloudPacketCallback(const std::vector & buffer) { // Process current packet - uint32_t buffer_size = buffer.size(); - std::array packet_data{}; - std::copy_n(std::make_move_iterator(buffer.begin()), buffer_size, packet_data.begin()); + const uint32_t buffer_size = buffer.size(); velodyne_msgs::msg::VelodynePacket velodyne_packet; + std::copy_n(std::make_move_iterator(buffer.begin()), buffer_size, velodyne_packet.data.begin()); auto now = std::chrono::system_clock::now(); auto now_secs = std::chrono::duration_cast(now.time_since_epoch()).count(); auto now_nanosecs = std::chrono::duration_cast(now.time_since_epoch()).count(); - velodyne_packet.data = packet_data; velodyne_packet.stamp.sec = static_cast(now_secs); velodyne_packet.stamp.nanosec = static_cast(now_nanosecs % 1'000'000'000); scan_cloud_ptr_->packets.emplace_back(velodyne_packet);