All Downloads are FREE. Search and download functionalities are using the official Maven repository.

lejos.robotics.LinearActuator Maven / Gradle / Ivy

Go to download

leJOS (pronounced like the Spanish word "lejos" for "far") is a tiny Java Virtual Machine. In 2013 it was ported to the LEGO EV3 brick.

The newest version!
package lejos.robotics;

/**
 * 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. * * @see lejos.hardware.device.LnrActrFirgelliNXT * @author Kirk P. Thompson */ public interface LinearActuator extends Encoder { /** * Set the power level 0%-100% to be applied to the actuator motor where 0% is no movement and 100% is full speed. * @param power new motor power 0-100% */ public void setPower(int power); /** * Returns the current actuator motor power setting. * @return current power 0-100% */ public int getPower(); /** 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. * @param distance The distance to move the actuator shaft * @param immediateReturn true returns immediately, false waits for the action to complete (or a stall) */ public void move(int distance, 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. * @param position The absolute shaft position in encoder ticks. * @param immediateReturn true returns immediately, false waits for the action to complete (or a stall) */ public void moveTo(int position, boolean immediateReturn); /**Return true if the actuator is in motion due to a move() or moveTo() order. * @return true if the actuator is in motion. false otherwise. */ public boolean isMoving(); /** * 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. * @return true if actuator motor stalled during an move() or moveTo() order. * false otherwise. */ public boolean isStalled(); /** * Cause the actuator to stop immediately and resist any further motion. Cancel any move() or * moveTo()orders in progress. */ public void stop(); /**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. * * @return tachometer count in encoder ticks. */ public int getTachoCount(); /**Reset the tachometer (encoder) count to zero at the current actuator position. */ public void resetTachoCount(); }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy