98 lines
2.7 KiB
C++
98 lines
2.7 KiB
C++
#ifndef _LIVOX_GEN1_PCLOUD_STIMULUS_PRODUCER_H
|
|
#define _LIVOX_GEN1_PCLOUD_STIMULUS_PRODUCER_H
|
|
|
|
#include <functional>
|
|
#include <atomic>
|
|
#include <user/stimulusProducer.h>
|
|
#include <user/stimulusFrame.h>
|
|
#include <livoxProto1/device.h>
|
|
#include <asynchronousContinuation.h>
|
|
#include <callback.h>
|
|
#include <user/stagingBuffer.h>
|
|
#include "ioUringAssemblyEngine.h"
|
|
#include "openClCollatingAndMeshingEngine.h"
|
|
#include "meshStimulusBuffer.h"
|
|
#include "pcloudIStimulusBuffer.h"
|
|
#include "pcloudAmbienceStimulusBuffer.h"
|
|
|
|
namespace smo {
|
|
namespace stim_buff {
|
|
|
|
/**
|
|
* PcloudStimulusProducer is a specialized StimulusProducer for point cloud data.
|
|
*
|
|
* This class extends StimulusProducer to handle point cloud-specific stimulus
|
|
* frames, particularly those generated from LiDAR point cloud data. It
|
|
* provides additional functionality for managing point cloud frame metadata
|
|
* and processing.
|
|
*/
|
|
class PcloudStimulusProducer
|
|
: public StimulusProducer
|
|
{
|
|
public:
|
|
class PcloudFormatDesc
|
|
{
|
|
public:
|
|
enum class Format
|
|
{
|
|
XYZ,
|
|
XYZI,
|
|
};
|
|
|
|
public:
|
|
Format format;
|
|
};
|
|
|
|
public:
|
|
explicit PcloudStimulusProducer(
|
|
const std::shared_ptr<device::DeviceAttachmentSpec> &deviceAttachmentSpec,
|
|
std::shared_ptr<livoxProto1::Device> &device,
|
|
const PcloudFormatDesc& formatDesc,
|
|
size_t nDgramsPerStagingBufferFrame);
|
|
|
|
~PcloudStimulusProducer() = default;
|
|
|
|
// Non-copyable, movable
|
|
PcloudStimulusProducer(const PcloudStimulusProducer&) = delete;
|
|
PcloudStimulusProducer& operator=(const PcloudStimulusProducer&) = delete;
|
|
PcloudStimulusProducer(PcloudStimulusProducer&&) = default;
|
|
PcloudStimulusProducer& operator=(PcloudStimulusProducer&&) = default;
|
|
|
|
// Control methods
|
|
void start() override;
|
|
void stop() override;
|
|
|
|
std::shared_ptr<StimulusBuffer> getOrCreateAttachedStimulusBuffer(
|
|
const std::shared_ptr<device::DeviceAttachmentSpec>
|
|
&deviceAttachmentSpec,
|
|
int histbuffMs) override;
|
|
|
|
protected:
|
|
void stimFrameProductionTimesliceInd() override;
|
|
|
|
// Callback function type for produceFrameReq
|
|
typedef std::function<void()> produceFrameReqCbFn;
|
|
|
|
public:
|
|
void produceFrameReq(smo::Callback<produceFrameReqCbFn> callback);
|
|
|
|
std::shared_ptr<livoxProto1::Device> device;
|
|
PcloudFormatDesc formatDesc;
|
|
OpenClCollatingAndMeshingEngine openClCollatingAndMeshingEngine;
|
|
StagingBuffer assemblyBuffer;
|
|
IoUringAssemblyEngine ioUringAssemblyEngine;
|
|
StagingBuffer collationBuffer;
|
|
StimulusFrame tempStimulusFrame;
|
|
std::shared_ptr<MeshStimulusBuffer> meshStimulusBuffer;
|
|
std::shared_ptr<PcloudIStimulusBuffer> iStimulusBuffer;
|
|
std::shared_ptr<PcloudAmbienceStimulusBuffer> ambienceStimulusBuffer;
|
|
|
|
private:
|
|
class ProduceFrameReq;
|
|
};
|
|
|
|
} // namespace stim_buff
|
|
} // namespace smo
|
|
|
|
#endif // _LIVOX_GEN1_PCLOUD_STIMULUS_PRODUCER_H
|