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
20 {
21 public:
22 DistanceEncoder(const Model& model, ProgressInfo* log = nullptr, QObject* parent = nullptr);
23 virtual void setRawLengthEpsilon(fltp08 epsilon) { m_raw_length_epsilon = epsilon; }
24 virtual void clearDeploymentInfo();
25 virtual void setSpeed(fltp08 speed) { m_speed = speed; }
26 virtual void setDistanceBounds(const Bounds<1, fltp08>& bounds) { m_bounds = bounds; }
27 virtual void setRawLength(fltp08 length);
28 virtual void setDeploymentInfo(const DeploymentInfo& info);
29 virtual void startNewDeployment();
30 virtual void updateModel();
31 virtual fltp08 rawLength() const { return m_raw_length; };
32 virtual fltp08 scale() const { return m_scale; };
33 virtual fltp08 length() const;
34 virtual void zeroRaw();
35 fltp08 preferredSegmentLength() const;
36 virtual void calibrateToLength(fltp08 length);
37 virtual void setScale(fltp08 scale);
38 virtual void setOffset(fltp08 offset);
39 virtual void setLocation(const Vertex<3, fltp08>& location);
40 virtual void setCanDeleteReadings(bool can_delete) { m_delete_encoder_readings = can_delete; }
41 virtual Battery* battery() const { return m_battery; }
42 virtual void setBattery(Battery* battery) { m_battery = battery; }
43 virtual void setNewDeploymentOffset(fltp08 offset) { m_new_deployment_offset = offset; }
44 virtual TemperatureSensor* temperatureSensor() const { return m_temperature_sensor; }
45 virtual void setTemperatureSensor(TemperatureSensor* battery) { m_temperature_sensor = battery; }
46 virtual bool isInUse() const { return m_is_in_use; }
47 virtual void setInUse(bool is_in_use);
48 public:
49 static DistanceEncoder* PrimaryDistanceEncoder();
50 static void SetPrimaryDistanceEncoderCallback(const std::function<DistanceEncoder*()>& encoder);
51 protected:
52 static std::function<DistanceEncoder*()> s_get_distance_encoder;
53 protected:
56 fltp08 m_raw_length = 0.0;
57 fltp08 m_raw_offset = 0.0;
58 fltp08 m_offset = 0.0;
59 fltp08 m_scale = 1.0;
60 fltp08 m_speed = 0.0;
61 fltp08 m_new_deployment_offset = 0.0;
62 fltp08 m_raw_length_epsilon = 0.01;
63 Battery* m_battery = nullptr;
64 TemperatureSensor* m_temperature_sensor = nullptr;
65 bool m_delete_encoder_readings = false;
66 bool m_is_in_use = true;
67 };
68}
#define HARDWARE_API
Definition DLLInfo.h:74
Definition Battery.h:70
A specification of upper and lower bounds in N-dimensions.
Definition Bounds.hpp:57
Definition DesignObjectLookup.h:61
Definition Device.h:48
Definition DistanceEncoder.h:20
virtual void setBattery(Battery *battery)
Definition DistanceEncoder.h:42
Bounds< 1, fltp08 > m_bounds
Definition DistanceEncoder.h:54
virtual void setDistanceBounds(const Bounds< 1, fltp08 > &bounds)
Definition DistanceEncoder.h:26
virtual void setCanDeleteReadings(bool can_delete)
Definition DistanceEncoder.h:40
virtual fltp08 scale() const
Definition DistanceEncoder.h:32
virtual void setNewDeploymentOffset(fltp08 offset)
Definition DistanceEncoder.h:43
virtual bool isInUse() const
Definition DistanceEncoder.h:46
virtual TemperatureSensor * temperatureSensor() const
Definition DistanceEncoder.h:44
virtual void setSpeed(fltp08 speed)
Definition DistanceEncoder.h:25
virtual Battery * battery() const
Definition DistanceEncoder.h:41
virtual fltp08 rawLength() const
Definition DistanceEncoder.h:31
virtual void setRawLengthEpsilon(fltp08 epsilon)
Definition DistanceEncoder.h:23
virtual void setTemperatureSensor(TemperatureSensor *battery)
Definition DistanceEncoder.h:45
DeploymentInfo m_deployment_info
Definition DistanceEncoder.h:55
Definition Model.h:54
Definition PositionSensor.h:50
Definition ProgressInfo.hpp:43
Definition TemperatureSensor.h:37
A vertex.
Definition Vertex.hpp:54
Definition ACIColor.h:37
double fltp08
Defines an alias representing an 8 byte floating-point number.
Definition BaseValues.hpp:181
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