lejos.nxt.addon.tetrix
Class TetrixMotor

java.lang.Object
  extended by lejos.nxt.addon.tetrix.TetrixMotor
All Implemented Interfaces:
BaseMotor, DCMotor
Direct Known Subclasses:
TetrixEncoderMotor

public class TetrixMotor
extends Object
implements DCMotor

Tetrix basic DC motor abstraction without encoder support. The default power at instantiation is 100%.

Use TetrixMotorController.getBasicMotor(int) to retrieve a TetrixMotor instance.

Author:
Kirk P. Thompson

Method Summary
 void backward()
          Causes motor to rotate backwards until stop() or flt() is called.
 void flt()
          Motor loses all power, causing the rotor to float freely to a stop.
 void forward()
          Causes motor to rotate forward until stop() or flt() is called.
 int getPower()
          Returns the current motor power setting.
 boolean isMoving()
          Return true if the motor is moving.
 void setPower(int power)
          Set the power level 0%-100% to be applied to the motor
 void setReverse(boolean reverse)
          Used to alter the forward/reverse direction mapping for the motor output.
 void stop()
          Causes motor to stop immediately.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

setPower

public void setPower(int power)
Description copied from interface: DCMotor
Set the power level 0%-100% to be applied to the motor

Specified by:
setPower in interface DCMotor
Parameters:
power - new motor power 0-100

getPower

public int getPower()
Description copied from interface: DCMotor
Returns the current motor power setting.

Specified by:
getPower in interface DCMotor
Returns:
current power 0-100

forward

public void forward()
Description copied from interface: BaseMotor
Causes motor to rotate forward until stop() or flt() is called.

Specified by:
forward in interface BaseMotor

backward

public void backward()
Description copied from interface: BaseMotor
Causes motor to rotate backwards until stop() or flt() is called.

Specified by:
backward in interface BaseMotor

stop

public void stop()
Description copied from interface: BaseMotor
Causes motor to stop immediately. It will resist any further motion. Cancels any rotate() orders in progress.

Specified by:
stop in interface BaseMotor

flt

public void flt()
Description copied from interface: BaseMotor
Motor loses all power, causing the rotor to float freely to a stop. This is not the same as stopping, which locks the rotor.

Specified by:
flt in interface BaseMotor

isMoving

public boolean isMoving()
Return true if 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 return true.

Specified by:
isMoving in interface BaseMotor
Returns:
true if the motor is executing a movement command, false if stopped.

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 - true to reverse direction mapping for this motor