public interface MotorRegulator
Modifier and Type | Field and Description |
---|---|
static int |
NO_LIMIT |
Modifier and Type | Method and Description |
---|---|
void |
addListener(RegulatedMotor motor,
RegulatedMotorListener listener)
Add a motor listener.
|
void |
adjustAcceleration(int newAcc)
The target acceleration has been changed.
|
void |
adjustSpeed(float newSpeed)
The target speed has been changed.
|
void |
endSynchronization(boolean b)
Complete a set of synchronized motor operations.
|
float |
getCurrentVelocity()
Return the current velocity (in degrees/second) that the motor is currently
running at.
|
int |
getLimitAngle()
Return the angle that this Motor is rotating to.
|
float |
getPosition()
return the regulations models current position.
|
int |
getTachoCount()
Get the current hardware tachometer reading for the motor,
|
boolean |
isMoving()
Return true if the motor is currently active
|
boolean |
isStalled()
Return true if the motor is currently stalled.
|
void |
newMove(float speed,
int acceleration,
int limit,
boolean hold,
boolean waitComplete)
Initiate a new move and optionally wait for it to complete.
|
RegulatedMotorListener |
removeListener() |
void |
resetTachoCount()
Reset the tachometer base value, after this call the tachometer will return
zero for the current position.
|
void |
setControlParamaters(int typ,
float moveP,
float moveI,
float moveD,
float holdP,
float holdI,
float holdD,
int offset)
Set the motion control parameters used by the regulator.
|
void |
setStallThreshold(int error,
int time)
Set the stall detection parameters.
|
void |
startSynchronization()
Begin a set of synchronized motor operations
|
void |
synchronizeWith(MotorRegulator[] rl)
Specify a set of motors that should be kept in synchronization with this one.
|
void |
waitComplete()
Wait until the current movement operation is complete (this can include
the motor stalling).
|
static final int NO_LIMIT
void setControlParamaters(int typ, float moveP, float moveI, float moveD, float holdP, float holdI, float holdD, int offset)
typ
- The type of motormoveP
- The Proportional control value used while movingmoveI
- The integral control parameter used while movingmoveD
- The differential control parameter used while movingholdP
- The Proportional control value used while holding positionholdI
- The integral control value used while holding positionholdD
- The differential control value used while holding positionoffset
- Motor PWM offset value range 0-10000.int getTachoCount()
void resetTachoCount()
boolean isMoving()
float getCurrentVelocity()
void setStallThreshold(int error, int time)
error
- time
- float getPosition()
void newMove(float speed, int acceleration, int limit, boolean hold, boolean waitComplete)
speed
- acceleration
- limit
- hold
- waitComplete
- void adjustSpeed(float newSpeed)
newSpeed
- new target speed.void adjustAcceleration(int newAcc)
newAcc
- void waitComplete()
void addListener(RegulatedMotor motor, RegulatedMotorListener listener)
motor
- listener
- RegulatedMotorListener removeListener()
int getLimitAngle()
boolean isStalled()
void startSynchronization()
void endSynchronization(boolean b)
void synchronizeWith(MotorRegulator[] rl)
rl
- an array of motors to synchronize with.