Package lejos.hardware.device.tetrix
Class TetrixEncoderMotor
- java.lang.Object
-
- lejos.hardware.device.tetrix.TetrixMotor
-
- lejos.hardware.device.tetrix.TetrixEncoderMotor
-
- Direct Known Subclasses:
TetrixRegulatedMotor
public class TetrixEncoderMotor extends TetrixMotor implements Encoder
Tetrix DC motor abstraction with encoder support. The Tetrix motor must have an encoder installed and connected to the controller for the methods in this class to work. If an encoder is not installed, use theclass instead.TetrixMotorUse
to retrieve aTetrixMotorController.getEncoderMotor(int)TetrixEncoderMotorinstance.- Author:
- Kirk P. Thompson
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intgetLimitAngle()Return the last angle that this motor was rotating to via one of the rotate methods.intgetTachoCount()Returns the tachometer count.voidresetTachoCount()Reset the the tachometer count.voidrotate(int degrees, boolean immediateReturn)Rotate by the requested number of degrees with option for wait until completion or immediate return where the motor completes its rotation asynchronously.voidrotateTo(int limitAngle, boolean immediateReturn)Rotate to the target angle with option for wait until completion or immediate return where the motor completes its rotation asynchronously.voidsetRegulate(boolean regulate)Disable or Enable internal motor controller speed regulation.-
Methods inherited from class lejos.hardware.device.tetrix.TetrixMotor
backward, flt, forward, getPower, isMoving, setPower, setReverse, stop
-
-
-
-
Method Detail
-
getTachoCount
public int getTachoCount()
Description copied from interface:EncoderReturns the tachometer count.- Specified by:
getTachoCountin interfaceEncoder- Returns:
- tachometer count in degrees
-
resetTachoCount
public void resetTachoCount()
Reset the the tachometer count. Calling this method will stop any current motor action. This is imposed by the HiTechic Motor Controller firmware.- Specified by:
resetTachoCountin interfaceEncoder
-
rotate
public void rotate(int degrees, boolean immediateReturn)Rotate by the requested number of degrees with option for wait until completion or immediate return where the motor completes its rotation asynchronously.- Parameters:
degrees- number of degrees to rotate relative to the current position.immediateReturn- iftrue, do not wait for the move to complete.falsewill block until the rotation completes.
-
rotateTo
public void rotateTo(int limitAngle, boolean immediateReturn)Rotate to the target angle with option for wait until completion or immediate return where the motor completes its rotation asynchronously.- Parameters:
limitAngle- Angle [in degrees] to rotate to.immediateReturn- iftrue, do not wait for the move to complete.falsewill block until the rotation completes.
-
getLimitAngle
public int getLimitAngle()
Return the last angle that this motor was rotating to via one of the rotate methods.- Returns:
- angle in degrees
-
setRegulate
public void setRegulate(boolean regulate)
Disable or Enable internal motor controller speed regulation. Setting this totruewill cause the motor controller firmware to adjust the motor power to compensate for changing loads in order to maintain a constant motor speed. Default at instantiation isfalse.- Parameters:
regulate-trueto enable regulation,falseotherwise.
-
-