|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--cork.device.control.PolynomicDrive
A Polynomic Drive (a word I just invented off the top of my head) is a drive with independant drove groups. e.g. a tanks treads can both move forward, both backward, or in opposit directions.
The drives works in pairs of motors that are assumed to be on opposit sides.
REMEMBER: Because the actual hardware can be hooked up in any way, it is impossible for the software to know the configuration ahead of time. For this reason, the concepts of right, left, forward and backward are abstract concepts only. Also, all direction information is referenced by the left side, so the right side does the opposit (except during a rotate). By all means adjust your hardware to match if you like, but it is not required for operation of the device.
Fields inherited from interface cork.device.Motor |
DIRECTION_FORWARD, DIRECTION_REVERSE |
Constructor Summary | |
PolynomicDrive()
Constructor for the PolynomicDrive object |
Method Summary | |
int |
addMotorPair(Motor left,
Motor right)
Adds another motor. |
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()
Returns the direction attribute of the entire drive system. |
int |
getDirection(int index)
Returns the direction attribute of the specified pair index. |
int |
getSpeed()
Gets the *average* speed of all motors in the drive system. |
int |
getSpeed(int index)
Gets the speed attribute of the specified group. |
boolean |
isMotor(Motor motor)
Checks to see if a Motor has already been bound.. |
void |
removeMotorPair(int index)
Removes the motor. |
void |
rotate(int index,
int direction)
Causes the two specified groups to move in opposit directions. |
void |
setDirection(int direction)
Sets the direction attribute of all the motors. |
void |
setDirection(int direction,
int index)
Sets the direction attribute of the motors in the specified group. |
void |
setSpeed(int speed)
Sets the speed attribute for all motors. |
void |
setSpeed(int speed,
int index)
Sets the speed attribute of the motors in the specified group. |
int |
size()
Returns the number of groups in the drive system. |
void |
start()
Starts all motors. |
void |
start(int index)
Starts the motors in the specified group. |
void |
stop()
Stops the motors. |
void |
stop(int index)
Stops the motors in the specified group. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public PolynomicDrive()
Method Detail |
public int addMotorPair(Motor left, Motor right)
left
- The feature to be added to the MotorPair attributeright
- The feature to be added to the MotorPair attributepublic void removeMotorPair(int index)
index
- Description of Parameterpublic void start(int index)
index
- Description of Parameterpublic void stop(int index)
index
- Description of Parameterpublic void start()
start
in interface Motor
public void stop()
stop
in interface Motor
public int size()
public void rotate(int index, int direction)
direction
- int the direction from the Motor interface that the "left
side" will move in. The "right side" motor will automatically rotate in
the opposit direction.index
- int the pair index to rotate.public boolean isMotor(Motor motor)
motor
- cork.device.Motor the motor to look for.public int getDirection(int index)
index
- int the pair index to get teh direction for.public int getSpeed(int index)
index
- Description of Parameterpublic int getDirection()
getDirection
in interface Motor
public int getSpeed()
getSpeed
in interface Motor
public java.lang.String getDeviceName()
getDeviceName
in interface Device
public java.lang.String getDeviceDestription()
getDeviceDestription
in interface Device
public void setDirection(int direction, int index)
direction
- int the direction id from the Motor interface.index
- The new direction valuepublic void setSpeed(int speed, int index)
speed
- int The new speed valueindex
- The new speed valuepublic void setDirection(int direction)
setDirection
in interface Motor
direction
- int the direction id from the Motor interface.public void setSpeed(int speed)
setSpeed
in interface Motor
speed
- int The new speed value
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |