orbotix.robot.base
Class JoyStickDriveAlgorithm
java.lang.Object
orbotix.robot.base.DriveAlgorithm
orbotix.robot.base.JoyStickDriveAlgorithm
public class JoyStickDriveAlgorithm
- extends DriveAlgorithm
Objects of this class convert position of a view bounds into heading and speeds.
The center of the area is consider the stop position and a speed and heading are
calculated from it.
The heading is calculated with 0 in the upwards y direction similar to a compass.
Speed is calculated as the magnitude from the center, and normalized to
a maximum of 1.0. The speed and heading therefore define a circular/elliptical area constrained
to a rectangle defined by the controls rectangular area.
Constructor Summary |
JoyStickDriveAlgorithm(double padWidth,
double padHeight)
Constructor which takes the rectangular area of the control used for
calculating the speed and heading values. |
Method Summary |
void |
convert(double x,
double y,
double unused)
Converts a x,y position in the joy stick control's area into
a speed and heading. |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
JoyStickDriveAlgorithm
public JoyStickDriveAlgorithm(double padWidth,
double padHeight)
- Constructor which takes the rectangular area of the control used for
calculating the speed and heading values.
- Parameters:
padWidth
- The joy stick pad width.padHeight
- The joy stick pad height.
convert
public void convert(double x,
double y,
double unused)
- Converts a x,y position in the joy stick control's area into
a speed and heading.
- Specified by:
convert
in class DriveAlgorithm
- Parameters:
x
- First coordinate in the input coordinates.y
- Second coordinate in the input coordinates.unused
- Third coordinate in the input coordinates.