Module shipModels :: Class Ship
[hide private]
[frames] | no frames]

Class Ship

source code

This class describes a general ship. A ship has:

physical properties.

Any implementation of any of the above part can be plugged-in, allowing to mix different combinations of capabilities into a ship.

A ship's external state, which is its coordinates, velocity, orientation and so on, is not part of the ship itself, but part of the environment, and is part of the world state.

Instance Methods [hide private]
 
__init__(self, perceptionModule=CompleteStatePerceptionModule(), initialEngineSpeed=0, initialSteering=0, maxSpeed=40, minSpeed=-10, maxSteering=90, minSteering=-90, mass=1000, length=12) source code
 
__str__(self) source code
 
getPercepts(self, fullState)
We view the ship as receiving a full world state and then "filtering" it to only the percepts it is able to process.
source code
 
executeAction(self, action)
Change the internal state of a ship as a result of an action that was chosen by the ship agent.
source code
 
setSteering(self, steering) source code
 
setEngineSpeed(self, speed) source code
 
stop(self)
Stop the ship.
source code
 
getForwardForce(self, shipSpeed)
Computing the forward force applied on the ship based on the engine and the drag forces.
source code
 
getSteeringForce(self, shipSpeed, shipAngularSpeed)
Computing the steering force based on the, the speed, the drag and so on.
source code
 
getForwardAccelerationFromForce(self, forwardForce) source code
 
getAngularAccelerationFromForce(self, steeringForce)
Assuming mass is spread homogenously.
source code
NumPy vector
getOffsetByEnvConditions(self, windVector, currentVector, orient)
Compute a ship's response to the environment conditions.
source code
Method Details [hide private]

getPercepts(self, fullState)

source code 

We view the ship as receiving a full world state and then "filtering" it to only the percepts it is able to process. Philosophically, we could view the world that way: we are only able to process part of the complete information that surrounds us.

executeAction(self, action)

source code 

Change the internal state of a ship as a result of an action that was chosen by the ship agent. The 'action' argument can be a (possibly empty) composite action, and in general is a list of pairs of the form (methodname, args), such that self.methodname(args) is executed for each pair.

stop(self)

source code 

Stop the ship. This function might need to be changed because it will not always be correct that setting everything to 0 will stop it

getAngularAccelerationFromForce(self, steeringForce)

source code 

Assuming mass is spread homogenously. Using formulas from http://rockpile.phys.virginia.edu/arch16.pdf that relates angular acceleration to torque.

getOffsetByEnvConditions(self, windVector, currentVector, orient)

source code 

Compute a ship's response to the environment conditions.

Parameters:
  • windVector (NumPy vector) - vector of the wind in the ship's location
  • currentVector (a numpy vector) - vector of the current in the ship's location
  • orient (float) - The ship's orientation (part of determining the response)
Returns: NumPy vector
An (x, y) offset of the ship, as a numpy vector