|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectlejos.nxt.remote.RemoteMotor
public class RemoteMotor
Motor class. Contains three instances of Motor. Usage: Motor.A.forward(500);
| Field Summary | |
|---|---|
protected RegulatedMotorListener |
listener
|
byte |
turnRatio
|
| Constructor Summary | |
|---|---|
RemoteMotor(NXTCommand nxtCommand,
int id)
|
|
| Method Summary | |
|---|---|
void |
addListener(RegulatedMotorListener listener)
Currently not completely implemented in RemoteMotor! |
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 |
flt(boolean returnNow)
Set the motor into float mode. |
void |
forward()
Causes motor to rotate forward until stop() or flt() is called. |
int |
getBlockTacho()
Deprecated. |
char |
getId()
Get the ID of the motor. |
int |
getLimitAngle()
RegulatedMotor for NXT need this |
float |
getMaxSpeed()
Returns the maximim speed of the motor. |
int |
getPower()
Return the power that the motor is set to |
int |
getRotationCount()
Deprecated. |
int |
getRotationSpeed()
Returns the actual speed. |
int |
getSpeed()
Returns the current motor speed. |
int |
getTachoCount()
Returns the tachometer count. |
boolean |
isMoving()
Return true if the motor is moving. |
boolean |
isRotating()
CURRENTLY NOT IMPLEMENTED! Use isMoving() for now. |
boolean |
isStalled()
returns true if motor is stalled |
void |
regulateSpeed(boolean yes)
|
RegulatedMotorListener |
removeListener()
Removes the RegulatedMotorListener from this class. |
int |
resetBlockTacho()
Deprecated. |
void |
resetTachoCount()
Reset the tachometer count. |
void |
rotate(int count)
Causes motor to rotate by a specified angle. |
void |
rotate(int count,
boolean returnNow)
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 returnNow)
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 |
setAcceleration(int acceleration)
Set the required rate of acceleration degrees/s/s |
void |
setPower(int power)
Sets the power of the motor |
void |
setRegulationMode(int mode)
This method determines if and how the motor will be regulated. |
void |
setSpeed(int speed)
Set motor speed. |
void |
setStallThreshold(int error,
int time)
Set the parameters for detecting a stalled motor. |
void |
smoothAcceleration(boolean yes)
|
void |
stop()
Causes motor to stop immediately. |
void |
stop(boolean returnNow)
Causes motor to stop, pretty much instantaneously. |
void |
waitComplete()
Wait until the current movement operation is complete (this can include the motor stalling). |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public byte turnRatio
protected RegulatedMotorListener listener
| Constructor Detail |
|---|
public RemoteMotor(NXTCommand nxtCommand,
int id)
| Method Detail |
|---|
public final char getId()
public void forward()
BaseMotorstop() or flt() is called.
forward in interface BaseMotorpublic void backward()
BaseMotorstop() or flt() is called.
backward in interface BaseMotorpublic void setSpeed(int speed)
RegulatedMotor
setSpeed in interface RegulatedMotorspeed - in degrees per second.public void setPower(int power)
setPower in interface DCMotorpower - the power (-100 to +100)public int getSpeed()
RegulatedMotor
getSpeed in interface RegulatedMotorpublic int getPower()
getPower in interface DCMotorpublic int getTachoCount()
Encoder
getTachoCount in interface Encoder@Deprecated public int getRotationCount()
@Deprecated public int getBlockTacho()
public void rotate(int count,
boolean returnNow)
RegulatedMotor
rotate in interface RegulatedMotorcount - through which the motor will rotatereturnNow - iff true, method returns immediately, thus allowing monitoring of sensors in the calling thread.RegulatedMotor.rotate(int, boolean)public boolean isMoving()
BaseMotortrue if the motor is moving.
isMoving in interface BaseMotortrue if the motor is currently in motion, false if stopped.public void waitComplete()
RegulatedMotor
waitComplete in interface RegulatedMotorpublic boolean isRotating()
public void rotate(int count)
RegulatedMotor
rotate in interface RegulatedMotorcount - by which the motor will rotate.public void setRegulationMode(int mode)
mode - See NXTProtocol for enumerations: REGULATION_MODE_MOTOR_SYNC,
REGULATION_MODE_MOTOR_SPEED, REGULATION_MODE_IDLEpublic void rotateTo(int limitAngle)
RegulatedMotor
rotateTo in interface RegulatedMotorlimitAngle - to which the motor will rotate, and then stop (in degrees). Includes any positive or negative int, even values > 360.
public void rotateTo(int limitAngle,
boolean returnNow)
RegulatedMotor
rotateTo in interface RegulatedMotorlimitAngle - to which the motor will rotate, and then stop (in degrees). Includes any positive or negative int, even values > 360.returnNow - iff true, method returns immediately, thus allowing monitoring of sensors in the calling thread.public int getLimitAngle()
getLimitAngle in interface RegulatedMotorpublic void resetTachoCount()
Encoder
resetTachoCount in interface Encoder@Deprecated public int resetBlockTacho()
public void stop(boolean returnNow)
RegulatedMotor
stop in interface RegulatedMotorreturnNow - if true do not wait for the motor to actually stoppublic void stop()
BaseMotor
stop in interface BaseMotorpublic void flt(boolean returnNow)
RegulatedMotor
flt in interface RegulatedMotorreturnNow - If true do not wait for the motor to actually stoppublic void flt()
BaseMotor
flt in interface BaseMotorpublic void regulateSpeed(boolean yes)
public void smoothAcceleration(boolean yes)
public int getRotationSpeed()
Tachometer
getRotationSpeed in interface Tachometerpublic void addListener(RegulatedMotorListener listener)
addListener in interface RegulatedMotorpublic RegulatedMotorListener removeListener()
RegulatedMotor
removeListener in interface RegulatedMotorpublic boolean isStalled()
RegulatedMotor
isStalled in interface RegulatedMotorpublic void setAcceleration(int acceleration)
RegulatedMotor
setAcceleration in interface RegulatedMotorpublic float getMaxSpeed()
RegulatedMotor
getMaxSpeed in interface RegulatedMotor
public void setStallThreshold(int error,
int time)
RegulatedMotor
setStallThreshold in interface RegulatedMotorerror - The error thresholdtime - The time that the error threshold needs to be exceeded for.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||