JMotor
|
closed loop (uses encoder) motor controller More...
#include <JMotorControllerClosed.h>
Public Member Functions | |
JMotorControllerClosed (JMotorDriver &_driver, JMotorCompensator &_compensator, JEncoder &_encoder, JControlLoop &_controlLoop, float _velLimit=INFINITY, float _accelLimit=INFINITY, float _distFromSetpointLimit=1, bool _preventGoingWrongWay=true, float _maxStoppingDecel=2) | |
Constructor for closed loop motor controller. | |
void | run () |
update driver | |
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) | |
bool | setPosTarget (float _posTarget, bool _run=true) |
set target position (motor drives towards position, following acceleration profile) | |
bool | setPosTargetStallable (float _posTarget, bool _run=true) |
bool | setPosSetpoint (float _posSetpoint, bool _run=true) |
set position for motor to drive towards position as fast as possible (setpoint for control loop if available) | |
bool | setPosDelta (float _posDelta, bool _run=true, bool _resetPos=false) |
alternative method for setting velocity that uses setPosSetpoint | |
void | setAccelPosDelta (float _posDelta, bool _run=true, bool _resetPos=false) |
void | setOpenVel (float vel, bool _run=true) |
set velocity without closed loop control | |
void | setOpenVelTarget (float vel, bool _run=true) |
set velocity without closed loop control, with limited acceleration | |
float | getSpeedError () |
float | getPosTarget () |
get position set as target (for smoothed position setting mode) | |
float | getPosSetpoint () |
get position controller is currently trying to get to | |
float | getVelTarget () |
get target velocity for controller | |
float | getPosDeltaSetpoint () |
float | getLastPosSetpoint () |
float | getTime () |
float | getDistFromSetpointLimit () |
void | setDistFromSetpointLimit (float _distFromSetpointLimit) |
float | getVelSetpoint () |
returns how fast the motor driver is told to move | |
float | getVel () |
get current velocity of motor | |
float | getPos () |
get what position the motor is currently at | |
float | resetPos () |
reset what position the controller thinks it's in | |
bool | isPosModeNotVelocity () |
true if controller is in position target mode, false if in velocity mode | |
bool | isClosedLoop () |
void | setAccelLimit (float _accelLimit) |
set maximum rate that motor speed can be changed at | |
void | setVelLimit (float _velLimit) |
set maximum motor speed | |
float | getAccelLimit () |
returns value of accelLimit | |
float | getVelLimit () |
returns value of velLimit | |
void | setPreventGoingWrongWay (bool _preventGoingWrongWay) |
void | setMaxStoppingDecel (float _maxStoppingDecel) |
float | getDriverSetVal () |
returns the value the motor driver is being set to | |
bool | setEnable (bool _enable) |
change whether motor controller is enabled | |
void | setMaxDriverRangeAmount (float _driverRangeAmount) |
set what fraction of driverRange can be used | |
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 | |
Public Attributes | |
Derivs_Limiter | posSetpointSmoother |
JControlLoop & | controlLoop |
Protected Attributes | |
JMotorDriver & | driver |
JMotorCompensator & | compensator |
JEncoder & | encoder |
float | velLimit |
float | accelLimit |
float | setVal |
bool | driverInRange |
bool | open |
unsigned long | lastRunMicros |
float | velSetpoint |
float | velSetpointTarget |
bool | posMode |
float | posSetpoint |
bool | smoothed |
float | posDeltaSetpoint |
float | posDeltaSetpointTarget |
bool | limitSetpointDistFromCurrent |
float | distFromSetpointLimit |
float | lastPosSetpoint |
float | time |
closed loop (uses encoder) motor controller
|
inline |
Constructor for closed loop motor controller.
_driver | (JMotorDriver&) |
_compensator | (JMotorCompensator&) |
_encoder | (JEncoder) |
_controlLoop | (JControlLoop) |
_velLimit | (float) default=INFINITY, |
_accelLimit | (float) default=INFINITY, |
_distFromSetpointLimit | (float)= 1.0, |
_preventGoingWrongWay | (bool) default=true, |
_maxStoppingDecel | (float) default=2, |
|
inlinevirtual |
|
inlinevirtual |
|
inlinevirtual |
|
inline |
|
inlinevirtual |
if getDriverSetVal exceeds this, isDriverInRange will go false
(float) |
Implements JMotorControllerBase.
|
inlinevirtual |
if getDriverSetVal goes below this, isDriverInRange will go false
(float) |
Implements JMotorControllerBase.
|
inlinevirtual |
returns the value the motor driver is being set to
(float) |
Implements JMotorControllerBase.
|
inlinevirtual |
|
inline |
|
inlinevirtual |
How fast of a motor speed setting would get adjusted to full motor power.
(float) |
Implements JMotorControllerBase.
|
inlinevirtual |
slowest speed motor can go
Implements JMotorControllerBase.
|
inlinevirtual |
|
inline |
|
inlinevirtual |
get position controller is currently trying to get to
(float) |
Implements JMotorController.
|
inlinevirtual |
get position set as target (for smoothed position setting mode)
(float) |
Implements JMotorController.
|
inline |
|
inline |
|
inlinevirtual |
|
inlinevirtual |
|
inline |
returns how fast the motor driver is told to move
(float) |
|
inlinevirtual |
get target velocity for controller
(float) | current velocity target |
Implements JMotorControllerBase.
|
inline |
|
inlinevirtual |
true if motor driver is being set to within its range, false if driver is at a maximum
(bool) |
Implements JMotorControllerBase.
|
inlinevirtual |
true if controller is in position target mode, false if in velocity mode
(bool) |
Implements JMotorController.
|
inlinevirtual |
reset what position the controller thinks it's in
(float) | returns old position |
Implements JMotorController.
|
inlinevirtual |
|
inlinevirtual |
set maximum rate that motor speed can be changed at
_accelLimit | (float) |
Implements JMotorControllerBase.
|
inline |
|
inline |
|
inlinevirtual |
change whether motor controller is enabled
_enable | (bool) |
(bool) | true if state changed |
Implements JMotorControllerBase.
|
inlinevirtual |
set what fraction of driverRange can be used
_driverRangeAmount | (float) |
Implements JMotorControllerBase.
|
inline |
|
inline |
|
inline |
|
inlinevirtual |
alternative method for setting velocity that uses setPosSetpoint
_posDelta | (float) basically velocity |
_resetPos | (bool) default=false, keep setting current position to zero |
_run | (bool) default:true, true = call run() in this function, false = you'll call run() yourself |
(bool) | did the setting change? |
Implements JMotorController.
|
inlinevirtual |
set position for motor to drive towards position as fast as possible (setpoint for control loop if available)
_posSetpoint | (float) position setpoint |
_run | (bool) default:true, true = call run() in this function, false = you'll call run() yourself |
(bool) | did the setpoint change? |
Implements JMotorController.
|
inlinevirtual |
set target position (motor drives towards position, following acceleration profile)
_posTarget | (float) target position |
_run | (bool) default:true, true = call run() in this function, false = you'll call run() yourself |
(bool) | did the target change? |
Implements JMotorController.
|
inline |
|
inline |
|
inlinevirtual |
set velocity for controller
vel | (float) |
_run | (bool) default:true, true = call run() in this function, false = you'll call run() yourself |
Implements JMotorControllerBase.
|
inlinevirtual |
set maximum motor speed
_velLimit | (float) |
Implements JMotorController.
|
inlinevirtual |
set target velocity for controller (acceleration limited)
vel | (float) target velocity |
_run | (bool) default:true, true = call run() in this function, false = you'll call run() yourself |
Implements JMotorControllerBase.
|
protected |
|
protected |
JControlLoop& JMotorControllerClosed::controlLoop |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
Derivs_Limiter JMotorControllerClosed::posSetpointSmoother |
Derivs_Limiter object, used for smoothly driving to position
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |