|
JMotor
|
This class controls velocity and position of a motor without any encoder feedback. More...
#include <JMotorControllerOpen.h>


Public Member Functions | |
| JMotorControllerOpen (JMotorDriver &_driver, JMotorCompensator &_compensator, float _velLimit=INFINITY, float _accelLimit=INFINITY, unsigned long _minMotorPulseTime=0) | |
| Constructor for an object that controls a motor, and can smooth the motion of the motor and go approximately to a position. | |
| void | run () |
| update driver | |
| bool | setEnable (bool _enable) |
| change whether motor controller is enabled | |
| bool | setPosTarget (float _posTarget, bool _run=true) |
| set target position (motor drives towards position, following acceleration profile) | |
| 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 | |
| float | getPosTarget () |
| get position set as target (for smoothed position setting mode) | |
| float | getPosSetpoint () |
| get position controller is currently trying to get to | |
| 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 | |
| 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) | |
| void | setVelLimit (float _velLimit) |
| set maximum motor speed | |
| void | setAccelLimit (float _accelLimit) |
| set maximum rate that motor speed can be changed at | |
| void | setVelAccelLimits (float _vel, float _accel) |
| set velocity and acceleration limits for motor | |
| void | setMinMotorPulseTime (unsigned long _minMotorPulseTime) |
| At low speeds in setPosDelta the motor cycles between min speed and stopped. What is the minimum pulse that makes the motor move, in MICROseconds? | |
Public Member Functions inherited from JMotorControllerBasic | |
| JMotorControllerBasic (JMotorDriver &_driver, JMotorCompensator &_compensator, float _velLimit=INFINITY, float _accelLimit=INFINITY) | |
| constructor | |
| 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 | |
| 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 | |
Public Attributes | |
| Derivs_Limiter | dL |
| use functions from JMotorControllerOpen whenever possible, but the Derivs_Limiter object is public in case you need to change a setting like dL.setPreventGoingWrongWay() | |
Protected Attributes | |
| bool | posMode |
| bool | smoothedMode |
| float | position |
| float | positionTarget |
| float | posDelta |
| unsigned long | lastRunOpenMicros |
| unsigned long | minMotorPulseTime |
| unsigned long | lastPosDeltaWrite |
Protected Attributes inherited from JMotorControllerBasic | |
| float | velocity |
| float | setVal |
| float | velocityTarget |
| float | accelLimit |
| float | velLimit |
| unsigned long | lastRunMicros |
| JMotorDriver & | driver |
| bool | driverInRange |
| JMotorCompensator & | compensator |
This class controls velocity and position of a motor without any encoder feedback.
|
inline |
Constructor for an object that controls a motor, and can smooth the motion of the motor and go approximately to a position.
| _driver | reference to a JMotorDriver |
| _compensator | reference to a JMotorCompensator |
| _velLimit | float, default INFINITY |
| _accelLimit | float, default INFINITY |
| _minMotorPulseTime | unsigned long, default 0. At low speeds in setPosDelta the motor cycles between min speed and stopped. What is the minimum pulse that makes the motor move, in MICROseconds? |
|
inlinevirtual |
|
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.
|
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.
|
inlinevirtual |
change whether motor controller is enabled
| _enable | (bool) |
| (bool) | true if state changed |
Implements JMotorControllerBase.
|
inline |
At low speeds in setPosDelta the motor cycles between min speed and stopped. What is the minimum pulse that makes the motor move, in MICROseconds?
| _minMotorPulseTime | unsigned long |
|
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.
|
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.
|
inline |
set velocity and acceleration limits for motor
| _vel | |
| _accel |
| None |
|
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.
| Derivs_Limiter JMotorControllerOpen::dL |
use functions from JMotorControllerOpen whenever possible, but the Derivs_Limiter object is public in case you need to change a setting like dL.setPreventGoingWrongWay()
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |