NDEVR
API Documentation
PositionSensor.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: PositionSensor
29Included in API: True
30Author(s): Tyler Parke
31 *-----------------------------------------------------------------------------------------**/
32#pragma once
33#include <NDEVR/Device.h>
34#include <NDEVR/StationModel.h>
35#include <NDEVR/Deployment.h>
36#include <NDEVR/GPSPoint.h>
37#include <NDEVR/Matrix.h>
38#include <NDEVR/UUID.h>
39#include <QObject>
40namespace NDEVR
41{
42 class Deployment;
43 class StationModel;
44 class Effect;
45 class OrientationSensor;
46 class DistanceEncoder;
47
54 class HARDWARE_API PositionSensor : public Device
55 {
56 Q_OBJECT
57 public:
62 PositionSensor(const Model& name, LogPtr log, QObject* parent = nullptr);
65 [[nodiscard]] virtual Vertex<3, fltp08> lastPosition() const;
68 void setPosition(const Vertex<3, fltp08>& location);
71 [[nodiscard]] virtual Vertex<3, fltp08> sensorLocation() const { return m_sensor_location; }
74 void setSensorLocation(const Vertex<3, fltp08>& location);
77 void update(Time time) override;
80 [[nodiscard]] virtual GNSSQuality gpsQuality() const { return GNSSQuality::e_invalid; };
84 virtual bool requestUsingGPS(bool using_gps);
87 virtual bool stationUsedForOffset() const { return true; }
90 [[nodiscard]] virtual bool usingGPS() const { return m_using_gps; }
94 virtual bool requestDistanceEncoder(DistanceEncoder*) { return false; }
97 virtual void addDeploymentSegment(fltp08 distance) { UNUSED(distance); }
100 virtual void removeDeploymentSegment(uint04 index = Constant<uint04>::Invalid) { UNUSED(index); }
103 virtual void setVelocity(const Vector<3, fltp08>& velocity);
106 virtual void setAcceleration(const Vector<3, fltp08>& acceleration);
107#if NDEVR_STATION_MODEL
111 virtual bool requestStation(const StationModel& model);
114 [[nodiscard]] virtual const StationModel& station() const { return m_station_model; }
117 [[nodiscard]] virtual StationModel& station() { return m_station_model; }
118#endif
119#if NDEVR_DEPLOYMENT
123 virtual bool requestDeployment(const Deployment& deployment);
126 [[nodiscard]] virtual const Deployment& deployment() const { return m_deployment; }
129 [[nodiscard]] virtual Deployment& deployment() { return m_deployment; }
130#endif
133 [[nodiscard]] virtual DistanceEncoder* distanceEncoder() const { return nullptr; }
136 [[nodiscard]] virtual Vector<3, fltp08> stdDev() const { return Constant<Vector<3, fltp08>>::Invalid; };
139 [[nodiscard]] virtual OrientationSensor* orientationSensor() const { return nullptr; }
140 signals:
143 void deploymentChangedSignal(UUID deployment);
145 protected:
146#if NDEVR_STATION_MODEL
147 StationModel m_station_model;
148#endif
149#if NDEVR_DEPLOYMENT
150 Deployment m_deployment;
151#endif
158 };
159 template class HARDWARE_API StringStream<GNSSQuality>;
160}
uint04 index() const
Returns the primary row index of this object within the DesignObjectBase property table.
Device(const Model &model, LogPtr log, QObject *parent=nullptr)
Constructs a Device from a Model with the given log and optional Qt parent.
A distance encoder is a device that measures distance by generating pulses in response to an object's...
A core class that provides a dynamic effect to an object in a model hierarchy.
Definition Effect.h:158
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
Forward declaration for design object lookup service.
void deploymentSegmentAddedSignal()
Emitted when a deployment segment has been added.
virtual bool requestUsingGPS(bool using_gps)
Requests enabling or disabling GPS-based positioning.
Vertex< 3, fltp08 > m_sensor_location
The physical location of the sensor on the hardware.
virtual void setVelocity(const Vector< 3, fltp08 > &velocity)
Sets the current velocity vector of the sensor.
Vector< 3, fltp08 > m_velocity
The current 3D velocity vector.
Vector< 3, fltp08 > m_acceleration
The current 3D acceleration vector.
virtual bool requestDistanceEncoder(DistanceEncoder *)
Requests attaching a distance encoder to this position sensor.
void update(Time time) override
Updates the position sensor state for the given time.
void deploymentChangedSignal(UUID deployment)
Emitted when the deployment configuration has changed.
virtual void addDeploymentSegment(fltp08 distance)
Adds a deployment segment at the given distance.
void setPosition(const Vertex< 3, fltp08 > &location)
Sets the current position of this sensor.
void setSensorLocation(const Vertex< 3, fltp08 > &location)
Sets the physical location of the sensor on the hardware.
Time m_last_position_time
The timestamp of the last position update.
Vertex< 3, fltp08 > m_position
The current 3D position of this sensor.
bool m_using_gps
Whether GPS-based positioning is currently enabled.
virtual Vector< 3, fltp08 > stdDev() const
Returns the standard deviation of position measurements.
PositionSensor(const Model &name, LogPtr log, QObject *parent=nullptr)
Constructs a PositionSensor with the given model, log, and optional parent.
virtual Vertex< 3, fltp08 > sensorLocation() const
Returns the physical location of the sensor on the hardware.
virtual GNSSQuality gpsQuality() const
Returns the current GNSS fix quality.
virtual Vertex< 3, fltp08 > lastPosition() const
Returns the last known 3D position of this sensor.
void stationChangedSignal(UUID station)
Emitted when the station model has changed.
virtual void setAcceleration(const Vector< 3, fltp08 > &acceleration)
Sets the current acceleration vector of the sensor.
virtual OrientationSensor * orientationSensor() const
Returns the orientation sensor associated with this position sensor, if any.
virtual void removeDeploymentSegment(uint04 index=Constant< uint04 >::Invalid)
Removes a deployment segment at the given index.
virtual bool stationUsedForOffset() const
Returns whether the station model is used for position offset computation.
virtual bool usingGPS() const
Returns whether GPS-based positioning is currently enabled.
virtual DistanceEncoder * distanceEncoder() const
Returns the distance encoder attached to this sensor, if any.
void deploymentSegmentRemovedSignal()
Emitted when a deployment segment has been removed.
Logic for reading or writing to a string or a user friendly, TranslatedString.
Represents a timestamp with utilities for manipulation and conversion.
Definition Time.h:62
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.
GNSSQuality
Describes the quality level of a GNSS position fix.
Definition GPSPoint.h:16
@ e_invalid
No fix available or fix is invalid.
Definition GPSPoint.h:17
Defines for a given type (such as sint04, fltp08, UUID, etc) a maximum, minimum, and reserved 'invali...