lejos.robotics
Class SimplePlatform

java.lang.Object
  extended by lejos.robotics.SimplePlatform
All Implemented Interfaces:
RotationPlatform
Direct Known Subclasses:
ExtendedPlatform

public class SimplePlatform
extends Object
implements RotationPlatform


Constructor Summary
SimplePlatform(TachoMotor directionMotor)
           
SimplePlatform(TachoMotor directionMotor, boolean invertDir)
           
SimplePlatform(TachoMotor directionMotor, boolean invertDir, double ratioDir)
           
 
Method Summary
 int getAbsoluteDirection(Pose pose)
          Includes the direction of the pilot in the calculation of the real angle of the sensor (as opposed to the relative direction of the sensor) NOTE: There is no corresponding setAbsoluteDirection() method because the angle the Pilot would rotate to and the angle the sensor would rotate to would be ambiguous.
 int getDirection()
          Get the direction the sensor will face.
 int getMaximumDirection()
          Cables or other hindrances can restrict movement of the platform.
 int getMinimumDirection()
          Cables or other hindrances can restrict movement of the platform.
 int getRotationSpeed()
          Gets the speed the platform rotates, in degrees per second.
 float getXOffset()
           
 float getYOffset()
           
 float getZOffset()
           
 void scanLeft()
          Starts rotating counterclockwise (left).
 void scanRight()
          Starts rotating to the clockwise (right).
 void setDirection(int angle)
          Rotates the sensor to the desired angle.
 void setMaximumDirection(int maxAngle)
          Cables or other hindrances can restrict movement of the platform.
 void setMinimumDirection(int minAngle)
          Cables or other hindrances can restrict movement of the platform.
 void setRotationSpeed(int speed)
          Sets the speed the platform should rotate, in degrees per second.
 void setXOffset()
          The actual central axis of the sensor rotator will reside off center from the actual robot center.
 void setYOffset()
           
 void setZOffset()
           
 void stopRotation()
          Stops a rotation in motion from one of the rotate methods, like rotateLeft() or rotateUp().
 boolean zero()
          This method calibrates the direction and elevation to the zero angle position, which is pointing in the same direction as the robot and facing horizontal.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SimplePlatform

public SimplePlatform(TachoMotor directionMotor)

SimplePlatform

public SimplePlatform(TachoMotor directionMotor,
                      boolean invertDir)

SimplePlatform

public SimplePlatform(TachoMotor directionMotor,
                      boolean invertDir,
                      double ratioDir)
Method Detail

getAbsoluteDirection

public int getAbsoluteDirection(Pose pose)
Description copied from interface: RotationPlatform
Includes the direction of the pilot in the calculation of the real angle of the sensor (as opposed to the relative direction of the sensor) NOTE: There is no corresponding setAbsoluteDirection() method because the angle the Pilot would rotate to and the angle the sensor would rotate to would be ambiguous. e.g. to rotate the sensor 90 degrees, the Pilot could rotate 10 degrees and the sensor 80 degrees, or any number of combinations to get 90 degrees.

Specified by:
getAbsoluteDirection in interface RotationPlatform
Returns:

getDirection

public int getDirection()
Description copied from interface: RotationPlatform
Get the direction the sensor will face. The direction is relative to the robot.

Specified by:
getDirection in interface RotationPlatform
Returns:
the relative direction of the sensor in degrees (0 to 360, increasing counter clockwise from 0, the starting position)

getMaximumDirection

public int getMaximumDirection()
Description copied from interface: RotationPlatform
Cables or other hindrances can restrict movement of the platform. This method indicates the maximum it can rotate left.

Specified by:
getMaximumDirection in interface RotationPlatform
Returns:

getMinimumDirection

public int getMinimumDirection()
Description copied from interface: RotationPlatform
Cables or other hindrances can restrict movement of the platform. This method indicates the maximum it can rotate right.

Specified by:
getMinimumDirection in interface RotationPlatform
Returns:

getRotationSpeed

public int getRotationSpeed()
Description copied from interface: RotationPlatform
Gets the speed the platform rotates, in degrees per second. The default speed is XX degrees/second.

Specified by:
getRotationSpeed in interface RotationPlatform
Returns:

getXOffset

public float getXOffset()
Specified by:
getXOffset in interface RotationPlatform

getYOffset

public float getYOffset()
Specified by:
getYOffset in interface RotationPlatform

getZOffset

public float getZOffset()
Specified by:
getZOffset in interface RotationPlatform

scanLeft

public void scanLeft()
Description copied from interface: RotationPlatform
Starts rotating counterclockwise (left). Automatically stops when the angle matches or exceeds getMaximumDirection().

Specified by:
scanLeft in interface RotationPlatform

scanRight

public void scanRight()
Description copied from interface: RotationPlatform
Starts rotating to the clockwise (right). Automatically stops when the angle matches or is less than getMinimumDirection().

Specified by:
scanRight in interface RotationPlatform

setDirection

public void setDirection(int angle)
Description copied from interface: RotationPlatform
Rotates the sensor to the desired angle. The direction is relative to the robot. The method will not return until the rotator has achieved the target angle.

Specified by:
setDirection in interface RotationPlatform
Parameters:
angle - The angle, in degrees, to rotate to. 0 to 360, increasing counter clockwise from 0, the starting position.

setMaximumDirection

public void setMaximumDirection(int maxAngle)
Description copied from interface: RotationPlatform
Cables or other hindrances can restrict movement of the platform. This method sets the maximum angle it can rotate left.

Specified by:
setMaximumDirection in interface RotationPlatform

setMinimumDirection

public void setMinimumDirection(int minAngle)
Description copied from interface: RotationPlatform
Cables or other hindrances can restrict movement of the platform. This method sets the maximum angle it can rotate right.

Specified by:
setMinimumDirection in interface RotationPlatform

setRotationSpeed

public void setRotationSpeed(int speed)
Description copied from interface: RotationPlatform
Sets the speed the platform should rotate, in degrees per second. The default speed is XX degrees/second.

Specified by:
setRotationSpeed in interface RotationPlatform

setXOffset

public void setXOffset()
Description copied from interface: RotationPlatform
The actual central axis of the sensor rotator will reside off center from the actual robot center. So we could include methods to set the x offset, y offset and z offset from the center of robot (center = point between wheels).

Specified by:
setXOffset in interface RotationPlatform

setYOffset

public void setYOffset()
Specified by:
setYOffset in interface RotationPlatform

setZOffset

public void setZOffset()
Specified by:
setZOffset in interface RotationPlatform

stopRotation

public void stopRotation()
Description copied from interface: RotationPlatform
Stops a rotation in motion from one of the rotate methods, like rotateLeft() or rotateUp().

Specified by:
stopRotation in interface RotationPlatform

zero

public boolean zero()
Description copied from interface: RotationPlatform
This method calibrates the direction and elevation to the zero angle position, which is pointing in the same direction as the robot and facing horizontal. If the sensor platform uses a touch sensor, light sensor or some other sensor to calibrate the position, this can be used in conjunction with motor movements to set the position to the zero position, then reset the angles to zero. Otherwise this method relies on the user to set the sensor platform to the zero position manually by hand.

Specified by:
zero in interface RotationPlatform
Returns:
true if calibration worked, false if it failed.