Package lejos.hardware.device.tetrix
Class TetrixMotor
- java.lang.Object
-
- lejos.hardware.device.tetrix.TetrixMotor
-
- Direct Known Subclasses:
TetrixEncoderMotor
public class TetrixMotor extends java.lang.Object implements DCMotor
Tetrix basic DC motor abstraction without encoder support. The default power at instantiation is 100%.Use
to retrieve aTetrixMotorController.getBasicMotor(int)TetrixMotorinstance.- Author:
- Kirk P. Thompson
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidbackward()Causes motor to rotate backwards untilstop()orflt()is called.voidflt()Motor loses all power, causing the rotor to float freely to a stop.voidforward()Causes motor to rotate forward untilstop()orflt()is called.intgetPower()Returns the current motor power setting.booleanisMoving()Returntrueif the motor is moving.voidsetPower(int power)Set the power level 0%-100% to be applied to the motorvoidsetReverse(boolean reverse)Used to alter the forward/reverse direction mapping for the motor output.voidstop()Causes motor to stop immediately.
-
-
-
Method Detail
-
setPower
public void setPower(int power)
Description copied from interface:DCMotorSet the power level 0%-100% to be applied to the motor
-
getPower
public int getPower()
Description copied from interface:DCMotorReturns the current motor power setting.
-
forward
public void forward()
Description copied from interface:BaseMotorCauses motor to rotate forward untilstop()orflt()is called.
-
backward
public void backward()
Description copied from interface:BaseMotorCauses motor to rotate backwards untilstop()orflt()is called.
-
stop
public void stop()
Description copied from interface:BaseMotorCauses motor to stop immediately. It will resist any further motion. Cancels any rotate() orders in progress.
-
flt
public void flt()
Description copied from interface:BaseMotorMotor loses all power, causing the rotor to float freely to a stop. This is not the same as stopping, which locks the rotor.
-
isMoving
public boolean isMoving()
Returntrueif the motor is moving. Note that this method reports based on the current control state (i.e. commanded to move) and not if the motor is actually moving. This means a motor may be stalled but this method would returntrue.
-
setReverse
public void setReverse(boolean reverse)
Used to alter the forward/reverse direction mapping for the motor output. This is primarily intended to harmonize the forward and reverse directions for motors on opposite sides of a skid-steer chassis.Changes to this setting take effect on the next motor command.
- Parameters:
reverse-trueto reverse direction mapping for this motor
-
-