NDEVR
API Documentation
RangeSensor.h
1/*--------------------------------------------------------------------------------------------
2Copyright (c) 2019, NDEVR LLC
3tyler.parke@ndevr.org
4 __ __ ____ _____ __ __ _______
5 | \ | | | __ \ | ___|\ \ / / | __ \
6 | \ | | | | \ \ | |___ \ \ / / | |__) |
7 | . \| | | |__/ / | |___ \ V / | _ /
8 | |\ |_|_____/__|_____|___\_/____| | \ \
9 |__| \__________________________________| \__\
10
11Subject to the terms of the Enterprise+ Agreement, NDEVR hereby grants
12Licensee a limited, non-exclusive, non-transferable, royalty-free license
13(without the right to sublicense) to use the API solely for the purpose of
14Licensee's internal development efforts to develop applications for which
15the API was provided.
16
17The above copyright notice and this permission notice shall be included in all
18copies or substantial portions of the Software.
19
20THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
21INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
22PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
23FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
24OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
25DEALINGS IN THE SOFTWARE.
26
27Library: Hardware
28File: RangeSensor
29Included in API: True
30Author(s): Tyler Parke
31 *-----------------------------------------------------------------------------------------**/
32#pragma once
33#include <NDEVR/Device.h>
34namespace NDEVR
35{
45
51 class HARDWARE_API RangeSensor : public Device
52 {
53 Q_OBJECT
54 public:
59 RangeSensor(const Model& name, LogPtr log, QObject* parent = nullptr);
65 RangeSensor(const Angle<fltp08>& fov, const Model& name, LogPtr log, QObject* parent = nullptr);
71 RangeSensor(const Vector<2, Angle<fltp08>>& fov, const Model& name, LogPtr log, QObject* parent = nullptr);
74 virtual bool activated() const { return m_is_activated; };
77 [[nodiscard]] virtual fltp08 intensity() const { return m_intensity; }
80 [[nodiscard]] virtual fltp08 distance() const { return m_distance; }
83 [[nodiscard]] virtual bool lowVisibilityMode() const { return m_low_visibility_mode; }
86 virtual void setLowVisibilityMode(bool low_visibility) { m_low_visibility_mode = low_visibility; }
89 [[nodiscard]] virtual bool supportsLowVisibilityMode() const { return false; }
98 [[nodiscard]] virtual bool supportsSetActivated() const { return false; }
101 virtual void setActivated(bool is_active) { m_is_activated = is_active; }
104 virtual void createModel(const RGBColor& color);
107 virtual void createLineModel(const RGBColor& color);
110 virtual void createFanModel(const RGBColor& color);
112 virtual void updateModel();
115 virtual void createMaterial(const RGBColor& color);
120 virtual void measureDistance() {}
121 protected:
123 void init();
124 protected:
131 };
132}
Stores an angle in an optimized internal format with support for efficient trigonometric operations.
Definition Angle.h:83
Device(const Model &model, LogPtr log, QObject *parent=nullptr)
Constructs a Device from a Model with the given log and optional Qt parent.
A light-weight wrapper that will be a no-op if there is not a valid log reference,...
A core class that represents a node on model hierarchy.
Definition Model.h:292
Represents a color in the RGB space with optional alpha transparency.
Definition RGBColor.h:57
RangeSensorType rangeSensorType()
Returns the type of this range sensor.
RangeSensor(const Angle< fltp08 > &fov, const Model &name, LogPtr log, QObject *parent=nullptr)
Constructs a RangeSensor with a single-axis field of view.
bool m_is_activated
Whether the range sensor is currently activated.
RangeSensor(const Model &name, LogPtr log, QObject *parent=nullptr)
Constructs a RangeSensor with the given model, log, and optional parent.
virtual void updateModel()
Updates the 3D visualization model to reflect the current sensor state.
virtual bool lowVisibilityMode() const
Returns whether low visibility mode is currently enabled.
Definition RangeSensor.h:83
virtual bool activated() const
Returns whether this range sensor is currently activated.
Definition RangeSensor.h:74
virtual void setLowVisibilityMode(bool low_visibility)
Enables or disables low visibility mode for challenging environmental conditions.
Definition RangeSensor.h:86
virtual void createLineModel(const RGBColor &color)
Creates a line-style 3D visualization model for this sensor.
virtual void setDistance(fltp08 distance)
Sets the measured distance value.
Definition RangeSensor.h:95
virtual void measureDistance()
Triggers a distance measurement operation.
void init()
Initializes the range sensor default state.
virtual void createFanModel(const RGBColor &color)
Creates a fan-style 3D visualization model for this sensor.
virtual bool supportsSetActivated() const
Returns whether this sensor supports programmatic activation control.
Definition RangeSensor.h:98
RangeSensor(const Vector< 2, Angle< fltp08 > > &fov, const Model &name, LogPtr log, QObject *parent=nullptr)
Constructs a RangeSensor with a 2D field of view.
virtual void createMaterial(const RGBColor &color)
Creates a material for the sensor visualization model.
virtual void createModel(const RGBColor &color)
Creates a 3D visualization model for this sensor using the given color.
fltp08 m_distance
The last measured distance to the target.
Vector< 2, Angle< fltp08 > > m_fov
The field of view angles (horizontal, vertical).
virtual void setIntensity(fltp08 intensity)
Sets the signal intensity value.
Definition RangeSensor.h:92
virtual void setActivated(bool is_active)
Sets whether this range sensor is activated.
virtual fltp08 distance() const
Returns the last measured distance to the target.
Definition RangeSensor.h:80
virtual bool supportsLowVisibilityMode() const
Returns whether this sensor supports low visibility mode.
Definition RangeSensor.h:89
bool m_low_visibility_mode
Whether low visibility mode is currently enabled.
virtual fltp08 intensity() const
Returns the last measured signal intensity.
Definition RangeSensor.h:77
fltp08 m_intensity
The last measured signal intensity.
RangeSensorType m_type
The type of this range sensor (line, 2D fan, or 3D fan).
A fixed-size array with N dimensions used as the basis for geometric and mathematical types.
Definition Vector.hpp:62
The primary namespace for the NDEVR SDK.
double fltp08
Defines an alias representing an 8 byte floating-point number.
@ is_active
Whether the effect is currently active.
Definition Effect.h:51
RangeSensorType
The type of a range sensor.
Definition RangeSensor.h:40
@ e_line
A single-line range sensor measuring along one axis.
Definition RangeSensor.h:41
@ e_3d_fan
A 3D fan-shaped range sensor measuring in a volume.
Definition RangeSensor.h:43
@ e_2d_fan
A 2D fan-shaped range sensor measuring across a plane.
Definition RangeSensor.h:42