NDEVR
API Documentation
JorvikTotalStation.h
1#pragma once
2#include "DLLInfo.h"
3#include "JorvikConnection.h"
4#include "Collimator.h"
5#include <NDEVR/Scanner3D.h>
6#include <NDEVR/ApplicationOptions.h>
7#include <NDEVR/Matrix.h>
8#include <NDEVR/Time.h>
9#include <NDEVR/Scene.h>
10#include <NDEVR/TranslatedString.h>
11#include <NDEVR/Pointer.h>
12#include <NDEVR/Thread.h>
13#include <NDEVR/INIInterface.h>
14#include <NDEVR/ApplicationResource.h>
15#include <NDEVR/NDEVRChartModel.h>
16#include <QPointer>
17
18struct JorvikData;
19namespace NDEVR
20{
21
22 class PointMeasureModel;
23 struct FileRequest;
25 class Log;
26 class CarlsonScannerOrientation;
27 class CarlsonScannerConnection;
28 class CarlsonScannerBattery;
29 class CarlsonScannerMotor;
30 class PositionSensor;
31 class SocketIOChannel;
32 class CalibrationData;
40 class JorvikTotalStation final : public Scanner3D, public INIInterface
41 {
42 public:
49 JorvikTotalStation(JorvikConnection* connection, DesignObjectLookup* manager, QObject* parent = nullptr);
50
55
60 bool isConnected() const override;
61
62 // Children Sensors
63 [[nodiscard]] virtual Light* light() const final override;
64 [[nodiscard]] virtual Light* redDot() const final override;
65 [[nodiscard]] virtual OrientationSensor* orientationSensor() const final override;
66 [[nodiscard]] virtual Connection* connection() const final override;
67 [[nodiscard]] virtual PositionSensor* positionSensor() const final override;
68 [[nodiscard]] virtual RangeSensor* rangeSensor() const final override;
69 [[nodiscard]] virtual TranslatedString scannerInfo() const final override;
70 [[nodiscard]] virtual Buffer<Battery*> batteries() const final override;
71 [[nodiscard]] virtual Buffer<TemperatureSensor*> temperatureSensors() const final override;
72 [[nodiscard]] virtual DistanceEncoder* distanceEncoder() const final override;
73
78 void setConstantLaserFire(bool constant_fire);
79
84 void setModelFile(const File& file);
85
86 // Scanner method implementations
87 virtual void endUpdates() override;
88 virtual void startScan(const Scanner3DScanSettings& settings) final override;
89 virtual RangeSensor* createRangeSensor() final override;
90 virtual void stopScan() final override;
91 virtual void pauseScan() final override;
92 virtual void resumeScan() final override;
93 virtual void createScanner() final override;
94
99
108 void addGridOrientation(sint04 range_pitch, sint04 range_roll, const Angle<fltp08>& step_pitch, const Angle<fltp08>& step_roll, const Angle<fltp08>& offset);
109
114
119
124
129 void orientHead(const Vector<3, Angle<fltp08>>& head_orientation) final override;
130
136 bool executeManualCommand(const String& command) final override;
137
138 [[nodiscard]] virtual bool supportsState(ScannerState state) const final override;
139 [[nodiscard]] virtual TimeSpan updateInterval() const final override;
140 [[nodiscard]] virtual TimeSpan getScanTime(const Scanner3DScanSettings& settings) const final override;
141 [[nodiscard]] bool useCalibratedScan() const final override;
142 [[nodiscard]] ScannerState scannerState() const final override;
143 [[nodiscard]] virtual bool supportsScanImageRaster() const final override;
144 [[nodiscard]] virtual RasterInfo defaultRasterInfo(const UUID& profile) const final override;
145 [[nodiscard]] virtual Buffer<ScanProfile> availableScanProfiles() const final override;
146 [[nodiscard]] Bounds<2, Angle<fltp08>> scanBounds() const final override;
147 [[nodiscard]] virtual Matrix<fltp08> cameraTransform() const final override;
148 [[nodiscard]] virtual bool usingPrism() const override;
149
155
161
167
173
178 virtual void getINI(INIFactory& factory) override;
179
180 protected:
181 virtual FileRequest scanModelFile() const override;
184 virtual void update(Time time) override;
185 void onConnectedUpdate(const Time& current);
187 void processData(Time time, const JorvikData& data);
188 void parkDevice() override;
191 void initMotors();
192 Matrix<fltp08> laserTransform(const Vector<3, Angle<fltp08>>& head_angle) const override;
193 virtual Matrix<fltp08> scanTransform() const override;
194 Vector<3, Angle<fltp08>> pointToHeadAngle(Vertex<3, fltp08> point) const override;
196 void initCharts();
200 private:
201 void setScanProfile(const Scanner3DScanSettings& settings);
202 public:
203 // Static application options
213
214 protected:
215 // Member variables
226 Buffer<CollimatorReading> m_collimator_readings;
231
232 // Hardware components
233 JorvikConnection* m_connection;
234 PointMeasureModel* m_measure_model;
237 CalibrationData* m_calibration_data;
241 Light* m_red_dot = nullptr;
244
245 // Options
246 bool m_use_gnss = false;
249 bool m_collimator_test = false;
250 bool m_manual_step = false;
251 bool m_has_removed_bulb = false;
252 bool m_manually_drive = false;
253 bool m_infinite_test = false;
263 };
264}
Stores an angle in an optimized internal format with support for efficient trigonometric operations.
Definition Angle.h:83
The default object to store data of any type that should persist through sessions of the application.
A device which has an associated voltage or percent that changes.
Definition Battery.h:106
A specification of upper and lower bounds in N-dimensions.
Definition Bounds.hpp:54
The equivelent of std::vector but with a bit more control.
Definition Buffer.hpp:58
A core object representing a user view as well as convenience functions for moving this view through ...
Definition Camera.h:95
A standard interface for all types of connections that allow transmitting and receiving of data betwe...
Definition Connection.h:316
A core class where all Design Objects including models, materials, and geometries are stored.
A distance encoder is a device that measures distance by generating pulses in response to an object's...
Provides a modifiable pointer that has shared ownership of a dynamically allocated object.
Definition Pointer.hpp:356
Logic for reading or writing to a file as well as navigating filesystems or other common file operati...
Definition File.h:53
Contains methods for easily reading and writing to an INI file including efficient casting,...
Definition INIReader.h:107
INIInterface()
Constructs an INIInterface with no default INI file.
UUID m_scan_profile
Scan profile UUID.
virtual DistanceEncoder * distanceEncoder() const final override
Retrieves the distance encoder.
bool isConnected() const override
Checks if the total station is connected.
virtual Connection * connection() const final override
Retrieves the connection instance.
Buffer< Model > m_model_targets
Buffer of model targets.
void onConnectedUpdate(const Time &current)
Handles updates when the scanner is connected.
static ApplicationOption< Angle< fltp08 > > compensator_to_encoder_offset_roll
Compensator-to-encoder offset for roll.
void addReverseOrientation()
Adds a reverse orientation to the scanner.
static ApplicationOption< Angle< fltp08 > > encoder_angle_offset_roll
Encoder angle offset for roll.
ScannerState scannerState() const final override
Retrieves the current state of the scanner.
virtual RangeSensor * createRangeSensor() final override
Creates a range sensor.
PointMeasureModel * m_measure_model
Measurement model for the scanner.
virtual Light * redDot() const final override
Retrieves the red dot light sensor.
virtual RangeSensor * rangeSensor() const final override
Retrieves the range sensor.
uint04 m_measure_initial_size
Initial size for measurements.
Buffer< CollimatorReading > m_collimator_readings
Buffer of collimator readings.
Vector< 2, Angle< fltp08 > > m_raw_compensator
Raw compensator angles.
void processMessages(Time time)
Processes incoming messages.
fltp08 m_max_range
Maximum range of the scanner.
fltp08 calculateDistance()
Calculates the distance to a target.
void saveDeviations(File file)
Saves deviation data to a file.
Vector< 3, Angle< fltp08 > > pointToHeadAngle(Vertex< 3, fltp08 > point) const override
Converts a point to a head angle.
bool m_use_gnss
Indicates if GNSS is used.
void addGridOrientation(sint04 range_pitch, sint04 range_roll, const Angle< fltp08 > &step_pitch, const Angle< fltp08 > &step_roll, const Angle< fltp08 > &offset)
Adds a grid orientation to the scanner.
PositionSensor * m_position_sensor
Position sensor for the scanner.
JorvikTotalStation(JorvikConnection *connection, DesignObjectLookup *manager, QObject *parent=nullptr)
Constructor for the JorvikTotalStation.
virtual bool supportsState(ScannerState state) const final override
Checks if the scanner supports a specific state.
Bounds< 2, Angle< fltp08 > > scanBounds() const final override
Retrieves the scan bounds.
void recordDeviation()
Records deviation data.
DynamicPointer< Camera > m_camera_model
Camera model for the scanner.
bool m_has_removed_bulb
Indicates if the bulb has been removed.
bool m_collimator_test
Indicates if a collimator test is active.
Model m_camera_target_model
Target model for the camera.
virtual TimeSpan updateInterval() const final override
Retrieves the update interval for the scanner.
virtual OrientationSensor * orientationSensor() const final override
Retrieves the orientation sensor.
virtual void createScanner() final override
Creates the scanner instance.
virtual void startScan(const Scanner3DScanSettings &settings) final override
Starts a scan with the given settings.
virtual bool usingPrism() const override
Checks if the scanner is using a prism.
virtual Matrix< fltp08 > scanTransform() const override
Retrieves the scan transformation matrix.
NDEVRChartModel * m_deviation_chart_model[2]
Chart models for deviation data.
void initCameraModel()
Initializes the camera model.
static ApplicationOption< bool > calculate_motor_offset
Option to calculate motor offset.
virtual RasterInfo defaultRasterInfo(const UUID &profile) const final override
Retrieves the default raster info for a given profile.
void setModelFile(const File &file)
Sets the model file for the total station.
Vertex< 3, fltp08 > targetPosition() const
Retrieves the target position of the scanner.
void checkScanStep()
Checks the current scan step.
Vector< 2, Angle< fltp08 > > m_motor_offset
Motor offset calibration values.
void initCharts()
Initializes the chart models.
fltp08 m_chart_offset_time
Offset time for charts.
Matrix< fltp08 > scanModelFileTransform() const override
Retrieves the transformation matrix for the scan model file.
virtual void resumeScan() final override
Resumes the paused scan.
Scene m_measurement_points
Scene for measurement points.
bool useCalibratedScan() const final override
Checks if the scanner uses calibrated scans.
virtual void getINI(INIFactory &factory) override
Reads INI settings into the factory.
virtual Buffer< TemperatureSensor * > temperatureSensors() const final override
Retrieves the list of temperature sensors.
void recordLocation()
Records the current location of the scanner.
Time m_last_head_move_time
Last move time for the scanner head.
virtual void stopScan() final override
Stops the current scan.
void initMotors()
Initializes the scanner motors.
bool executeManualCommand(const String &command) final override
Executes a manual command on the scanner.
void addModelsToScan()
Adds models to the scan.
static ApplicationOption< Angle< fltp08 > > encoder_angle_offset_pitch
Encoder angle offset for pitch.
CalibrationData * m_calibration_data
Calibration data for the scanner.
void setConstantLaserFire(bool constant_fire)
Enables or disables constant laser firing.
virtual TranslatedString scannerInfo() const final override
Retrieves scanner information.
fltp08 chartTime()
Retrieves the current chart time.
String defaultCameraFeed()
Retrieves the default camera feed.
static ApplicationOption< String > connection_address
Connection address for the scanner.
virtual void update(Time time) override
Updates the scanner state.
File m_model_file
Model file for the scanner.
virtual bool supportsScanImageRaster() const final override
Checks if the scanner supports image raster scanning.
static ApplicationOption< Angle< fltp08 > > motor_epsilon
Motor epsilon value.
NDEVRChartModel * m_angle_chart_model[2]
Chart models for angle data.
static ApplicationOption< Angle< fltp08 > > compensator_offset_pitch
Compensator offset for pitch.
TranslatedString m_test_name
Name of the current test.
void processData(Time time, const JorvikData &data)
Processes incoming data.
void parkDevice() override
Parks the scanner device.
Time m_last_settings_time
Last update time for settings.
bool m_manually_drive
Indicates if manual driving is enabled.
NDEVRChartModel * m_orientation_chart_model[2]
Chart models for orientation data.
virtual Matrix< fltp08 > cameraTransform() const final override
Retrieves the camera transformation matrix.
TimeSpan m_reading_wait_time
Wait time for readings.
virtual void endUpdates() override
Ends updates for the scanner.
virtual Light * light() const final override
Retrieves the light sensor.
void addDataToChartModel()
Adds data to the chart model.
Time m_last_angle_update_time
Last update time for angles.
Light * m_red_dot
Red dot light for the scanner.
virtual Buffer< Battery * > batteries() const final override
Retrieves the list of batteries.
Time m_last_compensator_update_time
Last update time for the compensator.
Buffer< Vector< 2, Angle< fltp08 > > > m_angle_targets
Buffer of angle targets.
void orientHead(const Vector< 3, Angle< fltp08 > > &head_orientation) final override
Orients the scanner head to the specified orientation.
static ApplicationOption< Angle< fltp08 > > compensator_offset_roll
Compensator offset for roll.
Time m_last_distance_update_time
Last update time for distance.
Matrix< fltp08 > laserTransform(const Vector< 3, Angle< fltp08 > > &head_angle) const override
Retrieves the laser transformation matrix.
bool m_manual_step
Indicates if manual stepping is enabled.
Scene m_chart_scene
Scene for chart data.
Time m_last_head_update_time
Last update time for the scanner head.
virtual PositionSensor * positionSensor() const final override
Retrieves the position sensor.
virtual FileRequest scanModelFile() const override
Retrieves the scan model file.
~JorvikTotalStation()
Destructor for the JorvikTotalStation.
virtual Buffer< ScanProfile > availableScanProfiles() const final override
Retrieves the available scan profiles.
Vector< 2, Angle< fltp08 > > m_motor_target
Motor target angles.
DistanceEncoder * m_distance_encoder
Distance encoder for the scanner.
virtual void pauseScan() final override
Pauses the current scan.
Vector< 2, Angle< fltp08 > > m_current_target
Current target angles.
bool m_auto_update_model
Indicates if the model is auto-updated.
bool m_constant_laser_fire
Indicates if constant laser firing is enabled.
void recordChartDeviation()
Records deviation data for charts.
void initMeasureModel()
Initializes the measurement model.
JorvikConnection * m_connection
Connection to the scanner.
virtual TimeSpan getScanTime(const Scanner3DScanSettings &settings) const final override
Calculates the scan time for the given settings.
static ApplicationOption< Angle< fltp08 > > compensator_to_encoder_offset_pitch
Compensator-to-encoder offset for pitch.
OrientationSensor * m_orientation
Orientation sensor for the scanner.
Vector< 2, Angle< fltp08 > > m_raw_angles
Raw angles from the scanner.
bool m_infinite_test
Indicates if an infinite test is active.
Matrix< fltp08 > prismModelFileTransform() const override
Retrieves the transformation matrix for the prism model file.
A Device responsible for turning on and off a light source.
Definition Light.h:44
Serves as the primary program interface for processes to report issues and allows any number of LogSt...
Definition Log.h:50
Used to calculate madgick orientation given sensor streams for gyro and optionally magnetometer(s) an...
Templated logic for doing matrix multiplication.
Definition Matrix.hpp:182
A core class that represents a node on model hierarchy.
Definition Model.h:292
A Model subclass that provides charting and data visualization capabilities.
Forward declaration for design object lookup service.
Forward declaration for distance encoder device.
A RangeSensor is a Device that determines the distance of a target at a certain orientation.
Definition RangeSensor.h:52
The root Model that is responsible for storing the underlying data for all Scene Models.
Definition Scene.h:52
A specific channel of communication within the SocketIO framework.
The core String class for the NDEVR API.
Definition String.h:95
A Device responsible for determining the temperature of either the environment or a specific componen...
Stores a time span, or difference between two times, with an optional start time.
Definition TimeSpan.h:46
Represents a timestamp with utilities for manipulation and conversion.
Definition Time.h:62
Any text displayed to the user should be defined as a TranslatedString which allows the program to lo...
A universally unique identifier (UUID) is a 128-bit number used to identify information in computer s...
Definition UUID.h:61
A fixed-size array with N dimensions used as the basis for geometric and mathematical types.
Definition Vector.hpp:62
A point in N-dimensional space, used primarily for spatial location information.
Definition Vertex.hpp:44
The primary namespace for the NDEVR SDK.
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.
int32_t sint04
-Defines an alias representing a 4 byte, signed integer.
@ file
The source file path associated with this object.
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.
Definition FileFormat.h:101
Stores information for painting pixels at a time into a 2D texture used with MaterialRaster.