lejos.robotics
Interface TachoMotor

All Superinterfaces:
DCMotor, Encoder, Tachometer
All Known Implementing Classes:
Motor, RemoteMotor

public interface TachoMotor
extends Tachometer, DCMotor

Interface for encoded motors without limited range of movement (e.g. NXT motor). TODO: Alternate names: EncodedMotor,EncoderMotor.

Author:
dsturze

Method Summary
 int getSpeed()
          Returns the current motor speed.
 void regulateSpeed(boolean activate)
          Turns speed regulation on/off.
 void rotate(int angle)
          Causes motor to rotate by a specified angle.
 void rotate(int angle, boolean immediateReturn)
          causes motor to rotate through angle;
iff immediateReturn is true, method returns immediately and the motor stops by itself
If any motor method is called before the limit is reached, the rotation is canceled.
 void rotateTo(int limitAngle)
          Causes motor to rotate to limitAngle;
Then getTachoCount should be within +- 2 degrees of the limit angle when the method returns
 void rotateTo(int limitAngle, boolean immediateReturn)
          causes motor to rotate to limitAngle;
if immediateReturn is true, method returns immediately and the motor stops by itself
and getTachoCount should be within +- 2 degrees if the limit angle If any motor method is called before the limit is reached, the rotation is canceled.
 void setSpeed(int speed)
          Set motor speed.
 void smoothAcceleration(boolean activate)
          Enables smoother acceleration.
 
Methods inherited from interface lejos.robotics.Tachometer
getRotationSpeed
 
Methods inherited from interface lejos.robotics.Encoder
getTachoCount, resetTachoCount
 
Methods inherited from interface lejos.robotics.DCMotor
backward, flt, forward, isMoving, stop
 

Method Detail

rotate

void rotate(int angle,
            boolean immediateReturn)
causes motor to rotate through angle;
iff immediateReturn is true, method returns immediately and the motor stops by itself
If any motor method is called before the limit is reached, the rotation is canceled. When the angle is reached, the method isRotating() returns false;

Parameters:
angle - through which the motor will rotate
immediateReturn - iff true, method returns immediately, thus allowing monitoring of sensors in the calling thread.
See Also:
rotate(int, boolean)

rotate

void rotate(int angle)
Causes motor to rotate by a specified angle. The resulting tachometer count should be within +- 2 degrees on the NXT. This method does not return until the rotation is completed.

Parameters:
angle - by which the motor will rotate.

rotateTo

void rotateTo(int limitAngle)
Causes motor to rotate to limitAngle;
Then getTachoCount should be within +- 2 degrees of the limit angle when the method returns

Parameters:
limitAngle - to which the motor will rotate, and then stop (in degrees). Includes any positive or negative int, even values > 360.

rotateTo

void rotateTo(int limitAngle,
              boolean immediateReturn)
causes motor to rotate to limitAngle;
if immediateReturn is true, method returns immediately and the motor stops by itself
and getTachoCount should be within +- 2 degrees if the limit angle If any motor method is called before the limit is reached, the rotation is canceled. When the angle is reached, the method isRotating() returns false;

Parameters:
limitAngle - to which the motor will rotate, and then stop (in degrees). Includes any positive or negative int, even values > 360.
immediateReturn - iff true, method returns immediately, thus allowing monitoring of sensors in the calling thread.

setSpeed

void setSpeed(int speed)
Set motor speed. As a rule of thumb 100 degrees per second are possible for each volt on an NXT motor.

Parameters:
speed - in degrees per second.

getSpeed

int getSpeed()
Returns the current motor speed.

Returns:
motor speed in degrees per second

regulateSpeed

void regulateSpeed(boolean activate)
Turns speed regulation on/off. Cumulative speed error is within about 1 degree after initial acceleration on the NXT.

Parameters:
activate - is true for speed regulation.

smoothAcceleration

void smoothAcceleration(boolean activate)
Enables smoother acceleration. Motor speed increases gently, and does not overshoot when regulate Speed is used.

Parameters:
activate - is true for smooth acceleration.