lejos.robotics
Interface LinearActuator

All Superinterfaces:
Encoder
All Known Implementing Classes:
LnrActrFirgelliNXT

public interface LinearActuator
extends Encoder

Interface that defines the minimal implementation for a Linear Actuator device. Linear Actuator classes should provide non-blocking extend/retract actions through the move() and moveTo() methods. Stall detection must be provided to avoid motor damage due to running against the end stops, etc.

Motor regulation is not specified in this interface as it may be difficult to determine the accurate length per time (ie. mm/sec) rate due to encoder tick granularity of the linear actuator. It is up to the implementor to decide if the move() and moveTo() methods should produce regulated movement.

Author:
Kirk P. Thompson
See Also:
LnrActrFirgelliNXT

Method Summary
 int getPower()
          Returns the current actuator motor power setting.
 int getTachoCount()
          Returns the absolute tachometer (encoder) position of the actuator shaft.
 boolean isMoving()
          Return true if the actuator is in motion due to a move() or moveTo() order.
 boolean isStalled()
          Returns true if a move() or moveTo() order ended due to a stalled motor.
 void move(int distance, boolean immediateReturn)
          The actuator should retract (negative distance value) or extend (positive distance value) in encoder ticks distance.
 void moveTo(int position, boolean immediateReturn)
          The actuator should move to absolute position in encoder ticks.
 void resetTachoCount()
          Reset the tachometer (encoder) count to zero at the current actuator position.
 void setPower(int power)
          Set the power level 0%-100% to be applied to the actuator motor where 0% is no movement and 100% is full speed.
 void stop()
          Cause the actuator to stop immediately and resist any further motion.
 

Method Detail

setPower

void setPower(int power)
Set the power level 0%-100% to be applied to the actuator motor where 0% is no movement and 100% is full speed.

Parameters:
power - new motor power 0-100%

getPower

int getPower()
Returns the current actuator motor power setting.

Returns:
current power 0-100%

move

void move(int distance,
          boolean immediateReturn)
The actuator should retract (negative distance value) or extend (positive distance value) in encoder ticks distance. The distance is specified to be relative to the actuator shaft position at the time of calling this method. The absolute unit per encoder tick is device-dependent and should be specified in the implementation documentation.

Stall detection needs to be implemented to stop the actuator in the event of an actuator motor stall condition.

If immediateReturn is true, this method should not block and return immediately. The actuator stops when the stroke distance is met or a stall is detected.

Parameters:
distance - The distance to move the actuator shaft
immediateReturn - true returns immediately, false waits for the action to complete (or a stall)

moveTo

void moveTo(int position,
            boolean immediateReturn)
The actuator should move to absolute position in encoder ticks. The position of the actuator shaft on startup should be zero. The position of the actuator shaft should be set to zero when resetTachoCount() is called.

Parameters:
position - The absolute shaft position in encoder ticks.
immediateReturn - true returns immediately, false waits for the action to complete (or a stall)

isMoving

boolean isMoving()
Return true if the actuator is in motion due to a move() or moveTo() order.

Returns:
true if the actuator is in motion. false otherwise.

isStalled

boolean isStalled()
Returns true if a move() or moveTo() order ended due to a stalled motor. This should behave like a latch where the reset of the stall status is done on a new move() or moveTo() order.

Returns:
true if actuator motor stalled during an move() or moveTo() order. false otherwise.

stop

void stop()
Cause the actuator to stop immediately and resist any further motion. Cancel any move() or moveTo()orders in progress.


getTachoCount

int getTachoCount()
Returns the absolute tachometer (encoder) position of the actuator shaft. The zero position of the actuator shaft is where resetTachoCount() was last called or the position of the shaft when instantiated.

Specified by:
getTachoCount in interface Encoder
Returns:
tachometer count in encoder ticks.

resetTachoCount

void resetTachoCount()
Reset the tachometer (encoder) count to zero at the current actuator position.

Specified by:
resetTachoCount in interface Encoder