JMotor
Loading...
Searching...
No Matches
JMotorCompensator.h
Go to the documentation of this file.
1#ifndef J_MOTOR_COMPENSATOR_H
2#define J_MOTOR_COMPENSATOR_H
4#include <Arduino.h>
10protected:
11 float driverRange = 1.0;
12 float maxDriverRange = 1.0;
13
14public:
19 void setDriverRange(float _driverRange)
20 {
21 driverRange = _driverRange;
22 }
27 void setMaxDriverRangeAmount(float _driverRangeAmount)
28 {
29 maxDriverRange = max(_driverRangeAmount, (float)0.0);
30 }
36 virtual float compensate(float val);
37
43 virtual float getMaxVel();
44
49 virtual float getMinVel();
50
56 {
57 return driverRange;
58 }
59
65 {
66 return maxDriverRange;
67 }
68};
69#include "JMotorCompBasic.h"
70#include "JMotorCompDirect.h"
71#include "JMotorCompStandard.h"
72#endif
This class defines a common interface for converting from speed to driver input. It should compensate...
Definition JMotorCompensator.h:9
virtual float getMaxVel()
How fast of a motor speed setting would get adjusted to full motor power.
void setDriverRange(float _driverRange)
set what value makes the driver output 100% of supply voltage
Definition JMotorCompensator.h:19
virtual float compensate(float val)
calculate
float maxDriverRange
Definition JMotorCompensator.h:12
float getDriverRange()
get what value makes the driver output 100% of supply voltage
Definition JMotorCompensator.h:55
virtual float getMinVel()
Slowest speed motor can go.
void setMaxDriverRangeAmount(float _driverRangeAmount)
set what fraction of driverRange can be used
Definition JMotorCompensator.h:27
float getMaxDriverRangeAmount()
get what fraction of driverRange can be used
Definition JMotorCompensator.h:64
float driverRange
Definition JMotorCompensator.h:11