A motor controller object that uses a JMotorCompensator to set velocity of a motor.
More...
#include <JMotorControllerBasic.h>
|
| JMotorControllerBasic (JMotorDriver &_driver, JMotorCompensator &_compensator, float _velLimit=INFINITY, float _accelLimit=INFINITY) |
| constructor
|
|
void | setAccelLimit (float _accelLimit) |
| set maximum rate that motor speed can be changed at
|
|
void | setVelLimit (float _velLimit) |
| set maximum motor speed
|
|
void | setVel (float vel, bool _run=true) |
| set velocity for controller
|
|
void | setVelTarget (float vel, bool _run=true) |
| set target velocity for controller (acceleration limited)
|
|
float | getVelTarget () |
| get target velocity for controller
|
|
float | getVel () |
| get current velocity of motor
|
|
float | getDriverSetVal () |
| returns the value the motor driver is being set to
|
|
void | run () |
| update driver
|
|
bool | setEnable (bool _enable) |
| change whether motor controller is enabled
|
|
bool | isDriverInRange () |
| true if motor driver is being set to within its range, false if driver is at a maximum
|
|
bool | enable () |
| enable motor controller
|
|
bool | disable () |
| disable motor controller
|
|
float | getDriverMinRange () |
| if getDriverSetVal goes below this, isDriverInRange will go false
|
|
float | getDriverMaxRange () |
| if getDriverSetVal exceeds this, isDriverInRange will go false
|
|
bool | getEnable () |
| is the controller enabled
|
|
float | getMaxVel () |
| How fast of a motor speed setting would get adjusted to full motor power.
|
|
float | getMinVel () |
| slowest speed motor can go
|
|
void | setMaxDriverRangeAmount (float _driverRangeAmount) |
| set what fraction of driverRange can be used
|
|
float | getVelLimit () |
| returns value of velLimit
|
|
float | getAccelLimit () |
| returns value of accelLimit
|
|
A motor controller object that uses a JMotorCompensator to set velocity of a motor.
- Note
- Open loop, and no position based commands
◆ JMotorControllerBasic()
JMotorControllerBasic::JMotorControllerBasic |
( |
JMotorDriver & |
_driver, |
|
|
JMotorCompensator & |
_compensator, |
|
|
float |
_velLimit = INFINITY , |
|
|
float |
_accelLimit = INFINITY |
|
) |
| |
|
inline |
constructor
- Parameters
-
_driver | (JMotorDriver) |
_compensator | (JMotorCompensator) |
_velLimit | max velocity (default: INFINITY) |
_accelLimit | max acceleration allowed for approaching velocityTarget, set to INFINITY for unlimited (default: INFINITY) |
◆ disable()
bool JMotorControllerBasic::disable |
( |
| ) |
|
|
inlinevirtual |
◆ enable()
bool JMotorControllerBasic::enable |
( |
| ) |
|
|
inlinevirtual |
◆ getAccelLimit()
float JMotorControllerBasic::getAccelLimit |
( |
| ) |
|
|
inlinevirtual |
◆ getDriverMaxRange()
float JMotorControllerBasic::getDriverMaxRange |
( |
| ) |
|
|
inlinevirtual |
if getDriverSetVal exceeds this, isDriverInRange will go false
- Return values
-
Implements JMotorControllerBase.
◆ getDriverMinRange()
float JMotorControllerBasic::getDriverMinRange |
( |
| ) |
|
|
inlinevirtual |
if getDriverSetVal goes below this, isDriverInRange will go false
- Return values
-
Implements JMotorControllerBase.
◆ getDriverSetVal()
float JMotorControllerBasic::getDriverSetVal |
( |
| ) |
|
|
inlinevirtual |
◆ getEnable()
bool JMotorControllerBasic::getEnable |
( |
| ) |
|
|
inlinevirtual |
◆ getMaxVel()
float JMotorControllerBasic::getMaxVel |
( |
| ) |
|
|
inlinevirtual |
How fast of a motor speed setting would get adjusted to full motor power.
- Note
- may change as battery voltage changes
- Return values
-
Implements JMotorControllerBase.
◆ getMinVel()
float JMotorControllerBasic::getMinVel |
( |
| ) |
|
|
inlinevirtual |
◆ getVel()
float JMotorControllerBasic::getVel |
( |
| ) |
|
|
inlinevirtual |
◆ getVelLimit()
float JMotorControllerBasic::getVelLimit |
( |
| ) |
|
|
inlinevirtual |
◆ getVelTarget()
float JMotorControllerBasic::getVelTarget |
( |
| ) |
|
|
inlinevirtual |
get target velocity for controller
- Return values
-
(float) | current velocity target |
Implements JMotorControllerBase.
◆ isDriverInRange()
bool JMotorControllerBasic::isDriverInRange |
( |
| ) |
|
|
inlinevirtual |
true if motor driver is being set to within its range, false if driver is at a maximum
- Return values
-
Implements JMotorControllerBase.
◆ run()
void JMotorControllerBasic::run |
( |
| ) |
|
|
inlinevirtual |
◆ setAccelLimit()
void JMotorControllerBasic::setAccelLimit |
( |
float |
_accelLimit | ) |
|
|
inlinevirtual |
◆ setEnable()
bool JMotorControllerBasic::setEnable |
( |
bool |
_enable | ) |
|
|
inlinevirtual |
change whether motor controller is enabled
- Parameters
-
- Note
- velocity related variables are reset to zero on disable. you can set velocity then enable
- Return values
-
(bool) | true if state changed |
Implements JMotorControllerBase.
Reimplemented in JMotorControllerOpen.
◆ setMaxDriverRangeAmount()
void JMotorControllerBasic::setMaxDriverRangeAmount |
( |
float |
_driverRangeAmount | ) |
|
|
inlinevirtual |
set what fraction of driverRange can be used
- Parameters
-
_driverRangeAmount | (float) |
Implements JMotorControllerBase.
◆ setVel()
void JMotorControllerBasic::setVel |
( |
float |
vel, |
|
|
bool |
_run = true |
|
) |
| |
|
inlinevirtual |
set velocity for controller
- Note
- this function can be called repeatedly, or just once if run() is called frequently
- Parameters
-
vel | (float) |
_run | (bool) default:true, true = call run() in this function, false = you'll call run() yourself |
Implements JMotorControllerBase.
Reimplemented in JMotorControllerOpen.
◆ setVelLimit()
void JMotorControllerBasic::setVelLimit |
( |
float |
_velLimit | ) |
|
|
inlinevirtual |
◆ setVelTarget()
void JMotorControllerBasic::setVelTarget |
( |
float |
vel, |
|
|
bool |
_run = true |
|
) |
| |
|
inlinevirtual |
set target velocity for controller (acceleration limited)
- Note
- this function can be called repeatedly, or just once if run() is called frequently
- Parameters
-
vel | (float) target velocity |
_run | (bool) default:true, true = call run() in this function, false = you'll call run() yourself |
Implements JMotorControllerBase.
Reimplemented in JMotorControllerOpen.
◆ accelLimit
float JMotorControllerBasic::accelLimit |
|
protected |
◆ compensator
◆ driver
◆ driverInRange
bool JMotorControllerBasic::driverInRange |
|
protected |
◆ lastRunMicros
unsigned long JMotorControllerBasic::lastRunMicros |
|
protected |
◆ setVal
float JMotorControllerBasic::setVal |
|
protected |
◆ velLimit
float JMotorControllerBasic::velLimit |
|
protected |
◆ velocity
float JMotorControllerBasic::velocity |
|
protected |
◆ velocityTarget
float JMotorControllerBasic::velocityTarget |
|
protected |
The documentation for this class was generated from the following file: