A sensor reading a single Encoder and converting the counter to a physical unit, with support for calibration. More...
#include <EncoderPositionSensor.hpp>
Public Member Functions | |
EncoderPositionSensor (EncoderInterface *_enc, double _unit_to_inc, double _minpos, double _maxpos) | |
Create a new EncoderInterface to SensorInterface Object. | |
virtual int | readSensor (double &p) const |
void | limit (double _min, double _max) |
Set the minimal and maximal position. | |
void | calibrationPosition (double pos) |
Set the calibration position of this encoder. | |
void | calibrationDirection (double dir) |
Set the direction in which the calibration will be done. | |
virtual void | calibrate () |
virtual void | unCalibrate () |
virtual bool | isCalibrated () const |
virtual double | readSensor () const |
virtual double | maxMeasurement () const |
virtual double | minMeasurement () const |
virtual double | zeroMeasurement () const |
double | calibrate (double calpos, double sign) |
Calibrate the Axis with a given calibration position and direction of the movement. |
A sensor reading a single Encoder and converting the counter to a physical unit, with support for calibration.
Definition at line 45 of file EncoderPositionSensor.hpp.
EncoderPositionSensor | ( | EncoderInterface * | _enc, | |
double | _unit_to_inc, | |||
double | _minpos, | |||
double | _maxpos | |||
) | [inline] |
Create a new EncoderInterface to SensorInterface Object.
_enc | The Encoder to use | |
_unit_to_inc | Conversion of physical units to increments (eg increments / mm ) | |
_minpos | The minimal, physical position, after calibration | |
_maxpos | The maximal, physical position, after calibration |
Definition at line 65 of file EncoderPositionSensor.hpp.
double calibrate | ( | double | calpos, | |
double | sign | |||
) | [inline] |
Calibrate the Axis with a given calibration position and direction of the movement.
A calibration position is defined by a positionGet() == 0 (thus, the encoder count is zero), for any turn turnGet() == k. You may call this method only when the encoder is no more than a turn distance away from the intended calibration point. After calibration, readSensor() == cal_pos and isCalibrated() == true .
* ...|..........|..........|..........| : | = turn increment, . = position increment/decrement * ^turn==N-1 ^ turn==N ^ turn==N+1 * ^ calpos = x mm * |-------------------| : valid range physical position when calling this method. * * ----> : passed calpos during positive movement, sign = +1 * <---- : passed calpos during negative movement, sign = -1 *
calpos | The physical position of the calibrated zero position counter. | |
sign | Is the calpos left or right from the current position. (meaning : write +1 if you were moving with a positive velocity, write -1 if you were moving with a negative velocity.) |
Definition at line 170 of file EncoderPositionSensor.hpp.
void calibrationDirection | ( | double | dir | ) | [inline] |
Set the direction in which the calibration will be done.
dir | A positive or negative value. |
Definition at line 102 of file EncoderPositionSensor.hpp.
void calibrationPosition | ( | double | pos | ) | [inline] |
Set the calibration position of this encoder.
pos | The value the encoder will read out on a calibrated position. |
Definition at line 91 of file EncoderPositionSensor.hpp.