Skip to content

Commit 1eaf8c1

Browse files
committed
Finished up the README.
1 parent 51b54ce commit 1eaf8c1

File tree

1 file changed

+97
-1
lines changed

1 file changed

+97
-1
lines changed

README.md

Lines changed: 97 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,4 +50,100 @@ altitude and speed.
5050

5151
Airplane Tracking
5252
-----------------
53-
53+
There are three basic methods of the `airplane.ControllableAirplane` class which allow for tracking:
54+
55+
1. `getName()` - returns a unique identifies as an ASCII string. The string
56+
will include letters and numbers. These are displayed in the simulator above
57+
and to the right of each airplane's position.
58+
2. `getPosition()` - returns a `vector.Threevec` containing the current
59+
position of the aircraft. The coordinates are in meters, with the x-axis
60+
pointed East, the y-axis pointing North, and the z-axis pointing up with z=0
61+
being sea-level.
62+
3. `getVelocity()` - returns a `vector.Threevec` containing the current
63+
velocity of the aircraft. The components are in meters per second with
64+
directions corresponding to those in the `getPosition()` method.
65+
66+
Airplane Control
67+
----------------
68+
There are several methods of the `airplane.ControllableAirplane` class which
69+
send control commands to the airplanes. They are as follows:
70+
71+
1. `isControllable()` - returns True if the airplane can be controlled. This
72+
will be true for all airplanes in the simulation.
73+
2. `sendHeading(heading)` - commands that the aircraft turn to heading where
74+
heading is an angle in radians that runs from 0 being North, through pi/2
75+
being East, pi being South, and 3pi/2 being West. The aircraft will not
76+
immediately assume this heading, but will turn toward this heading. The
77+
maximum turn rate of these airplanes is 1.5 degrees per second.
78+
3. `sendAltitude(altitude)` - commands the aircraft to climb or descend to
79+
altitude` in meters. The rate of climb and descent is limited by the pitch of
80+
the aircraft above or below the horizon. The maximum rate and which the
81+
airplane can change altitude is at its speed times the sine of the pitch
82+
angle. The maximum pitch angle for these airplanes is 7.5 degrees. The
83+
aircraft is also limited to cruising between 6,000 and 10,000 meters altitude
84+
and will not exceed those bounds.
85+
4. `sendSpeed(speed)` - commands the aircraft to travel at the speed speed in
86+
meters per second. The aircraft is limited to speeds between 215 and 250
87+
meters per second and will not exceed those bounds.
88+
89+
Airplane Request
90+
----------------
91+
The airplane is trying to get somewhere. In order to do that it will have
92+
available a desired heading, altitude, and speed. These requested parameters
93+
are available using the following methods of `airplane.ControllableAirplane`:
94+
95+
1. `getDesiredHeading()` - returns the desired heading in radians with 0 being North, pi/2 being East, etc.
96+
2. `getDesiredAltitude()` - returns the desired altitude in meters above sealevel.
97+
3. `getDesiredSpeed()` - returns the desired speed in meters per second.
98+
99+
After dodging any potential aircraft in the way, the airplane should be allowed to resume these settings, but you will have to send it the appropriate commands.
100+
101+
Flight Control
102+
--------------
103+
104+
You will be modifying the `flight_control.py` file, which contains the flight
105+
control system. The system is encapsulated in a class called
106+
`FlightController`. This class is instantiated by the simulator and then every
107+
10 seconds the `executeControl` command is called with a single argument that
108+
contains a list of all airplanes in the simulation. An example is provided in
109+
the source code, which I copy below.
110+
111+
```python
112+
import airplane
113+
import vector
114+
import math
115+
116+
class FlightController(object):
117+
"""This is the flight controller class. Its job is to send commands to
118+
the airplanes to make sure they don't hit each other
119+
and get where they are going."""
120+
def __init__(self):
121+
"""If you need to initialize any data structures do it here."""
122+
pass
123+
124+
def executeControl(self,airplane_list):
125+
"""Every 10 seconds a list (airplane_list) of flying objects will be
126+
passed to you. You can find the positions of the airplanes and issue
127+
flight control commands to them."""
128+
for a in airplane_list:
129+
a.sendHeading(a.getDesiredHeading())
130+
a.sendAltitude(a.getDesiredAltitude())
131+
a.sendSpeed(a.getDesiredSpeed())
132+
```
133+
134+
Note that the example only sends airplanes their own desired headings,
135+
altitudes, and speeds. It does not check for or avoid collisions. You will
136+
need to change that by making sure that airplanes do not get too close or
137+
crash.
138+
139+
During the simulation you will receive penalties for airplanes crashing or for
140+
airplanes being too close together. Airplanes crash if they are within 100
141+
meters of one another. Airplane are too close if their altitudes are within
142+
600 meters of another airplane while they are within 10 km of one another. You
143+
will receive a 1000 point penalty for any airplane that crashes and a 100
144+
point penalty every 10 seconds for each airplane that is too close to another.
145+
146+
At the end of the simulation you receive 1000 points for each airplane that is
147+
still flying. You get a bonus of 500 points for each airplane on the right
148+
heading, 250 points for each airplane at the right speed, and 250 more points
149+
for each airplane at the right altitude at the end of the simulation.

0 commit comments

Comments
 (0)