| 
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectaim4.vehicle.BasicVehicle
public abstract class BasicVehicle
The most basic form of a vehicle.
| Nested Class Summary | |
|---|---|
static class | 
BasicVehicle.AccelScheduleMovement
The acceleration schedule movement.  | 
static interface | 
BasicVehicle.Movement
The movement of a vehicle.  | 
static interface | 
BasicVehicle.MovementFactory
The Movement Factory  | 
static interface | 
BasicVehicle.MovementWithAccel
The movement with acceleration interface  | 
static class | 
BasicVehicle.MoveToTargetVelocityMovement
A move-to-target-velocity movement.  | 
static class | 
BasicVehicle.NonAccelMovement
The non-acceleration movement  | 
static class | 
BasicVehicle.PhysicalMovement
The physical movement.  | 
static class | 
BasicVehicle.SteeringMovement
The steering movement.  | 
static class | 
BasicVehicle.TrackMovement
The track movement.  | 
| Field Summary | |
|---|---|
protected  double | 
currentTime
The current time  | 
protected  BasicVehicle.Movement | 
movement
The movement mechanism  | 
protected  VehicleSpec | 
spec
The characteristics of the vehicle  | 
protected  int | 
vin
The vehicle's ID number (i.e., the VIN number).  | 
| Constructor Summary | |
|---|---|
BasicVehicle(VehicleSpec spec,
             Point2D pos,
             double heading,
             double velocity,
             double steeringAngle,
             double acceleration,
             double targetVelocity,
             double currentTime)
Construct a vehicle  | 
|
| Method Summary | |
|---|---|
 void | 
checkCurrentTime(double currentTime)
Check whether this vehicle's time is current.  | 
 void | 
coast()
Set the acceleration to zero.  | 
protected  void | 
finalize()
 | 
 Point2D[] | 
gaugeCornerPoints()
Get the current global coordinates of the corners of this Vehicle, according to the Vehicle's gauges.  | 
 double | 
gaugeHeading()
Get this Vehicle's compass gauge's reading.  | 
 Point2D | 
gaugePointAtMiddleFront(double delta)
Get the point in front of the middle point of the vehicle that is at the distance of delta away from the vehicle, according to the gauges.  | 
 Point2D | 
gaugePointAtRear()
Get the point at the rear center of the vehicle, according to our gauges  | 
 Point2D | 
gaugePointBetweenFrontWheels()
Get the point between the front wheels, according to our gauges.  | 
 Point2D | 
gaugePosition()
Get the current position of this Vehicle, represented by the point at the center of the front of the Vehicle, according to the Vehicle's gauges.  | 
 Point2D | 
gaugeRearLeftCornerPoint()
Get the current global coordinate of the rear-left corner of this Vehicle, according to the Vehicle's gauges.  | 
 Point2D | 
gaugeRearRightCornerPoint()
Get the current global coordinate of the rear-right corner of this Vehicle, according to the Vehicle's gauges.  | 
 Shape | 
gaugeShape()
Get a Shape describing the Vehicle, according to the Vehicle's
 gauges. | 
 double | 
gaugeTime()
Read this Vehicle's clock (chronometer).  | 
 double | 
gaugeVelocity()
Get this Vehicle's speedometer gauge's reading.  | 
 double | 
getAcceleration()
Get the acceleration of the vehicle  | 
 AccelSchedule | 
getAccelSchedule()
Get the acceleration profile.  | 
 Point2D | 
getCenterPoint()
Get the location of the center of the Vehicle at this point in time.  | 
 Point2D[] | 
getCornerPoints()
Get the current global coordinates of the corners of this Vehicle.  | 
abstract  Driver | 
getDriver()
Getter method for the Driver controlling this Vehicle.  | 
 List<Line2D> | 
getEdges()
Get the edges that represent the boundaries of this Vehicle.  | 
 double | 
getHeading()
Get the heading of the vehicle  | 
 Point2D | 
getPointAtMiddleFront(double delta)
Get the point in front of the middle point of the vehicle that is at the distance of delta away from the vehicle.  | 
 Point2D | 
getPointAtRear()
Get the point at the rear center of the Vehicle.  | 
 Point2D | 
getPosition()
Get the position of the vehicle.  | 
 Shape | 
getShape()
Get a Shape describing the Vehicle. | 
 Shape | 
getShape(double extra)
Get a {link Shape} describing this Vehicle, if it were larger in each dimension.  | 
 VehicleSpec | 
getSpec()
Get the specification of the vehicle  | 
 double | 
getSteeringAngle()
Get the steering angle of the vehicle  | 
 double | 
getVelocity()
Get the velocity of the vehicle  | 
 int | 
getVIN()
Get the ID number of this vehicle.  | 
 Shape[] | 
getWheelShapes()
Get the Shapes of each of the wheels.  | 
 void | 
move(double timeStep)
Move a single Vehicle according to some approximation of the laws of physics.  | 
 void | 
printState()
print the state of the driver.  | 
 void | 
removeAccelSchedule()
Remove the acceleration profile.  | 
 void | 
setAccelSchedule(AccelSchedule accelSchedule)
Set the acceleration profile.  | 
 void | 
setAccelWithMaxTargetVelocity(double acceleration)
Set the acceleration to the specified value, using maximum and minimum velocities as targets, automatically.  | 
 void | 
setMaxAccelWithMaxTargetVelocity()
Set the Vehicle's acceleration to its maximum value.  | 
 void | 
setTargetVelocityWithMaxAccel(double targetVelocity)
Set the acceleration to the appropriate value to reach the target velocity, based on the current speedometer reading.  | 
 void | 
setVIN(int vin)
Set the VIN number of this Vehicle.  | 
 void | 
slowToStop()
Set the Vehicle's acceleration to its minimum value without going backward.  | 
 void | 
turnTowardPoint(Point2D p)
Turn the wheels toward a given Point.  | 
| Methods inherited from class java.lang.Object | 
|---|
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait | 
| Methods inherited from interface aim4.vehicle.VehicleSimView | 
|---|
getV2IOutbox, setDriver | 
| Field Detail | 
|---|
protected int vin
protected VehicleSpec spec
protected BasicVehicle.Movement movement
protected double currentTime
| Constructor Detail | 
|---|
public BasicVehicle(VehicleSpec spec,
                    Point2D pos,
                    double heading,
                    double velocity,
                    double steeringAngle,
                    double acceleration,
                    double targetVelocity,
                    double currentTime)
spec - the vehicle's specificationpos - the initial position of the Vehicleheading - the initial heading of the VehiclesteeringAngle - the initial steering angle of the Vehiclevelocity - the initial velocity of the VehicletargetVelocity - the initial target velocityacceleration - the initial acceleration of the VehiclecurrentTime - the current time| Method Detail | 
|---|
protected void finalize()
                 throws Throwable
finalize in class ObjectThrowablepublic int getVIN()
getVIN in interface VehicleDriverViewpublic void setVIN(int vin)
setVIN in interface VehicleSimViewvin - the vehicle's VIN number.public VehicleSpec getSpec()
getSpec in interface VehicleDriverViewpublic double gaugeTime()
gaugeTime in interface VehicleDriverViewpublic abstract Driver getDriver()
getDriver in interface VehicleDriverViewnull
         if none exists.public Point2D getPosition()
getPosition in interface VehicleSimViewpublic double getHeading()
getHeading in interface VehicleSimViewpublic double getSteeringAngle()
public double getVelocity()
getVelocity in interface VehicleSimViewpublic double getAcceleration()
getAcceleration in interface VehicleSimViewpublic AccelSchedule getAccelSchedule()
getAccelSchedule in interface VehicleDriverViewpublic Point2D gaugePosition()
gaugePosition in interface VehicleDriverViewpublic double gaugeVelocity()
gaugeVelocity in interface VehicleDriverViewpublic double gaugeHeading()
gaugeHeading in interface VehicleDriverViewpublic Shape getShape()
Shape describing the Vehicle.
getShape in interface VehicleSimViewpublic Shape gaugeShape()
Shape describing the Vehicle, according to the Vehicle's
 gauges.
gaugeShape in interface VehicleDriverViewpublic Shape getShape(double extra)
getShape in interface VehicleSimViewextra - the fixed extra amount by which to increase the size of the
              Vehicle in each dimension
public List<Line2D> getEdges()
getEdges in interface VehicleSimViewpublic Point2D getPointAtMiddleFront(double delta)
getPointAtMiddleFront in interface VehicleSimViewdelta - the distance of the vehicle and the point
public Point2D gaugePointAtMiddleFront(double delta)
gaugePointAtMiddleFront in interface VehicleDriverViewdelta - the distance of the vehicle and the point,
                according to the gauges
public Point2D gaugePointBetweenFrontWheels()
gaugePointBetweenFrontWheels in interface VehicleDriverViewpublic Point2D getCenterPoint()
getCenterPoint in interface VehicleSimViewpublic Point2D[] getCornerPoints()
getCornerPoints in interface VehicleSimViewpublic Point2D[] gaugeCornerPoints()
public Point2D getPointAtRear()
getPointAtRear in interface VehicleSimViewpublic Point2D gaugePointAtRear()
gaugePointAtRear in interface VehicleDriverViewpublic Point2D gaugeRearLeftCornerPoint()
gaugeRearLeftCornerPoint in interface VehicleDriverViewpublic Point2D gaugeRearRightCornerPoint()
gaugeRearRightCornerPoint in interface VehicleDriverViewpublic Shape[] getWheelShapes()
getWheelShapes in interface VehicleSimViewpublic void move(double timeStep)
move in interface VehicleSimViewtimeStep - the size of the time step to simulate, in secondspublic void turnTowardPoint(Point2D p)
turnTowardPoint in interface VehicleDriverViewp - the Point toward which to turn the wheelspublic void coast()
coast in interface VehicleDriverViewpublic void slowToStop()
slowToStop in interface VehicleDriverViewpublic void setMaxAccelWithMaxTargetVelocity()
public void setTargetVelocityWithMaxAccel(double targetVelocity)
setTargetVelocityWithMaxAccel in interface VehicleDriverViewtargetVelocity - the desired ultimate velocitypublic void setAccelWithMaxTargetVelocity(double acceleration)
setAccelWithMaxTargetVelocity in interface VehicleDriverViewacceleration - the desired acceleration.public void setAccelSchedule(AccelSchedule accelSchedule)
setAccelSchedule in interface VehicleDriverViewaccelSchedule - the acceleration profilepublic void removeAccelSchedule()
removeAccelSchedule in interface VehicleDriverViewpublic void checkCurrentTime(double currentTime)
checkCurrentTime in interface VehicleSimViewcurrentTime - the current timepublic void printState()
printState in interface VehicleDriverView
  | 
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||