|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object | +--cork.device.control.ContinuousRotationServo
Driver for Continuous Rotation Servos. Servos of this type have been modified so that they can rotate in a 360 degree circle continuously. They are often used in robotics for drive motors on small robots.
| Field Summary | |
static int |
PULSE_INTERVAL
Description of the Field |
| Fields inherited from interface cork.device.Motor |
DIRECTION_FORWARD, DIRECTION_REVERSE |
| Constructor Summary | |
ContinuousRotationServo(com.ajile.drivers.gpio.GpioPin pin)
Constructor for the ContinuousRotationServo object |
|
| Method Summary | |
void |
destroy()
Destroyes this object. |
java.lang.String |
getDeviceDestription()
Gets the destription attribute of the Device object |
java.lang.String |
getDeviceName()
Gets the title attribute of the Device object |
int |
getDirection()
Get the direction the servo will rotate in. |
int |
getSpeed()
Speed has no meaning in this context. |
void |
run()
Main processing method for the ContinuousRotationServo object |
void |
setDirection(int direction)
Sets the direction the servo will rotate in. |
void |
setSpeed(int speed)
Speed has no meaning in this context. |
void |
start()
Starts the servo rotating. |
void |
stop()
Stops the servo rotating. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
public static final int PULSE_INTERVAL
| Constructor Detail |
public ContinuousRotationServo(com.ajile.drivers.gpio.GpioPin pin)
pin - com.ajile.drivers.gpio.GpioPin the pin the servos control line
is attached to (usually the white or orange wire).| Method Detail |
public void destroy()
public void run()
run in interface java.lang.Runnablepublic void start()
start in interface Motorpublic void stop()
stop in interface Motorpublic int getDirection()
getDirection in interface Motorpublic java.lang.String getDeviceName()
getDeviceName in interface Devicepublic java.lang.String getDeviceDestription()
getDeviceDestription in interface Devicepublic int getSpeed()
getSpeed in interface Motorpublic void setDirection(int direction)
Because the servo can be oriented in any way, it is impossible for this code to know ahead of time which direction is "forward" and which is "backward" the concepts do not apply at this level of abstraction.
For those who understand how servos work, setting a value of "forward" sends the control a long pulse, wehre setting the value to "reverse" sends a short pulse. Because we're dealing with a Continuous Rotation Servo we don't really care how long the long and short pulses are, we only care that they are above and below the center pulse length.
If you don't understand how servos work, look them up. Any search engine will give you data on them, and you can also find descriptions of how to modify a normal servo for continuous rotation.
setDirection in interface Motordirection - int one of the direction constants from the Motor
interface.public void setSpeed(int speed)
setSpeed in interface Motorspeed - int The new speed value
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||