3#include <NDEVR/Device.h>
A device which has an associated voltage or percent that changes.
A specification of upper and lower bounds in N-dimensions.
A core class where all Design Objects including models, materials, and geometries are stored.
Device(const Model &model, LogPtr log, QObject *parent=nullptr)
Constructs a Device from a Model with the given log and optional Qt parent.
virtual void zeroRaw()
Zeros the raw length reading, treating the current position as zero.
virtual Battery * battery() const
Returns the battery associated with this encoder, if any.
bool m_is_in_use
Whether this encoder is currently in use.
virtual void setDistanceBounds(const Bounds< 1, fltp08 > &bounds)
Sets the valid distance bounds for this encoder.
virtual void setLocation(const Vertex< 3, fltp08 > &location)
Sets the 3D spatial location of the encoder.
Bounds< 1, fltp08 > m_bounds
Valid distance bounds for this encoder.
fltp08 m_new_deployment_offset
Offset applied at the start of a new deployment.
virtual void setReference(fltp08 offset)
Sets the reference distance point.
virtual void calibrateToLength(fltp08 length)
Calibrates the encoder scale so that the current raw reading maps to the given length.
DistanceEncoder(const Model &model, LogPtr log=LogPtr(), QObject *parent=nullptr)
Constructs a DistanceEncoder device.
Battery * m_battery
Associated battery device, if any.
virtual bool isInUse() const
Checks whether this encoder is currently in use.
virtual fltp08 reference() const
Returns the current reference point distance.
fltp08 m_reference
Reference distance point. Invalid if not set.
static DistanceEncoder * PrimaryDistanceEncoder()
Returns the primary distance encoder registered with the system.
fltp08 m_raw_length
Raw uncalibrated length reading from hardware.
virtual void clearDeploymentInfo()
Clears the current deployment info and deactivates the deployment.
static std::function< DistanceEncoder *()> s_get_distance_encoder
Callback to retrieve the primary distance encoder.
fltp08 m_speed
Current speed of encoder movement.
bool m_delete_encoder_readings
Whether old readings can be deleted during deployment.
virtual void setSpeed(fltp08 speed)
Sets the current encoder speed.
virtual fltp08 scale() const
Returns the current scale factor applied to raw readings.
virtual void setScale(fltp08 scale)
Sets the scale factor applied to raw readings.
virtual void setInUse(bool is_in_use)
Sets whether this encoder is currently in use.
virtual void updateModel()
Updates the underlying Model with the current encoder state.
virtual void setCanDeleteReadings(bool can_delete)
Sets whether old encoder readings can be deleted during deployment.
DeploymentInfo m_deployment_info
Current deployment session parameters.
virtual void setBattery(Battery *battery)
Sets the battery associated with this encoder.
virtual void setNewDeploymentOffset(fltp08 offset)
Sets the offset applied at the start of a new deployment.
fltp08 preferredSegmentLength() const
Returns the preferred deployment segment length.
virtual fltp08 rawLength() const
Returns the current raw (uncalibrated) length reading.
fltp08 m_raw_length_epsilon
Minimum raw length change to register as a new reading.
static void SetPrimaryDistanceEncoderCallback(const std::function< DistanceEncoder *()> &encoder)
Registers a callback that returns the primary distance encoder.
fltp08 m_raw_offset
Offset applied to the raw reading for zeroing.
fltp08 m_offset
User-defined offset added to the calibrated length.
virtual void setRawLengthEpsilon(fltp08 epsilon)
Sets the minimum change in raw length required to register as a new reading.
virtual fltp08 length() const
Returns the calibrated length, applying scale and offset to the raw reading.
virtual fltp08 lengthToReference() const
Returns the distance from the current position to the reference point.
virtual bool isConnected() const
Checks whether the encoder hardware is connected.
virtual void setDeploymentInfo(const DeploymentInfo &info)
Sets the deployment info for managing deployment sessions.
virtual void startNewDeployment()
Begins a new deployment session, resetting relevant state.
virtual void clearReference()
Clears the reference point, setting it to invalid.
TemperatureSensor * m_temperature_sensor
Associated temperature sensor, if any.
virtual void setRawLength(fltp08 length)
Sets the raw length reading from the encoder hardware.
virtual TemperatureSensor * temperatureSensor() const
Returns the temperature sensor associated with this encoder, if any.
virtual void setOffset(fltp08 offset)
Sets the offset added to the scaled raw reading.
virtual void setTemperatureSensor(TemperatureSensor *sensor)
Sets the temperature sensor associated with this encoder.
fltp08 m_scale
Scale factor applied to raw readings.
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.
A motor is a device which produces rotational spin.
Forward declaration for distance encoder device.
A Device responsible for determining the temperature of either the environment or a specific componen...
A point in N-dimensional space, used primarily for spatial location information.
The primary namespace for the NDEVR SDK.
double fltp08
Defines an alias representing an 8 byte floating-point number.
Parameters describing a deployment session for a DistanceEncoder and its associated sensor.
fltp08 deployment_segment_length
The length of each deployment segment.
DesignObjectLookup * manager
Design object lookup for managing deployment models.
bool active
Whether a deployment is currently active.
PositionSensor * sensor
The position sensor used during deployment.