|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectlejos.nxt.addon.LinearActuator
public class LinearActuator
A Linear Actuator class that provides non-blocking actions and stall detection. Developed for the Firgelli L12-NXT-50 and L12-NXT-100 but may work for others. These linear actuators are self contained units which include an electric motor and encoder. They will push up to 25N and move at 12mm/s unloaded. See www.firgelli.com..
Constructor Summary | |
---|---|
LinearActuator(MotorPort motorPort)
Create a LinearActuator instance. |
Method Summary | |
---|---|
void |
extend(int distance,
boolean immediateReturn)
Causes the actuator to extend distance in encoder ticks. |
int |
getTachoCount()
Returns the tachometer (encoder) count. |
boolean |
isMoving()
Returns true if the actuator is in motion. |
void |
retract(int distance,
boolean immediateReturn)
Causes the actuator to retract distance in encoder ticks. |
void |
setPower(int power)
Sets the power for the actuator. |
void |
shutdown()
Shut down the worker threads for this class and null the MotorPort ref. |
void |
stopActuator()
Immediately stop any current actuator action. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public LinearActuator(MotorPort motorPort)
motorPort
- The MotorPort (A,B,C) port to which the linear actuator is connectedMethod Detail |
---|
public void setPower(int power)
power
- power setting: 50 - 100extend(int, boolean)
,
retract(int, boolean)
public boolean isMoving()
public void extend(int distance, boolean immediateReturn)
If immediateReturn is true, this method returns immediately (does not block) and the actuator stops when the stroke distance is met [or a stall is detected]. If extend or retract is called before the stroke distance is reached, the current extension action is canceled.
If the stroke distance specified exceeds the maximum stroke length (fully extended), the actuator shaft will hit the end stop and the stall detection will stop the extension. It is advisable not to extend to the stop as this is hard on the actuator. If you must go all the way to an end stop, use a lower power setting.
distance
- The Stroke distance in encoder ticks. See getTachoCount()
.immediateReturn
- Set to true to cause the extension to occur in its own thread and immediately return.retract(int, boolean)
,
setPower(int)
public void retract(int distance, boolean immediateReturn)
If immediateReturn is true, this method returns immediately (does not block) and the actuator stops when the stroke distance is met [or a stall is detected]. If extend or retract is called before the stroke distance is reached, the current retraction action is canceled.
If the stroke distance specified exceeds the maximum stroke length (fully retracted), the actuator shaft will hit the end stop and the stall detection will stop the retraction. It is advisable not to retract to the stop as this is hard on the actuator. If you must go all the way to an end stop, use a lower power setting.
distance
- The Stroke distance in encoder ticks. See getTachoCount()
.immediateReturn
- Set to true to cause the retraction to occur in its own thread and immediately return.extend(int, boolean)
,
setPower(int)
public void shutdown()
public void stopActuator()
public int getTachoCount()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |