Package 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 themove()andmoveTo()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()andmoveTo()methods should produce regulated movement.- Author:
- Kirk P. Thompson
- See Also:
LnrActrFirgelliNXT
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description intgetPower()Returns the current actuator motor power setting.intgetTachoCount()Returns the absolute tachometer (encoder) position of the actuator shaft.booleanisMoving()Returntrueif the actuator is in motion due to amove()ormoveTo()order.booleanisStalled()Returns true if amove()ormoveTo()order ended due to a stalled motor.voidmove(int distance, boolean immediateReturn)The actuator should retract (negativedistancevalue) or extend (positivedistancevalue) in encoder ticksdistance.voidmoveTo(int position, boolean immediateReturn)The actuator should move to absolutepositionin encoder ticks.voidresetTachoCount()Reset the tachometer (encoder) count to zero at the current actuator position.voidsetPower(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.voidstop()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 (negativedistancevalue) or extend (positivedistancevalue) in encoder ticksdistance. 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
immediateReturnis 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 shaftimmediateReturn-truereturns immediately,falsewaits for the action to complete (or a stall)
-
moveTo
void moveTo(int position, boolean immediateReturn)The actuator should move to absolutepositionin encoder ticks. Thepositionof the actuator shaft on startup should be zero. Thepositionof the actuator shaft should be set to zero whenresetTachoCount()is called.- Parameters:
position- The absolute shaft position in encoder ticks.immediateReturn-truereturns immediately,falsewaits for the action to complete (or a stall)
-
isMoving
boolean isMoving()
Returntrueif the actuator is in motion due to amove()ormoveTo()order.- Returns:
trueif the actuator is in motion.falseotherwise.
-
isStalled
boolean isStalled()
Returns true if amove()ormoveTo()order ended due to a stalled motor. This should behave like a latch where the reset of the stall status is done on a newmove()ormoveTo()order.- Returns:
trueif actuator motor stalled during anmove()ormoveTo()order.falseotherwise.
-
stop
void stop()
Cause the actuator to stop immediately and resist any further motion. Cancel anymove()ormoveTo()orders in progress.
-
getTachoCount
int getTachoCount()
Returns the absolute tachometer (encoder) position of the actuator shaft. The zero position of the actuator shaft is whereresetTachoCount()was last called or the position of the shaft when instantiated.- Specified by:
getTachoCountin interfaceEncoder- Returns:
- tachometer count in encoder ticks.
-
resetTachoCount
void resetTachoCount()
Reset the tachometer (encoder) count to zero at the current actuator position.- Specified by:
resetTachoCountin interfaceEncoder
-
-