lejos.nxt
Class NXTRegulatedMotor.Regulator
java.lang.Object
lejos.nxt.NXTRegulatedMotor.Regulator
- Enclosing class:
- NXTRegulatedMotor
protected class NXTRegulatedMotor.Regulator
- extends Object
Inner class to regulate velocity; also stop motor at desired rotation angle.
This class uses a very simple movement model based on simple linear
acceleration. This model is used to generate ideal target positions which
are then used to generate error terms between the actual and target position
this error term is then used to drive a PID style motor controller to
regulate the power supplied to the motor.
If new command are issued while a move is in progress, the new command
is blended with the current one to provide smooth movement.
If the requested speed is not possible then the controller will simply
drop move cycles until the motor catches up with the ideal position. If
too many consecutive dropped moves are required then the motor is viewed
to have stalled and the move is terminated.
Once the motor stops, the final position is held using the same PID control
mechanism (with slightly different parameters), as that used for movement.
Method Summary |
void |
newMove(float speed,
int acceleration,
int limit,
boolean hold,
boolean waitComplete)
Initiate a new move and optionally wait for it to complete. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
power
public int power
NXTRegulatedMotor.Regulator
protected NXTRegulatedMotor.Regulator()
newMove
public void newMove(float speed,
int acceleration,
int limit,
boolean hold,
boolean waitComplete)
- Initiate a new move and optionally wait for it to complete.
If some other move is currently executing then ensure that this move
is terminated correctly and then start the new move operation.
- Parameters:
speed
- acceleration
- limit
- hold
- waitComplete
-