API Documentation
Loading...
Searching...
No Matches
DistanceEncoder.h
Go to the documentation of this file.
1#pragma once
2#include "DLLInfo.h"
3#include <NDEVR/Device.h>
4namespace NDEVR
5{
6 class PositionSensor;
7 class DesignObjectLookup;
8 class Battery;
9 class Motor;
10 class TemperatureSensor;
18
19 /**--------------------------------------------------------------------------------------------------
20 \brief A distance encoder is a device that measures distance by generating pulses in response to an
21 object's movement. The pulses are then processed and converted into a distance measurement.
22
23 Types of encoders include:
24 -Linear encoders: These encoders are best suited for measuring distances of up to 10 feet and
25 can provide high accuracy and repeatability.
26 -Rotary encoders: These encoders can measure linear distance by calculating the number of
27 pulses compared to the known number of pulses per arc length.
28 -Optical shaft encoders: These encoders can track distance, direction of motion, and
29 position of rotary components.
30 Measuring wheel encoders: These encoders can measure linear distance by using a measuring
31 wheel that has direct contact with the surface being measured.
32 Draw-wire encoders: These encoders use a spring-driven retractable cable spool
33 attached to a shaft encoder.
34 **/
36 {
37 public:
38 DistanceEncoder(const Model& model, ProgressInfo* log = nullptr, QObject* parent = nullptr);
39 virtual void setRawLengthEpsilon(fltp08 epsilon) { m_raw_length_epsilon = epsilon; }
40 virtual void clearDeploymentInfo();
41 virtual void setSpeed(fltp08 speed) { m_speed = speed; }
42 virtual void setDistanceBounds(const Bounds<1, fltp08>& bounds) { m_bounds = bounds; }
43 virtual void setRawLength(fltp08 length);
44 virtual void setDeploymentInfo(const DeploymentInfo& info);
45 virtual void startNewDeployment();
46 virtual void updateModel();
47 virtual fltp08 rawLength() const { return m_raw_length; };
48 virtual fltp08 scale() const { return m_scale; };
49 virtual fltp08 length() const;
50 virtual void zeroRaw();
52 virtual void calibrateToLength(fltp08 length);
53 virtual void setScale(fltp08 scale);
54 virtual void setOffset(fltp08 offset);
55 virtual void setLocation(const Vertex<3, fltp08>& location);
56 virtual void setCanDeleteReadings(bool can_delete) { m_delete_encoder_readings = can_delete; }
57 virtual Battery* battery() const { return m_battery; }
58 virtual void setBattery(Battery* battery) { m_battery = battery; }
59 virtual void setNewDeploymentOffset(fltp08 offset) { m_new_deployment_offset = offset; }
60 virtual TemperatureSensor* temperatureSensor() const { return m_temperature_sensor; }
61 virtual void setTemperatureSensor(TemperatureSensor* battery) { m_temperature_sensor = battery; }
62 virtual bool isInUse() const { return m_is_in_use; }
63 virtual void setInUse(bool is_in_use);
64 public:
66 static void SetPrimaryDistanceEncoderCallback(const std::function<DistanceEncoder*()>& encoder);
67 protected:
68 static std::function<DistanceEncoder*()> s_get_distance_encoder;
69 protected:
72 fltp08 m_raw_length = 0.0;
73 fltp08 m_raw_offset = 0.0;
74 fltp08 m_offset = 0.0;
75 fltp08 m_scale = 1.0;
76 fltp08 m_speed = 0.0;
77 fltp08 m_new_deployment_offset = 0.0;
78 fltp08 m_raw_length_epsilon = 0.01;
79 Battery* m_battery = nullptr;
80 TemperatureSensor* m_temperature_sensor = nullptr;
81 bool m_delete_encoder_readings = false;
82 bool m_is_in_use = true;
83 };
84}
#define HARDWARE_API
Definition DLLInfo.h:56
A device which has an accociated voltage or percent that changes. Can have set upper and lower limits...
Definition Battery.h:83
A specification of upper and lower bounds in N-dimensions.
Definition Bounds.hpp:52
A core class where all Design Objects including models, materials, and geometries are stored....
Definition DesignObjectLookup.h:65
A root class which describes some physical object, such as a Motor, Sensor, or Connection....
Definition Device.h:52
A distance encoder is a device that measures distance by generating pulses in response to an object's...
Definition DistanceEncoder.h:36
virtual void setBattery(Battery *battery)
Definition DistanceEncoder.h:58
virtual fltp08 length() const
virtual void setLocation(const Vertex< 3, fltp08 > &location)
virtual void startNewDeployment()
Bounds< 1, fltp08 > m_bounds
Definition DistanceEncoder.h:70
virtual void updateModel()
virtual void setDistanceBounds(const Bounds< 1, fltp08 > &bounds)
Definition DistanceEncoder.h:42
static void SetPrimaryDistanceEncoderCallback(const std::function< DistanceEncoder *()> &encoder)
virtual void setCanDeleteReadings(bool can_delete)
Definition DistanceEncoder.h:56
virtual fltp08 scale() const
Definition DistanceEncoder.h:48
virtual void setNewDeploymentOffset(fltp08 offset)
Definition DistanceEncoder.h:59
virtual bool isInUse() const
Definition DistanceEncoder.h:62
virtual TemperatureSensor * temperatureSensor() const
Definition DistanceEncoder.h:60
virtual void setRawLength(fltp08 length)
virtual void zeroRaw()
static DistanceEncoder * PrimaryDistanceEncoder()
virtual void setSpeed(fltp08 speed)
Definition DistanceEncoder.h:41
virtual Battery * battery() const
Definition DistanceEncoder.h:57
virtual fltp08 rawLength() const
Definition DistanceEncoder.h:47
virtual void setRawLengthEpsilon(fltp08 epsilon)
Definition DistanceEncoder.h:39
fltp08 preferredSegmentLength() const
virtual void setInUse(bool is_in_use)
virtual void setDeploymentInfo(const DeploymentInfo &info)
virtual void setTemperatureSensor(TemperatureSensor *battery)
Definition DistanceEncoder.h:61
DeploymentInfo m_deployment_info
Definition DistanceEncoder.h:71
virtual void clearDeploymentInfo()
virtual void calibrateToLength(fltp08 length)
virtual void setOffset(fltp08 offset)
virtual void setScale(fltp08 scale)
DistanceEncoder(const Model &model, ProgressInfo *log=nullptr, QObject *parent=nullptr)
A core class that represents a node on model heirarchy. This node may contain a Geometry or one or mo...
Definition Model.h:58
A position sensor is a Device that determines the position of Hardware. This device might be a GPS or...
Definition PositionSensor.h:53
A light-weight base class for Log that allows processes to update, without the need for additional in...
Definition ProgressInfo.hpp:48
A Device responsible for determining the temperature of either the environment or a specific componen...
Definition TemperatureSensor.h:41
A vertex or point. A specific type of Vector used primarily for spacial location information.
Definition Vertex.hpp:48
Definition ACIColor.h:37
double fltp08
Defines an alias representing an 8 byte floating-point number.
Definition BaseValues.hpp:149
Definition DistanceEncoder.h:12
bool active
Definition DistanceEncoder.h:16
fltp08 deployment_segment_length
Definition DistanceEncoder.h:15
PositionSensor * sensor
Definition DistanceEncoder.h:14
DesignObjectLookup * manager
Definition DistanceEncoder.h:13