Interface CarController


public interface CarController

Interface CarController must be implemented by every car controller.


Method Summary
 void draw(java.awt.Graphics2D g2, java.awt.Dimension D)
          Method draw() should be used if you want to draw anything on the GUI.
 double getControl(int i)
          Method getControl() is called by the GUI to extract the current values of the control.
 void init(double initX, double initY, double initTheta, double endX, double endY, double endTheta, java.util.ArrayList<java.awt.geom.Rectangle2D.Double> obstacles, SensorPack sensors)
          Method init is called by the GUI.
 void move()
          Method move() is called by the GUI at each step.
 

Method Detail

init

void init(double initX,
          double initY,
          double initTheta,
          double endX,
          double endY,
          double endTheta,
          java.util.ArrayList<java.awt.geom.Rectangle2D.Double> obstacles,
          SensorPack sensors)
Method init is called by the GUI.

Parameters:
initX - a double value - the x value of the initial position.
initY - a double value - the y value of the initial position.
initTheta - a double value - the initial orientation
endX - a double value - desired final x value
endY - a double value - desired final y value
endTheta - a double value - desired final orientation
obstacles - an ArrayList value - a list of obstacles, each an instance of Java's rectangle class.
sensors - a SensorPack - a class that you can query for position info

draw

void draw(java.awt.Graphics2D g2,
          java.awt.Dimension D)
Method draw() should be used if you want to draw anything on the GUI. For example, you might want to draw a path towards the target that you pre-computed in init().

Parameters:
g2 - a Graphics2D value - the graphics instance.
D - a Dimension value - the dimensions of the drawing area.

move

void move()
Method move() is called by the GUI at each step. This is where you implement code to adjust the controls. Note that the controls themselves are not returned by this method. Instead, the GUI gets them by calling getControl() once for each control.


getControl

double getControl(int i)
Method getControl() is called by the GUI to extract the current values of the control. There are only two right now and so i=1 or i=2 are the only values.

Parameters:
i - an int value
Returns:
a double value