1#ifndef J_MOTOR_COMP_STANDARD_H
2#define J_MOTOR_COMP_STANDARD_H
40 float _motor_stop_voltage,
float _motor_stop_speed,
41 float _motor_start_voltage,
float _motor_start_speed,
42 float _motor_high_voltage,
float _motor_high_speed,
43 unsigned int _start_boost_time)
62 bool startBoostingArmed;
63 unsigned long startBoostingTimeMillis;
77 startBoosting =
false;
78 startBoostingArmed =
true;
79 startBoostingTimeMillis = 0;
80 multiplier = _multiplier;
84 float ret = val * multiplier;
86 startBoostingArmed =
true;
92 ret = max(ret, (
float)0);
94 ret = calcSlope(-ret);
95 ret = -max(ret, (
float)0);
100 startBoostingArmed =
true;
105 startBoosting =
true;
106 startBoostingArmed =
false;
107 startBoostingTimeMillis = millis();
117 startBoosting =
false;
146 multiplier = _multiplier;
150 float calcSlope(
float ret)
161 float floatMap(
float x,
float in_min,
float in_max,
float out_min,
float out_max)
163 return (x - in_min) * (out_max - out_min) / (in_max - in_min) + out_min;
Converts from speed to driver input compensating for motors not being perfect.
Definition JMotorCompStandard.h:57
void setMultiplier(float _multiplier)
Definition JMotorCompStandard.h:144
float compensate(float val)
calculate
Definition JMotorCompStandard.h:82
void setConfig(JMotorCompStandardConfig &_config)
Definition JMotorCompStandard.h:123
float getMaxVel()
How fast of a motor speed setting would get adjusted to full motor power.
Definition JMotorCompStandard.h:128
float getMinVel()
Slowest speed motor can go.
Definition JMotorCompStandard.h:139
JMotorCompStandard(JVoltageCompensator &_voltComp, JMotorCompStandardConfig _config, float _multiplier=1.0)
Converts from speed to driver input compensating for motors not being perfect.
Definition JMotorCompStandard.h:73
This class defines a common interface for converting from speed to driver input. It should compensate...
Definition JMotorCompensator.h:9
float maxDriverRange
Definition JMotorCompensator.h:12
float driverRange
Definition JMotorCompensator.h:11
convert voltage to value needed to set driver at to get that voltage
Definition JVoltageCompensator.h:7
virtual float getSupplyVoltage()
virtual float adjust(float voltage, float driverRange)
do conversion
struct for containing settings for JMotorCompStandard
Definition JMotorCompStandard.h:9
unsigned int start_boost_time
how long (in milliseconds) to pulse motor_start_voltage to get the motor started
Definition JMotorCompStandard.h:37
float motor_start_voltage
voltage at which the motor can start turning
Definition JMotorCompStandard.h:21
JMotorCompStandardConfig(float _motor_stop_voltage, float _motor_stop_speed, float _motor_start_voltage, float _motor_start_speed, float _motor_high_voltage, float _motor_high_speed, unsigned int _start_boost_time)
Definition JMotorCompStandard.h:39
float motor_start_speed
speed the motor turns at motor_start_voltage
Definition JMotorCompStandard.h:25
float motor_high_speed
speed the motor turns at motor_high_voltage
Definition JMotorCompStandard.h:33
float motor_stop_speed
speed the motor turns at motor_stop_voltage
Definition JMotorCompStandard.h:17
float motor_high_voltage
voltage used for calibration point towards fastest speed of motor
Definition JMotorCompStandard.h:29
float motor_stop_voltage
voltage at which the motor stops turning
Definition JMotorCompStandard.h:13