2#include <NDEVR/PositionSensor.h>
3#include "Design/Headers/DesignObjectLookup.h"
4#include "Design/Headers/StationModel.h"
5#include "Base/Headers/QueueBuffer.hpp"
6#include <librealsense2/rs.hpp>
88 auto pose_data = frame.get_pose_data();
89 Vertex<3, fltp08> offset(-pose_data.translation.z, -pose_data.translation.x, pose_data.translation.y);
91 Ray<3, fltp08> acceleration(-pose_data.acceleration.z, -pose_data.acceleration.x, pose_data.acceleration.y);
93 Ray<3, fltp08> velocity(-pose_data.velocity.z, -pose_data.velocity.x, pose_data.velocity.y);
100 pose_data.tracker_confidence,
101 pose_data.mapper_confidence, frame.get_timestamp());
120 if (time > reading.time)
122 velocity = (offset - reading.position) / (time - reading.time);
123 acceleration = (velocity - reading.velocity) / (time - reading.time);
126 PositionReading reading(offset, velocity, acceleration, 1.0, 1.0, time);
137 WLock wlock(&m_station_model);
138 lib_assert(m_station_model.isValid(),
"No station for segment");
139 if (m_station_model.isValid())
142 if (!m_deployment.isValid())
144 m_deployment = Deployment(m_station_model.createChild());
187 if (reading.
time > time || (time - reading.
time) > 200.0)
191 if (reading.
time < time)
A core class where all Design Objects including models, materials, and geometries are stored.
@ e_pixel
Thickness in screen pixels.
Templated logic for doing matrix multiplication.
A core class that represents a node on model hierarchy.
Vector< 3, fltp08 > size() const
Returns the size (extents) of the model's bounding box.
void deploymentSegmentAddedSignal()
Emitted when a deployment segment has been added.
void deploymentChangedSignal(UUID deployment)
Emitted when the deployment configuration has changed.
void setPosition(const Vertex< 3, fltp08 > &location)
Sets the current position of this sensor.
PositionSensor(const Model &name, LogPtr log, QObject *parent=nullptr)
Constructs a PositionSensor with the given model, log, and optional parent.
virtual Vertex< 3, fltp08 > lastPosition() const
Returns the last known 3D position of this sensor.
Used with InfoPipe to signal that the system will be using progress.
Stores objects in a first-in, first out queue based Buffer with push and pop functions.
Used to lock a particular variable for reading.
bool resetRequested() const
Returns whether a reset has been requested.
void setLocation(rs2::pose_frame frame)
Updates the position from a RealSense T265 pose frame.
Vertex< 3, fltp08 > locationAt(fltp08 time)
Returns the interpolated position at a given time.
PositionReadingBuffer m_historic_positions
Circular buffer of historic position readings.
Matrix< fltp08 > m_transform
Coordinate transformation matrix.
DesignObjectLookup * m_lookup
The design object lookup.
RealSensePositionSensor(DesignObjectLookup *lookup, const Model &model, ProgressInfo *log, QObject *parent=nullptr)
Constructs the position sensor.
void setLocationFromSLAM(const Matrix< fltp08 > &slam, fltp08 time)
Updates the position from a SLAM-derived transformation matrix.
bool m_request_reset
Whether a position reset has been requested.
void addDeploymentSegment(fltp08) override
Adds a new deployment segment at the current position.
void requestReset(bool reset_requested)
Requests a position sensor reset.
static Time SystemTime()
Retrieves the current system time which is a combination of std::chrono::steady_clock to ensure smoot...
A fixed-size array with N dimensions used as the basis for geometric and mathematical types.
A point in N-dimensional space, used primarily for spatial location information.
Used to lock a particular variable for writing.
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.
uint8_t uint01
-Defines an alias representing a 1 byte, unsigned integer -Can represent exact integer values 0 throu...
static constexpr bool IsInvalid(const Angle< t_type > &value)
Checks whether the given Angle holds an invalid value.
@ deletion_allowed
Whether the user is allowed to delete this object.
@ guid
A 128-bit globally unique identifier for the object.
constexpr t_to cast(const Angle< t_from > &value)
Casts an Angle from one backing type to another.
Defines for a given type (such as sint04, fltp08, UUID, etc) a maximum, minimum, and reserved 'invali...
A single position reading from the RealSense T265 tracking camera.
uint01 tracker_confidence
Pose confidence 0x0 - Failed, 0x1 - Low, 0x2 - Medium, 0x3 - High.
Vertex< 3, fltp08 > position
The 3D position of the sensor.
Ray< 3, fltp08 > acceleration
The 3D acceleration of the sensor.
Vertex< 3, fltp08 > positionAt(fltp08 t)
Extrapolates the position at a given time using velocity and acceleration.
fltp08 confidence() const
Computes a confidence score based on tracker confidence and motion magnitude.
fltp08 time
The timestamp of this reading in milliseconds.
Ray< 3, fltp08 > velocity
The 3D velocity of the sensor.
uint01 mapper_confidence
Pose map confidence 0x0 - Failed, 0x1 - Low, 0x2 - Medium, 0x3 - High.
PositionReading()
Constructs a default (empty) position reading.
PositionReading(Vertex< 3, fltp08 > position, Ray< 3, fltp08 > velocity, Ray< 3, fltp08 > acceleration, uint01 tracker_confidence, uint01 mapper_confidence, fltp08 time)
Constructs a position reading with all fields.