jbotrace.base
Class Car

java.lang.Object
  |
  +--jbotrace.base.Car

public class Car
extends java.lang.Object

Description: This class represents the standard racecode-car. It contains all functions to set the state of the car and to calculate it's movement.


Field Summary
static double BASEMASS
          The weight of the car without fuel
static double DELTAT
           
static double MAXSTEERINGANGLE
          The maximum angle, that the frontwheels can be turned to either side.
static double MAXSTEERINGCHANGE
          The maximum amount that the steeringangle can change in one timestep
 
Constructor Summary
Car()
          Constructs a new car with all values set to zero.
 
Method Summary
 void changeSteering(double wantedSteering)
          Changes the angle of the frontwheels.
 double getAcceleration()
          Returns the currently set acceleration.
 double getAngle()
          Returns the orientation of the car
 int getBestLapTime()
          Returns bestLapTime: The time of the best lap the car drove
 int getCurrentLap()
          Returns the current lap
 Driver getDriver()
          Return the driver of the car
 int getLastLapTime()
          Returns the time of the last lap
 double getMass()
          Returns the current mass of the car
 Vec getPosition()
          Returns the Vec of the current position of the car.
 double getSteeringAngle()
          Returns the angle between front wheels and car direction.
 int getTimeTo(Car car)
          Returns the time distance in ms to the given Car
 double getVelocity()
          Returns the speed of the car in its last move.
 double getWeight()
          Returns the current weight of the car
 double getWeightOnWheel(int wheel)
          Returns the weight on the given wheel during the last calculation step
 double getWheelAngle(int wheel)
          Returns the "absolute" angle of a specified wheel.
 Vec getWheelPosition(int wheel)
          Returns the absolute position of a specified wheel
 boolean isAhead(Car car)
          Returns true, if the car is ahead the other car.
 void move()
          This method moves the car for one timestep.
 void setBrake(double brake)
          Sets the brake as factor
 void setDriver(Driver driver)
          Sets the driver that is asked for instructions.
 void setPosition(Vec position)
          Sets the position of the car
 void setRace(Race race)
          Sets the race in which the car drives.
 void setSteeringAngle(double steeringAngle)
          Sets the angle between the direction of the car and the front wheels.
 void setThrottle(double throttle)
          Sets the throttle as factor
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DELTAT

public static final double DELTAT
See Also:
Constant Field Values

BASEMASS

public static final double BASEMASS
The weight of the car without fuel

See Also:
Constant Field Values

MAXSTEERINGANGLE

public static final double MAXSTEERINGANGLE
The maximum angle, that the frontwheels can be turned to either side.

See Also:
Constant Field Values

MAXSTEERINGCHANGE

public static final double MAXSTEERINGCHANGE
The maximum amount that the steeringangle can change in one timestep

See Also:
Constant Field Values
Constructor Detail

Car

public Car()
Constructs a new car with all values set to zero.

Method Detail

changeSteering

public void changeSteering(double wantedSteering)
Changes the angle of the frontwheels.


getAcceleration

public double getAcceleration()
Returns the currently set acceleration.


getAngle

public double getAngle()
Returns the orientation of the car


getBestLapTime

public int getBestLapTime()
Returns bestLapTime: The time of the best lap the car drove


getCurrentLap

public int getCurrentLap()
Returns the current lap


getDriver

public Driver getDriver()
Return the driver of the car


getTimeTo

public int getTimeTo(Car car)
Returns the time distance in ms to the given Car


getLastLapTime

public int getLastLapTime()
Returns the time of the last lap


getMass

public double getMass()
Returns the current mass of the car


getPosition

public Vec getPosition()
Returns the Vec of the current position of the car.


getSteeringAngle

public double getSteeringAngle()
Returns the angle between front wheels and car direction.


getVelocity

public double getVelocity()
Returns the speed of the car in its last move.


getWeight

public double getWeight()
Returns the current weight of the car


getWeightOnWheel

public double getWeightOnWheel(int wheel)
Returns the weight on the given wheel during the last calculation step


getWheelAngle

public double getWheelAngle(int wheel)
Returns the "absolute" angle of a specified wheel.


getWheelPosition

public Vec getWheelPosition(int wheel)
Returns the absolute position of a specified wheel


isAhead

public boolean isAhead(Car car)
Returns true, if the car is ahead the other car.


move

public void move()
This method moves the car for one timestep.


setBrake

public void setBrake(double brake)
Sets the brake as factor


setDriver

public void setDriver(Driver driver)
Sets the driver that is asked for instructions.


setPosition

public void setPosition(Vec position)
Sets the position of the car


setRace

public void setRace(Race race)
Sets the race in which the car drives.


setSteeringAngle

public void setSteeringAngle(double steeringAngle)
Sets the angle between the direction of the car and the front wheels.


setThrottle

public void setThrottle(double throttle)
Sets the throttle as factor