1#ifndef J_MOTOR_CONTROLLER_BASIC_OPEN_H
2#define J_MOTOR_CONTROLLER_BASIC_OPEN_H
41 velLimit = max(_velLimit, (
float)0.0);
54 velLimit = max(_velLimit, (
float)0.0);
57 void setVel(
float vel,
bool _run =
true)
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
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
This class defines a common interface for classes which control velocity of a motor controlled by a J...
Definition JMotorControllerBase.h:7
A motor controller object that uses a JMotorCompensator to set velocity of a motor.
Definition JMotorControllerBasic.h:12
bool enable()
enable motor controller
Definition JMotorControllerBasic.h:123
void setVelLimit(float _velLimit)
set maximum motor speed
Definition JMotorControllerBasic.h:52
JMotorDriver & driver
Definition JMotorControllerBasic.h:21
void setVelTarget(float vel, bool _run=true)
set target velocity for controller (acceleration limited)
Definition JMotorControllerBasic.h:65
unsigned long lastRunMicros
Definition JMotorControllerBasic.h:19
bool setEnable(bool _enable)
change whether motor controller is enabled
Definition JMotorControllerBasic.h:108
void run()
update driver
Definition JMotorControllerBasic.h:87
bool driverInRange
Definition JMotorControllerBasic.h:22
float accelLimit
Definition JMotorControllerBasic.h:17
bool disable()
disable motor controller
Definition JMotorControllerBasic.h:128
float velocityTarget
Definition JMotorControllerBasic.h:16
JMotorCompensator & compensator
Definition JMotorControllerBasic.h:23
JMotorControllerBasic(JMotorDriver &_driver, JMotorCompensator &_compensator, float _velLimit=INFINITY, float _accelLimit=INFINITY)
constructor
Definition JMotorControllerBasic.h:33
float getDriverMaxRange()
if getDriverSetVal exceeds this, isDriverInRange will go false
Definition JMotorControllerBasic.h:138
float getVelTarget()
get target velocity for controller
Definition JMotorControllerBasic.h:72
float velLimit
Definition JMotorControllerBasic.h:18
float getDriverSetVal()
returns the value the motor driver is being set to
Definition JMotorControllerBasic.h:82
void setVel(float vel, bool _run=true)
set velocity for controller
Definition JMotorControllerBasic.h:57
float setVal
Definition JMotorControllerBasic.h:15
float getMinVel()
slowest speed motor can go
Definition JMotorControllerBasic.h:153
float velocity
Definition JMotorControllerBasic.h:14
bool isDriverInRange()
true if motor driver is being set to within its range, false if driver is at a maximum
Definition JMotorControllerBasic.h:118
float getVel()
get current velocity of motor
Definition JMotorControllerBasic.h:77
void setMaxDriverRangeAmount(float _driverRangeAmount)
set what fraction of driverRange can be used
Definition JMotorControllerBasic.h:158
float getVelLimit()
returns value of velLimit
Definition JMotorControllerBasic.h:163
bool getEnable()
is the controller enabled
Definition JMotorControllerBasic.h:143
float getAccelLimit()
returns value of accelLimit
Definition JMotorControllerBasic.h:168
float getMaxVel()
How fast of a motor speed setting would get adjusted to full motor power.
Definition JMotorControllerBasic.h:148
float getDriverMinRange()
if getDriverSetVal goes below this, isDriverInRange will go false
Definition JMotorControllerBasic.h:133
void setAccelLimit(float _accelLimit)
set maximum rate that motor speed can be changed at
Definition JMotorControllerBasic.h:47
defines common interface for all types of JMotorDrivers
Definition JMotorDriver.h:10
virtual bool set(float val)
set motor power
virtual bool setEnable(bool _enable)
use to enable or disable a motor, and sets up pin states
virtual float getMaxRange()
high end of the range
virtual float getMinRange()
low end of the range
virtual bool getEnable()
get the enable state of the driver