2025-11-14 19:24:31 -04:00
|
|
|
#ifndef _LIVOX_GEN1_PCLOUD_DATA_PRODUCER_H
|
|
|
|
|
#define _LIVOX_GEN1_PCLOUD_DATA_PRODUCER_H
|
2025-10-25 19:28:18 -04:00
|
|
|
|
2025-11-01 04:14:07 -04:00
|
|
|
#include <functional>
|
2025-11-14 19:24:31 -04:00
|
|
|
#include <atomic>
|
2025-11-14 19:50:51 -04:00
|
|
|
#include <user/stimulusProducer.h>
|
2025-10-25 23:04:59 -04:00
|
|
|
#include <livoxProto1/device.h>
|
2025-11-01 04:14:07 -04:00
|
|
|
#include <asynchronousContinuation.h>
|
|
|
|
|
#include <callback.h>
|
2025-10-30 00:39:34 -04:00
|
|
|
#include "stagingBuffer.h"
|
2025-10-30 19:07:19 -04:00
|
|
|
#include "ioUringAssemblyEngine.h"
|
2025-11-08 12:20:21 -04:00
|
|
|
#include "openClCollatingAndMeshingEngine.h"
|
2025-10-25 19:28:18 -04:00
|
|
|
|
|
|
|
|
namespace smo {
|
|
|
|
|
namespace stim_buff {
|
|
|
|
|
|
|
|
|
|
/**
|
2025-11-14 19:50:51 -04:00
|
|
|
* PcloudDataProducer is a specialized StimulusProducer for point cloud data.
|
2025-10-25 19:28:18 -04:00
|
|
|
*
|
2025-11-14 19:50:51 -04:00
|
|
|
* This class extends StimulusProducer to handle point cloud-specific stimulus
|
2025-10-25 19:28:18 -04:00
|
|
|
* frames, particularly those generated from LiDAR point cloud data. It
|
|
|
|
|
* provides additional functionality for managing point cloud frame metadata
|
|
|
|
|
* and processing.
|
|
|
|
|
*/
|
2025-11-14 19:24:31 -04:00
|
|
|
class PcloudDataProducer
|
2025-11-14 19:50:51 -04:00
|
|
|
: public StimulusProducer
|
2025-10-25 19:28:18 -04:00
|
|
|
{
|
|
|
|
|
public:
|
2025-11-14 19:24:31 -04:00
|
|
|
explicit PcloudDataProducer(
|
2025-11-04 00:46:07 -04:00
|
|
|
const std::shared_ptr<device::DeviceAttachmentSpec> &deviceAttachmentSpec,
|
2025-10-25 23:04:59 -04:00
|
|
|
std::shared_ptr<livoxProto1::Device> &device,
|
2025-10-30 00:39:34 -04:00
|
|
|
const PcloudFormatDesc& formatDesc,
|
2025-11-01 01:35:29 -04:00
|
|
|
int histbuffMs,
|
2025-10-31 12:22:07 -04:00
|
|
|
size_t nDgramsPerStagingBufferFrame);
|
2025-10-25 19:42:48 -04:00
|
|
|
|
2025-11-14 19:24:31 -04:00
|
|
|
~PcloudDataProducer() = default;
|
2025-10-25 19:28:18 -04:00
|
|
|
|
|
|
|
|
// Non-copyable, movable
|
2025-11-14 19:24:31 -04:00
|
|
|
PcloudDataProducer(const PcloudDataProducer&) = delete;
|
|
|
|
|
PcloudDataProducer& operator=(const PcloudDataProducer&) = delete;
|
|
|
|
|
PcloudDataProducer(PcloudDataProducer&&) = default;
|
|
|
|
|
PcloudDataProducer& operator=(PcloudDataProducer&&) = default;
|
2025-10-25 19:32:10 -04:00
|
|
|
|
2025-11-01 22:03:28 -04:00
|
|
|
// Control methods
|
|
|
|
|
void start() override;
|
|
|
|
|
void stop() override;
|
|
|
|
|
|
2025-10-31 13:54:50 -04:00
|
|
|
protected:
|
|
|
|
|
void stimFrameProductionTimesliceInd() override;
|
|
|
|
|
|
2025-11-10 01:02:06 -04:00
|
|
|
// Callback function type for produceFrameReq
|
|
|
|
|
typedef std::function<void()> produceFrameReqCbFn;
|
2025-11-01 04:14:07 -04:00
|
|
|
|
2025-10-25 23:04:59 -04:00
|
|
|
public:
|
2025-11-10 01:02:06 -04:00
|
|
|
void produceFrameReq(smo::Callback<produceFrameReqCbFn> callback);
|
2025-11-01 04:14:07 -04:00
|
|
|
|
2025-10-25 23:04:59 -04:00
|
|
|
std::shared_ptr<livoxProto1::Device> device;
|
2025-10-25 19:32:10 -04:00
|
|
|
PcloudFormatDesc formatDesc;
|
2025-11-08 12:20:21 -04:00
|
|
|
OpenClCollatingAndMeshingEngine openClCollatingAndMeshingEngine;
|
2025-11-06 14:09:10 -04:00
|
|
|
StagingBuffer assemblyBuffer;
|
2025-10-30 19:07:19 -04:00
|
|
|
IoUringAssemblyEngine ioUringAssemblyEngine;
|
2025-11-07 22:07:27 -04:00
|
|
|
StagingBuffer collationBuffer;
|
2025-11-14 19:24:31 -04:00
|
|
|
std::atomic<size_t> nAttachedStimBuffs{0};
|
2025-11-01 04:14:07 -04:00
|
|
|
|
|
|
|
|
private:
|
2025-11-10 01:02:06 -04:00
|
|
|
class ProduceFrameReq;
|
2025-10-25 19:28:18 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
} // namespace stim_buff
|
|
|
|
|
} // namespace smo
|
|
|
|
|
|
2025-11-14 19:24:31 -04:00
|
|
|
#endif // _LIVOX_GEN1_PCLOUD_DATA_PRODUCER_H
|