public class RemoteRequestRegulatedMotor extends java.lang.Object implements RegulatedMotor
Constructor and Description |
---|
RemoteRequestRegulatedMotor(java.io.ObjectInputStream is,
java.io.ObjectOutputStream os,
java.lang.String portName,
char motorType) |
Modifier and Type | Method and Description |
---|---|
void |
addListener(RegulatedMotorListener listener)
Adds a listener object that will be notified when rotation has started or stopped
|
void |
backward()
Causes motor to rotate backwards until
stop() or flt() is called. |
void |
close()
Close the port, the port can not be used after this call.
|
void |
endSynchronization()
Complete a set of synchronized motor operations.
|
void |
flt()
Motor loses all power, causing the rotor to float freely to a stop.
|
void |
flt(boolean immediateReturn)
Set the motor into float mode.
|
void |
forward()
Causes motor to rotate forward until
stop() or flt() is called. |
int |
getLimitAngle()
Return the limit angle (if any)
|
float |
getMaxSpeed()
Returns the maximum speed that can be maintained by the regulation system based upon the
current state of the battery.
|
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 |
isStalled()
returns true if motor is stalled
|
RegulatedMotorListener |
removeListener()
Removes the RegulatedMotorListener from this class.
|
void |
resetTachoCount()
Reset the tachometer count.
|
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 |
setAcceleration(int acceleration)
Set the required rate of acceleration degrees/s/s
|
void |
setSpeed(int speed)
Set motor speed.
|
void |
setStallThreshold(int error,
int time)
Set the parameters for detecting a stalled motor.
|
void |
startSynchronization()
Begin a set of synchronized motor operations
|
void |
stop()
Causes motor to stop immediately.
|
void |
stop(boolean immediateReturn)
Causes motor to stop, pretty much
instantaneously.
|
void |
synchronizeWith(RegulatedMotor[] syncList)
Specify a set of motors that should be kept in synchronization with this one.
|
void |
waitComplete()
Wait until the current movement operation is complete (this can include
the motor stalling).
|
public RemoteRequestRegulatedMotor(java.io.ObjectInputStream is, java.io.ObjectOutputStream os, java.lang.String portName, char motorType)
public void forward()
BaseMotor
stop()
or flt()
is called.public void backward()
BaseMotor
stop()
or flt()
is called.public void stop()
BaseMotor
public void flt()
BaseMotor
public boolean isMoving()
BaseMotor
true
if the motor is moving.public int getRotationSpeed()
Tachometer
getRotationSpeed
in interface Tachometer
public int getTachoCount()
Encoder
getTachoCount
in interface Encoder
public void resetTachoCount()
Encoder
resetTachoCount
in interface Encoder
public void addListener(RegulatedMotorListener listener)
RegulatedMotor
addListener
in interface RegulatedMotor
public RegulatedMotorListener removeListener()
RegulatedMotor
removeListener
in interface RegulatedMotor
public void stop(boolean immediateReturn)
RegulatedMotor
stop
in interface RegulatedMotor
immediateReturn
- if true do not wait for the motor to actually stoppublic void flt(boolean immediateReturn)
RegulatedMotor
flt
in interface RegulatedMotor
immediateReturn
- If true do not wait for the motor to actually stoppublic void waitComplete()
RegulatedMotor
waitComplete
in interface RegulatedMotor
public void rotate(int angle, boolean immediateReturn)
RegulatedMotor
rotate
in interface RegulatedMotor
angle
- through which the motor will rotateimmediateReturn
- iff true, method returns immediately, thus allowing monitoring of sensors in the calling thread.RegulatedMotor.rotate(int, boolean)
public void rotate(int angle)
RegulatedMotor
rotate
in interface RegulatedMotor
angle
- by which the motor will rotate.public void rotateTo(int limitAngle)
RegulatedMotor
rotateTo
in interface RegulatedMotor
limitAngle
- 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 immediateReturn)
RegulatedMotor
rotateTo
in interface RegulatedMotor
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.public int getLimitAngle()
RegulatedMotor
getLimitAngle
in interface RegulatedMotor
public void setSpeed(int speed)
RegulatedMotor
setSpeed
in interface RegulatedMotor
speed
- in degrees per second.public int getSpeed()
RegulatedMotor
getSpeed
in interface RegulatedMotor
public float getMaxSpeed()
RegulatedMotor
getMaxSpeed
in interface RegulatedMotor
public boolean isStalled()
RegulatedMotor
isStalled
in interface RegulatedMotor
public void setStallThreshold(int error, int time)
RegulatedMotor
setStallThreshold
in interface RegulatedMotor
error
- The error thresholdtime
- The time that the error threshold needs to be exceeded for.public void setAcceleration(int acceleration)
RegulatedMotor
setAcceleration
in interface RegulatedMotor
public void close()
RegulatedMotor
close
in interface java.io.Closeable
close
in interface java.lang.AutoCloseable
close
in interface RegulatedMotor
public void synchronizeWith(RegulatedMotor[] syncList)
RegulatedMotor
synchronizeWith
in interface RegulatedMotor
syncList
- an array of motors to synchronize with.public void startSynchronization()
RegulatedMotor
startSynchronization
in interface RegulatedMotor
public void endSynchronization()
RegulatedMotor
endSynchronization
in interface RegulatedMotor