aim4.vehicle
Class VehicleSpec

java.lang.Object
  extended by aim4.vehicle.VehicleSpec

public class VehicleSpec
extends Object

The characteristics of the vehicle


Constructor Summary
VehicleSpec(String name, double maxAcceleration, double maxDeceleration, double maxVelocity, double minVelocity, double length, double width, double frontAxleDisplacement, double rearAxleDisplacement, double wheelSpan, double wheelRadius, double wheelWidth, double maxSteeringAngle, double maxTurnPerSecond)
          Class constructor that overrides most of the defaults and also allows the user to specify the Vehicle's VIN instead of using the default generator.
 
Method Summary
 void assign(VehicleSpec spec)
          Update all values in this specification to the given specification.
 Point2D getCenterPoint(Point2D pos, double heading)
          Get the location of the center of the Vehicle at this point in time.
 Point2D[] getCornerPoints(double extra, Point2D pos, double heading)
          Get the current global coordinates of the corners of the Vehicle, assuming it is larger in each dimension by a fixed amount.
 Point2D[] getCornerPoints(Point2D pos, double heading)
          Get the current global coordinates of the corners of this Vehicle.
 double getFrontAxleDisplacement()
          Get the front axle displacement.
 double getHalfLength()
          Get half of the length of the vehicle.
 double getHalfWidth()
          Get half of the width of the vehicle.
 double getLength()
          Get the length of the vehicle.
 double getMaxAcceleration()
          Get the maximum acceleration.
 double getMaxDeceleration()
          Get the maximum deceleration.
 double getMaxSteeringAngle()
          Get the maximum steering angle.
 double getMaxTurnPerCycle()
          Get the maximum turn per cycle.
 double getMaxTurnPerSecond()
          Get the maximum turn per second.
 double getMaxVelocity()
          Get the maximum velocity.
 double getMinVelocity()
          Get the minimum velocity.
 String getName()
          Get the name of this vehicle specification
 Point2D getPointAtRear(Point2D pos, double heading)
          Get the point at the rear center of the Vehicle.
 Point2D getPointBetweenAllWheels(Point2D pos, double heading)
          Get the point between all the wheels.
 Point2D getPointBetweenFrontWheels(Point2D pos, double heading)
          Get the point between the front wheels.
 Point2D getPointBetweenRearWheels(Point2D pos, double heading)
          Get the point between the rear wheels.
 Point2D getPointLeftSideFrontAxle(Point2D pos, double heading)
          Get the point on the left side of the Vehicle, aligned with the front axle.
 Point2D getPointRightSideFrontAxle(Point2D pos, double heading)
          Get the point on the right side of the Vehicle, aligned with the front axle.
 double getRadius()
          Get the radius.
 double getRearAxleDisplacement()
          Get the rear axle displacement.
 Point2D getRearLeftCornerPoint(Point2D pos, double heading)
          Get the current global coordinate of the rear-left corner of this Vehicle.
 Point2D getRearRightCornerPoint(Point2D pos, double heading)
          Get the current global coordinate of the rear-right corner of this Vehicle.
 double getWheelbase()
          Get the wheelbase of this Vehicle.
 Point2D[] getWheelCenters(Point2D pos, double heading)
          Get the points where each of the wheels is presumably touching the road.
 double getWheelRadius()
          Get the wheel radius.
 Shape[] getWheelShapes(Point2D pos, double heading, double steeringAngle)
          Get the Shapes of each of the wheels.
 double getWheelSpan()
          Get the wheel span.
 double getWheelWidth()
          Get the wheel width.
 double getWidth()
          Get the width of the vehicle.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

VehicleSpec

public VehicleSpec(String name,
                   double maxAcceleration,
                   double maxDeceleration,
                   double maxVelocity,
                   double minVelocity,
                   double length,
                   double width,
                   double frontAxleDisplacement,
                   double rearAxleDisplacement,
                   double wheelSpan,
                   double wheelRadius,
                   double wheelWidth,
                   double maxSteeringAngle,
                   double maxTurnPerSecond)
Class constructor that overrides most of the defaults and also allows the user to specify the Vehicle's VIN instead of using the default generator.

Parameters:
name - the name of this specification
maxAcceleration - the Vehicle's maximum acceleration, in meters per second squared
maxDeceleration - the Vehicle's maximum decceleration, in meters per second squared
maxVelocity - the Vehicle's maximum velocity, in meters per second
minVelocity - the Vehicle's minimum velocity, in meters per second
length - the Vehicle's length, in meters
width - the Vehicle's width, in meters
frontAxleDisplacement - the distance in meters from the front of the Vehicle to its front axle
rearAxleDisplacement - the distance in meters from the front of the Vehicle to its rear axle
wheelSpan - the distance from the center of an axle to the wheels on that axle, in meters
wheelRadius - the radius, in meters, of the wheels
wheelWidth - the width of the wheels, in meters
maxSteeringAngle - the maximum angle away from center to which the front wheels can be turned, in radians
maxTurnPerSecond - the maximum angle through which the front wheels can be turned in one second, in radians
Method Detail

assign

public void assign(VehicleSpec spec)
Update all values in this specification to the given specification.

Parameters:
spec - the value of the new specification.

getName

public String getName()
Get the name of this vehicle specification

Returns:
the name of this vehicle specification

getMaxAcceleration

public double getMaxAcceleration()
Get the maximum acceleration.

Returns:
the maximum acceleration

getMaxDeceleration

public double getMaxDeceleration()
Get the maximum deceleration.

Returns:
the maximum deceleration

getMaxVelocity

public double getMaxVelocity()
Get the maximum velocity.

Returns:
the maximum velocity

getMinVelocity

public double getMinVelocity()
Get the minimum velocity.

Returns:
the minimum velocity

getLength

public double getLength()
Get the length of the vehicle.

Returns:
the length of the vehicle

getWidth

public double getWidth()
Get the width of the vehicle.

Returns:
the width of the vehicle

getFrontAxleDisplacement

public double getFrontAxleDisplacement()
Get the front axle displacement.

Returns:
the front axle displacement

getRearAxleDisplacement

public double getRearAxleDisplacement()
Get the rear axle displacement.

Returns:
the rear axle displacement

getWheelSpan

public double getWheelSpan()
Get the wheel span.

Returns:
the wheel span

getWheelRadius

public double getWheelRadius()
Get the wheel radius.

Returns:
the wheel radius

getWheelWidth

public double getWheelWidth()
Get the wheel width.

Returns:
the wheel width

getMaxSteeringAngle

public double getMaxSteeringAngle()
Get the maximum steering angle.

Returns:
the maximum steering angle

getMaxTurnPerSecond

public double getMaxTurnPerSecond()
Get the maximum turn per second.

Returns:
the maximum turn per second

getMaxTurnPerCycle

public double getMaxTurnPerCycle()
Get the maximum turn per cycle.

Returns:
the maximum turn per cycle

getRadius

public double getRadius()
Get the radius.

Returns:
the radius

getHalfWidth

public double getHalfWidth()
Get half of the width of the vehicle.

Returns:
the half of the width of the vehicle

getHalfLength

public double getHalfLength()
Get half of the length of the vehicle.

Returns:
the half of the length of the vehicle

getWheelbase

public double getWheelbase()
Get the wheelbase of this Vehicle.

Returns:
the difference between the rear and front wheel displacements

getCenterPoint

public Point2D getCenterPoint(Point2D pos,
                              double heading)
Get the location of the center of the Vehicle at this point in time.

Parameters:
pos - the position of the vehicle
heading - the heading of the vehicle
Returns:
the global coordinates of the center of the Vehicle.

getPointBetweenFrontWheels

public Point2D getPointBetweenFrontWheels(Point2D pos,
                                          double heading)
Get the point between the front wheels.

Parameters:
pos - the position of the vehicle
heading - the heading of the vehicle
Returns:
the global coordinates of the point between the front wheels

getCornerPoints

public Point2D[] getCornerPoints(Point2D pos,
                                 double heading)
Get the current global coordinates of the corners of this Vehicle.

Parameters:
pos - the position of the vehicle
heading - the heading of the vehicle
Returns:
an array of points representing the four corners.

getCornerPoints

public Point2D[] getCornerPoints(double extra,
                                 Point2D pos,
                                 double heading)
Get the current global coordinates of the corners of the Vehicle, assuming it is larger in each dimension by a fixed amount.

Parameters:
pos - the position of the vehicle
heading - the heading of the vehicle
extra - the fixed amount to add to each dimension of the Vehicle.
Returns:
an array of points representing the four "inflated" corners

getPointBetweenRearWheels

public Point2D getPointBetweenRearWheels(Point2D pos,
                                         double heading)
Get the point between the rear wheels.

Parameters:
pos - the position of the vehicle
heading - the heading of the vehicle
Returns:
the global coordinates of the point between the rear wheels

getPointBetweenAllWheels

public Point2D getPointBetweenAllWheels(Point2D pos,
                                        double heading)
Get the point between all the wheels.

Parameters:
pos - the position of the vehicle
heading - the heading of the vehicle
Returns:
the global coordinates of the point between all the wheels

getPointAtRear

public Point2D getPointAtRear(Point2D pos,
                              double heading)
Get the point at the rear center of the Vehicle.

Parameters:
pos - the position of the vehicle
heading - the heading of the vehicle
Returns:
the global coordinates of the point at the center of the Vehicle's rear

getPointLeftSideFrontAxle

public Point2D getPointLeftSideFrontAxle(Point2D pos,
                                         double heading)
Get the point on the left side of the Vehicle, aligned with the front axle.

Parameters:
pos - the position of the vehicle
heading - the heading of the vehicle
Returns:
the global coordinates of this point

getPointRightSideFrontAxle

public Point2D getPointRightSideFrontAxle(Point2D pos,
                                          double heading)
Get the point on the right side of the Vehicle, aligned with the front axle.

Parameters:
pos - the position of the vehicle
heading - the heading of the vehicle
Returns:
the global coordinates of this point

getRearLeftCornerPoint

public Point2D getRearLeftCornerPoint(Point2D pos,
                                      double heading)
Get the current global coordinate of the rear-left corner of this Vehicle.

Parameters:
pos - the position of the vehicle
heading - the heading of the vehicle
Returns:
a point representing the rear-left corner

getRearRightCornerPoint

public Point2D getRearRightCornerPoint(Point2D pos,
                                       double heading)
Get the current global coordinate of the rear-right corner of this Vehicle.

Parameters:
pos - the position of the vehicle
heading - the heading of the vehicle
Returns:
a point representing the rear-right corner

getWheelCenters

public Point2D[] getWheelCenters(Point2D pos,
                                 double heading)
Get the points where each of the wheels is presumably touching the road.

Parameters:
pos - the position of the vehicle
heading - the heading of the vehicle
Returns:
an array of 4 points, representing the front left, front right, rear left, and rear right wheels' points of contact with the road.

getWheelShapes

public Shape[] getWheelShapes(Point2D pos,
                              double heading,
                              double steeringAngle)
Get the Shapes of each of the wheels.

Parameters:
pos - the position of the vehicle
heading - the heading of the vehicle
steeringAngle - the steering angle
Returns:
an array of wheel Shapes: front left, front right, rear left, rear right


Copyright © 2011. All Rights Reserved.