public class RMIRemoteRegulatedMotor extends java.rmi.server.UnicastRemoteObject implements RMIRegulatedMotor
Modifier | Constructor and Description |
---|---|
protected |
RMIRemoteRegulatedMotor(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() |
void |
close() |
void |
flt(boolean immediateReturn)
Set the motor into float mode.
|
void |
forward() |
int |
getLimitAngle()
Return the limit angle (if any)
|
float |
getMaxSpeed()
Returns the maximim speed of the motor.
|
int |
getSpeed()
Returns the current motor speed.
|
int |
getTachoCount() |
boolean |
isMoving() |
boolean |
isStalled()
returns true if motor is stalled
|
RegulatedMotorListener |
removeListener()
Removes the RegulatedMotorListener from this class.
|
void |
resetTachoCount() |
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 |
stop(boolean immediateReturn)
Causes motor to stop, pretty much
instantaneously.
|
void |
waitComplete()
Wait until the current movement operation is complete (this can include
the motor stalling).
|
clone, exportObject, exportObject, exportObject, unexportObject
protected RMIRemoteRegulatedMotor(java.lang.String portName, char motorType) throws java.rmi.RemoteException
java.rmi.RemoteException
public void addListener(RegulatedMotorListener listener) throws java.rmi.RemoteException
RMIRegulatedMotor
addListener
in interface RMIRegulatedMotor
java.rmi.RemoteException
public RegulatedMotorListener removeListener() throws java.rmi.RemoteException
RMIRegulatedMotor
removeListener
in interface RMIRegulatedMotor
java.rmi.RemoteException
public void stop(boolean immediateReturn) throws java.rmi.RemoteException
RMIRegulatedMotor
stop
in interface RMIRegulatedMotor
immediateReturn
- if true do not wait for the motor to actually stopjava.rmi.RemoteException
public void flt(boolean immediateReturn) throws java.rmi.RemoteException
RMIRegulatedMotor
flt
in interface RMIRegulatedMotor
immediateReturn
- If true do not wait for the motor to actually stopjava.rmi.RemoteException
public void waitComplete() throws java.rmi.RemoteException
RMIRegulatedMotor
waitComplete
in interface RMIRegulatedMotor
java.rmi.RemoteException
public void rotate(int angle, boolean immediateReturn) throws java.rmi.RemoteException
RMIRegulatedMotor
rotate
in interface RMIRegulatedMotor
angle
- through which the motor will rotateimmediateReturn
- iff true, method returns immediately, thus allowing monitoring of sensors in the calling thread.java.rmi.RemoteException
RegulatedMotor.rotate(int, boolean)
public void rotate(int angle) throws java.rmi.RemoteException
RMIRegulatedMotor
rotate
in interface RMIRegulatedMotor
angle
- by which the motor will rotate.java.rmi.RemoteException
public void rotateTo(int limitAngle) throws java.rmi.RemoteException
RMIRegulatedMotor
rotateTo
in interface RMIRegulatedMotor
limitAngle
- to which the motor will rotate, and then stop (in degrees). Includes any positive or negative int, even values > 360.java.rmi.RemoteException
public void rotateTo(int limitAngle, boolean immediateReturn) throws java.rmi.RemoteException
RMIRegulatedMotor
rotateTo
in interface RMIRegulatedMotor
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.java.rmi.RemoteException
public int getLimitAngle() throws java.rmi.RemoteException
RMIRegulatedMotor
getLimitAngle
in interface RMIRegulatedMotor
java.rmi.RemoteException
public void setSpeed(int speed) throws java.rmi.RemoteException
RMIRegulatedMotor
setSpeed
in interface RMIRegulatedMotor
speed
- in degrees per second.java.rmi.RemoteException
public int getSpeed() throws java.rmi.RemoteException
RMIRegulatedMotor
getSpeed
in interface RMIRegulatedMotor
java.rmi.RemoteException
public float getMaxSpeed() throws java.rmi.RemoteException
RMIRegulatedMotor
getMaxSpeed
in interface RMIRegulatedMotor
java.rmi.RemoteException
public boolean isStalled() throws java.rmi.RemoteException
RMIRegulatedMotor
isStalled
in interface RMIRegulatedMotor
java.rmi.RemoteException
public void setStallThreshold(int error, int time) throws java.rmi.RemoteException
RMIRegulatedMotor
setStallThreshold
in interface RMIRegulatedMotor
error
- The error thresholdtime
- The time that the error threshold needs to be exceeded for.java.rmi.RemoteException
public void setAcceleration(int acceleration) throws java.rmi.RemoteException
RMIRegulatedMotor
setAcceleration
in interface RMIRegulatedMotor
java.rmi.RemoteException
public void close() throws java.rmi.RemoteException
close
in interface RMIRegulatedMotor
java.rmi.RemoteException
public void forward() throws java.rmi.RemoteException
forward
in interface RMIRegulatedMotor
java.rmi.RemoteException
public void backward() throws java.rmi.RemoteException
backward
in interface RMIRegulatedMotor
java.rmi.RemoteException
public void resetTachoCount() throws java.rmi.RemoteException
resetTachoCount
in interface RMIRegulatedMotor
java.rmi.RemoteException
public int getTachoCount() throws java.rmi.RemoteException
getTachoCount
in interface RMIRegulatedMotor
java.rmi.RemoteException
public boolean isMoving() throws java.rmi.RemoteException
isMoving
in interface RMIRegulatedMotor
java.rmi.RemoteException