LineFollowerSimulator
Class Robot

java.lang.Object
  extended by java.awt.geom.Path2D
      extended by java.awt.geom.Path2D.Double
          extended by LineFollowerSimulator.Robot
All Implemented Interfaces:
java.awt.Shape, java.io.Serializable, java.lang.Cloneable

public class Robot
extends java.awt.geom.Path2D.Double

Model of a line following robot.

Author:
Ondrej Stanek
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class java.awt.geom.Path2D
java.awt.geom.Path2D.Double, java.awt.geom.Path2D.Float
 
Field Summary
protected  double angle
          Rotation of the robot, in radians
 LineFollowerSimulator.Sensor lineSensor
          Line sensor of the robot
protected  LineFollowerSimulator.MotorController motorController
          Motor controller of the robot
 PIDregulator regulator
          PID regulator of the robot
protected  double x
          X coordinate of the robot's centre of rotation
protected  double y
          Y coordinate of the robot's centre of rotation
 
Fields inherited from class java.awt.geom.Path2D
WIND_EVEN_ODD, WIND_NON_ZERO
 
Constructor Summary
Robot(double x, double y, double angle, java.awt.geom.GeneralPath path)
          Initializes robot startup position
 
Method Summary
 void Move()
          The simulation of robot movement is done step by step.
 void ResetPosition()
          Reset robots coordinates and angle to the startup position
 void setWheelGauge(double gauge)
          Sets the distance between robot wheels
 
Methods inherited from class java.awt.geom.Path2D.Double
append, clone, curveTo, getBounds2D, getPathIterator, lineTo, moveTo, quadTo, transform
 
Methods inherited from class java.awt.geom.Path2D
append, closePath, contains, contains, contains, contains, contains, contains, contains, contains, createTransformedShape, getBounds, getCurrentPoint, getPathIterator, getWindingRule, intersects, intersects, intersects, intersects, reset, setWindingRule
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

angle

protected volatile double angle
Rotation of the robot, in radians


x

protected volatile double x
X coordinate of the robot's centre of rotation


y

protected volatile double y
Y coordinate of the robot's centre of rotation


motorController

protected LineFollowerSimulator.MotorController motorController
Motor controller of the robot


lineSensor

public LineFollowerSimulator.Sensor lineSensor
Line sensor of the robot


regulator

public PIDregulator regulator
PID regulator of the robot

Constructor Detail

Robot

public Robot(double x,
             double y,
             double angle,
             java.awt.geom.GeneralPath path)
Initializes robot startup position

Parameters:
x - coordinate
y - coordinate
angle - orientation
path - bezier path to follow
Method Detail

ResetPosition

public final void ResetPosition()
Reset robots coordinates and angle to the startup position


setWheelGauge

public final void setWheelGauge(double gauge)
Sets the distance between robot wheels

Parameters:
gauge - distance in pixels

Move

public void Move()
The simulation of robot movement is done step by step. Each time this function is called, the new step of animation is computed. The function shall be called periodicaly.