3#include "RasterFrame.h"
4#include "RasterPointScanner/Headers/KeyFramePointRaster.hpp"
5#include "PointScanner/Headers/Scanner3D.h"
6#include "BlockModel/Headers/SegmentedBlockModel.h"
7#include "Design/Headers/Camera.h"
8#include "Base/Headers/Time.h"
9#include "Base/Headers/Pointer.hpp"
10#include "Base/Headers/Thread.h"
11#include "Base/Headers/INIInterface.h"
24 template<
class t_type,
class t_smooth_type>
25 class PointSmootherBlockFilter;
28 template<
class t_type>
31 template<
class t_type>
32 class ViewportPointSmoother;
81 class RASTER_POINT_SCANNER_API RasterScanner :
public Scanner3D
87 virtual ~RasterScanner();
88 virtual TimeSpan updateInterval()
const override;
89 void updateModel()
override;
90 void updateCameraModel();
91 virtual void startScan(
const Scanner3DScanSettings& settings)
override;
92 virtual void pauseScan()
override;
93 virtual void stopScan()
override;
94 virtual void resumeScan()
override;
95 virtual void createScanner()
override;
96 virtual bool isOrientationValid()
const;
100 Matrix<fltp08> spacialTransform()
const {
return m_spacial_transform; }
101 void setSLAMTransform(
const Matrix<fltp08>& matrix);
102 virtual void setIsNetworkServer(
bool is_server);
103 void startProcessingThreads();
104 [[nodiscard]]
virtual bool supportsState(ScannerState state)
const override;
105 void startTriggerScan(fltp08 step, fltp08 speed);
106 void setFilterSettings(
const FilterSettings& filter);
107 [[nodiscard]] FilterSettings filterSettings()
const;
108 [[nodiscard]]
uint04 meshBlendFactor()
const override {
return 1U; }
109 [[nodiscard]] Matrix<fltp08> scannerMatrix()
const override;
110 [[nodiscard]] Bounds<2, Angle<fltp08>> maxScanBounds()
const;
111 virtual Buffer<ScanProfile> availableScanProfiles()
const override;
112 virtual Bounds<2, Angle<fltp08>> scanBounds()
const override;
113 [[nodiscard]]
virtual OrientationSensor* orientationSensor()
const override;
114 void requestDisconnect()
override;
115 [[nodiscard]] [[nodiscard]]
virtual RangeSensor* rangeSensor()
const override;
116 [[nodiscard]]
virtual Matrix<fltp08> orientationAt(
const Time& time,
bool offset_with_station)
const;
117 [[nodiscard]] RasterInfo defaultRasterInfo(
const UUID&
id)
const override;
118 [[nodiscard]]
virtual Buffer<TemperatureSensor*> temperatureSensors()
const override;
119 [[nodiscard]]
virtual DistanceEncoder* distanceEncoder()
const override;
120 virtual void setSmoother(ViewportPointSmoother<ColorNormalNode>* smoother);
121 virtual void setupCameraModel();
122 void setIgnoreCameraSetup(
bool ignore);
123 bool snapViewportToScanner()
const override;
124 SegmentedBlockModel<ColorNormalOffsetNode>* createSegmentedBlockModel(fltp08 range, fltp08 step);
125 void invalidateTime();
126 void setPositionStation(
bool position_station);
127 void setLiveCloudVisible(
bool visible,
bool auto_toggle =
false);
128 void setCurrentPacket(
const RasterPacketInfo& packet);
129 bool getCurrentPacket(RasterPacketInfo& packet)
const;
131 virtual bool collectPoints() = 0;
132 void setToGPSPosition();
133 void updateSLAMVisuals();
134 void writeCalibrationYaml(fltp08 spacing)
const;
135 virtual void updateIOState() {}
136 virtual void setupFilters() {}
137 void showLiveCloud(
bool show_cloud);
138 void collectPointData(RasterFrame& frame);
139 bool finishActiveFrame();
140 void finishSmoothLogic();
141 void updateLiveDisplay();
142 virtual bool filterFrame(RasterFrame&) {
return true; }
143 virtual bool calculateColorsAndPositions(RasterFrame& frame);
144 virtual bool smoothPositions(RasterFrame& frame);
145 virtual bool performSLAM(RasterFrame& frame);
146 virtual bool addRecords(RasterFrame& frame);
147 void saveCalibrationData(RasterFrame& frame);
148 virtual Matrix<fltp08> scanModelFileTransform()
const override;
149 virtual void update(Time time)
override;
150 Matrix<fltp08> laserTransform(
const Vector<3, Angle<fltp08>>& head_angle)
const override;
151 [[nodiscard]] Matrix<fltp08> initialScanTransform()
const override;
152 virtual Matrix<fltp08> scanTransform()
const override;
154 void updateCamera(
const DynamicPointer<Camera>& camera);
155 bool processPipeline(ProcessStage stage);
156 ProcessStage nextProcessStage(ProcessStage current,
bool success)
const;
157 const VideoFrameDetails& colorFrameDetails()
const {
return m_color_frame_details; };
158 const VideoFrameDetails& depthFrameDetails()
const {
return m_depth_frame_details; };
159 const RasterFrame& activeFrame()
const {
return m_active_frame; };
162 virtual bool attemptConnection() {
return true; }
164 bool isAddingToScan()
const;
165 bool isAddingToLive()
const;
166 bool isDeploying()
const;
168 Time m_last_sound_time = Time(0);
169 RasterPacketInfo m_live_data;
170 RasterPacketInfo m_inactive_data;
171 VideoFrameDetails m_color_frame_details;
172 VideoFrameDetails m_depth_frame_details;
173 Matrix<fltp08> m_last_calculated_matrix = Constant<Matrix<fltp08>>::Invalid;
174 fltp04 m_depth_scale = 0.001f;
175 Matrix<fltp08> m_slam_calculated = Constant<Matrix<fltp08>>::Invalid;
178 fltp08 m_density = Constant<fltp08>::Invalid;
179 RasterFrame m_active_frame;
180 uint04 m_last_tracking_state = 0;
181 RasterFrame m_pending_slam_frame;
182 RasterFrame m_slam_process_frame;
183 FilterSettings m_filter_settings;
184 PointPipeline m_rs_pipeline;
185 PositionSensor* m_position_sensor =
nullptr;
186 ViewportPointSmoother<ColorNormalNode>* m_smoother =
nullptr;
187 FramePointScan* m_frame_scan =
nullptr;
188 PointSmootherBlockFilter<ColorNormalOffsetNode, ColorNormalNode>* m_block_filter =
nullptr;
189 DynamicPointer<Camera> m_camera_device;
190 OrientationSensor* m_orientation_sensor =
nullptr;
191 DistanceEncoder* m_distance_encoder =
nullptr;
192 OrbSLAM* m_slam_engine =
nullptr;
193 Matrix<fltp08> m_spacial_transform = Matrix<fltp08>(1.0);
194 Matrix<fltp08> m_slam_transform = Constant<Matrix<fltp08>>::Invalid;
195 SegmentedBlockModel<ColorNormalOffsetNode>* m_segmented_block_model =
nullptr;
196 Model* m_live_model =
nullptr;
197 Model* m_inactive_model =
nullptr;
198 ColorPositionShaderLogic* m_color_position_shader =
nullptr;
199 Thread* m_pipeline_threads[ProcessStage::e_stage_size];
200 Bounds<1, fltp04> m_laser_range;
201 Time m_frame_offset_time = Constant<Time>::Invalid;
202 Time m_last_rx_time = Time(0U);
203 uint04 m_trigger_count = 0;
205 uint04 m_active_slam_map = Constant<uint04>::Invalid;
206 uint04 m_slam_process_count = 0;
207 uint04 m_collection_process_count = 0;
208 Dictionary<uint04, Matrix<fltp08>> m_slam_map_transforms;
209 mutable bool m_has_packet_data =
false;
210 bool m_perform_calibration =
false;
211 bool m_auto_reduce =
true;
212 bool m_add_to_grid =
false;
213 bool m_use_imu_for_slam =
false;
214 bool m_has_camera =
false;
215 bool m_is_init =
false;
216 bool m_has_scan_data =
false;
217 bool m_ignore_camera_setup =
false;
218 bool m_are_cameras_snapped =
false;
219 bool m_live_display =
false;
220 bool m_is_network_server =
false;
221 bool m_has_live_data =
false;
222 bool m_request_slam_reset =
false;
223 bool m_is_trigger_scan =
false;
224 bool m_is_remote =
false;
225 bool m_position_station =
true;
226 bool m_auto_toggle_live_display =
true;
227 bool m_show_keyframe_display =
true;
228 bool m_show_keypoint_display =
true;
229 bool m_show_live_display =
true;
230 bool m_show_raw_cloud =
true;
231 bool m_use_camera_model_frames =
false;
232 bool m_needs_keyframe_raster_update =
false;
A device which has an associated voltage or percent that changes.
The equivelent of std::vector but with a bit more control.
GPU compute shader that converts depth and color raster frames into 3D colored point positions.
A core class where all Design Objects including models, materials, and geometries are stored.
A light-weight wrapper that will be a no-op if there is not a valid log reference,...
Serves as the primary program interface for processes to report issues and allows any number of LogSt...
Used to calculate madgick orientation given sensor streams for gyro and optionally magnetometer(s) an...
Templated logic for doing matrix multiplication.
A core class that represents a node on model hierarchy.
Main entry point for the ORB-SLAM3 system.
Forward declaration for distance encoder device.
A RangeSensor is a Device that determines the distance of a target at a certain orientation.
Provides logic to perform SLAM on an object.
Configuration parameters for the ORB-SLAM system.
A Model subclass providing a segmented spatial block model over a bounded region.
The core String class for the NDEVR API.
Stores a time span, or difference between two times, with an optional start time.
Represents a timestamp with utilities for manipulation and conversion.
A universally unique identifier (UUID) is a 128-bit number used to identify information in computer s...
The primary namespace for the NDEVR SDK.
float fltp04
Defines an alias representing a 4 byte floating-point number Bit layout is as follows: -Sign: 1 bit a...
uint64_t uint08
-Defines an alias representing an 8 byte, unsigned integer
uint32_t uint04
-Defines an alias representing a 4 byte, unsigned integer -Can represent exact integer values 0 throu...
double fltp08
Defines an alias representing an 8 byte floating-point number.
int16_t sint02
-Defines an alias representing a 2 byte, signed integer.
uint8_t uint01
-Defines an alias representing a 1 byte, unsigned integer -Can represent exact integer values 0 throu...
CollectionMode
The operating mode for raster point collection, controlling power usage and data type.
ProcessStage
Processing stage within the raster point pipeline.
Defines for a given type (such as sint04, fltp08, UUID, etc) a maximum, minimum, and reserved 'invali...
A FileRequest bundles format data as well as a particular file.
Settings that control spatial and density filtering of scanned point data.
fltp08 scan_range_from_origin
Maximum range from the scan origin.
uint08 scan_density_cuttoff
Minimum point density per voxel.
A ring buffer of RasterFrames used to pipeline raster point processing across multiple stages.
String id
Identifier for this pipeline.
RasterFrame frames[s_pipeline_frame_count]
Ring buffer of frames.
static constexpr uint04 s_pipeline_frame_count
Number of pipeline slots.
A single frame of raster depth/color data along with processing state and metadata.
Packet of colored point data sent from the raster scanner for live and inactive display.
uint01 packet_num
Sequence number for ordering packets.
sint02 gyro_status
Gyro calibration status (0=uncalibrated, max=calibrated, negative=error).
Buffer< RGBColor > inactive_color_data
Recorded (inactive) point colors.
UUID scanner_id
UUID of the source scanner.
Matrix< fltp08 > mat
Transform matrix for the packet.
Time frame_time
Timestamp of the packet.
void clear()
Clear all point data buffers.
Buffer< Vertex< 3, fltp04 > > active_point_data
Live display point positions.
Buffer< RGBColor > active_color_data
Live display point colors.
Buffer< Vertex< 3, fltp04 > > inactive_point_data
Recorded (inactive) point positions.