|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--de.jaetzold.art.RawSensor | +--de.jaetzold.art.RawActuator | +--de.jaetzold.art.Motor | +--de.jaetzold.art.StepperMotor
This class is an abstraction of a stepper motor. A stepper motor is able to control the amount of movement it does, it can "make one step" at a time. How big such a step is is not defined, but they are equal in size. That way a StepperMotor is positionable in a relative sort of fashion.
It should be noted that the getValue()-method of StepperMotor doesn't return the position of the motor, but it's state (exactly as Motor does). So keep especially in mind, that getValue() usually doesn't return what has been previously set with setValue(). To retrieve the position use the CountSensor delivered by getCountSensor().
Calls to methods from Motor like on()
or forward()
stop any positioning of the StepperMotor and let it move freely. It still keeps track of the current position then.
If a Port can't deliver a real StepperMotorPeer this class is able to simulate the required behavior by using a CountSensor and the capabilities of its superclass Motor.
getCountSensor()
,
StepperMotorPeer
,
CountSensor
Inner classes inherited from class de.jaetzold.art.RawSensor |
RawSensor.ValueSensorPort |
Field Summary | |
protected CountSensor |
countSensor
The CountSensor representing the position of this StepperMotor. |
protected double |
desiredCount
The position the StepperMotor currently wants to be at. |
Fields inherited from class de.jaetzold.art.Motor |
backward, on, power |
Fields inherited from class de.jaetzold.art.RawActuator |
localReturn, vetos, waitForCompletion |
Fields inherited from class de.jaetzold.art.RawSensor |
changes, precision, precisionSet, propertyChangeEventDescriptor |
Constructor Summary | |
StepperMotor()
Constructs a new StepperMotor. |
|
StepperMotor(CountSensor sensor)
Constructs a new StepperMotor. |
Method Summary | |
void |
calibrate()
This method is called when (re)calibration is required. |
void |
connectWith(ActuatorPort port)
Connects this Object with the given Port. |
void |
disconnect()
Disconnects this Sensor from it's Peer and it's Port. |
CountSensor |
getCountSensor()
Returns the CountSensor representing the position of this StepperMotor. |
BooleanSensor |
getPositionReachedSensor()
Returns a BooleanSensor that represents the positioning-state of this StepperMotor. |
double |
getPrecision()
Returns the maximum of the expectable error in the value. |
double |
getSpeed()
Returns the speed of this StepperMotor. |
boolean |
isPositionedAt(double count)
Tells whether this StepperMotor is currently at the position given by count . |
void |
keepCurrentPosition()
Sets the current position as the desired position. |
void |
setBackward(boolean backward)
Controls whether the output should reverse its default polarity. |
void |
setCountSensor(CountSensor sensor)
Sets the CountSensor for representing the position of this StepperMotor. |
void |
setOn(boolean on)
Turns the motor on or of depending on the given value. |
void |
setPrecision(double precision)
Sets the local value for precision. |
void |
setSpeed(double speed)
Sets the speed of this StepperMotor to the given value. |
void |
setValue(double value)
Sets the position the StepperMotor currently wants to be at. |
void |
step(double value)
Move relatively from the currently desired position a number of steps given by value . |
Methods inherited from class de.jaetzold.art.Motor |
backward, forward, getBackward, getPower, isOn, off, on, reverse, setPower |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface de.jaetzold.art.Sensor |
addPropertyChangeListener, addSensorListener, connectWith, getIntValue, getPort, getSensorPort, isConnected, processEvent, propertyChange, removePropertyChangeListener, removeSensorListener, update |
Field Detail |
protected CountSensor countSensor
protected double desiredCount
step(double)
,
setValue(double)
Constructor Detail |
public StepperMotor()
public StepperMotor(CountSensor sensor)
Method Detail |
public CountSensor getCountSensor()
setCountSensor(CountSensor)
public void setCountSensor(CountSensor sensor)
StepperMotorPeer.getCountSensor()
public BooleanSensor getPositionReachedSensor()
getPrecision()
,
isPositionedAt(double)
public void setPrecision(double precision)
RawSensor
setPrecision
in class RawSensor
de.jaetzold.art.RawSensor
RawSensor.precisionSet
,
RawSensor.setPrecision(double)
public double getPrecision()
Sensor
getPrecision
in class RawSensor
public boolean isPositionedAt(double count)
count
. The precision is taken into account.getPositionReachedSensor()
public void setBackward(boolean backward)
Motor
waitMode
this Method returns
immediately after it has been registerd that this is now the state the
motor should have, or it returns after the state has been set.setBackward
in class Motor
de.jaetzold.art.Motor
RawActuator.waitForCompletion
public void setOn(boolean on)
Motor
waitMode
this Method returns
immediately after it has been registerd that this is now the state the
motor should have, or it returns after the state has been set.setOn
in class Motor
de.jaetzold.art.Motor
RawActuator.waitForCompletion
public void keepCurrentPosition()
public void calibrate()
public void step(double value)
value
.setValue(double)
public void setValue(double value)
forward()
stops the positioning until the next call to setValue(double)
, step(double)
or calibrate()
.setValue
in class Motor
step(double)
,
desiredCount
public void connectWith(ActuatorPort port)
Motor
connectWith
in class Motor
public void disconnect()
Sensor
disconnect
in class Motor
de.jaetzold.art.Sensor
Sensor.connectWith(Port)
public double getSpeed()
Motor.getPower()
public void setSpeed(double speed)
setSpeed(double)
to setPower(double)
.
Dependig on the value of waitForCompletion
this Method returns immediately after it has been registerd that this is now the state the motor should have, or it returns after the state has been set.Motor.setPower(double)
,
RawActuator.waitForCompletion
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |