Lab 5 – Vehicle Navigation System

In this lab, you’ll be designing a Vehicle Navigation System. Actually, you’ll be designing a controller to drive a car a predetermined distance, in shortest amount of time, while minimizing fuel consumption. We are going to ignore steering the car and will focus on throttle control only. To get started, download the following three files (vehicle.h, vehicle.c, main.c) and add them to a newly created Tornado project file. The code in vehicle.h/vehicle.c is a framework for a Dodge Viper simulator. The code in main.c is what you’ll be implementing. Do not modify anything in vehicle.h or vehicle.c!!!

Once your project is built and downloaded to the VxWorks Simulator, type the following command “start_simulation(1.0)” in the shell and watch the VxWorks window for output. This function will start the vehicle simulation engine. The parameter that is passed into this function must be a floating point number, that means that when you type it in, you must enter the whole part, followed by a period, followed by the fractional part! Don’t use integers. As an example, instead of 1, you should type 1.0. The parameter is the requested distance that the car must drive in miles. For example, entering 1.0 means drive for 1 mile and than stop. At the end of simulation, you’ll see a number of statistics outputted to the window. You should see the time it took for the vehicle to travel the desired distance. You should see the average speed that the car was traveling at in miles per hour (mph). Finally, you should see the average fuel consumption of the vehicle in miles per gallon (mpg).

The main.c file contains a single procedure that is called (periodically) at 10Hz, meaning 10 times per second. The control code must be implemented inside this procedure. Each time this procedure is called you can read a number of vehicle state information, such as speed, distance traveled thus far, fuel consumed thus far, etc., and must compute a throttle command. You command should be an integer in the range of 0 to 100. Zero is the same as letting the foot of the accelerator pedal. One hundred is the same as pushing the pedal all the way down (pedal to the metal).

There is an impractical controller supplied in the file. This controller will consume about 3 or 4 mpg and would take around 1 minute to get us go 1 mile. You should do better!  But first, experiment with the following.

Change the code in the controller such that the car is accelerating at full throttle! Now, answer these questions (include your answer in the report as well):

1.      What is the ¼ mile time of this car?

2.      What is the ¼ mile trap speed of this car?

3.      What is the ¼ mile fuel consumption of the vehicle?

4.      What is the top-speed (terminal velocity) of the vehicle?

3.      Would you buy a car like this?

The answer to the above questions will give you an idea of the car’s capabilities. You may want to conduct more experiments like the ones above.

Now design a controller that will maximize fuel consumption while getting the car to go a distance of two miles in minimum amount of time. (Actually there will be tradeoff between these two goals.)  You’ll have to choose a cruising speed that is optimal in terms of fuel consumption. Also, your controller should avoid maximum acceleration followed by no acceleration (as done in the sample code.)

Experiment with different control algorithms. Also, play around with parameters that are used in your algorithm, i.e., tune your controller, before demonstrating to the TA. In your report, describe the theory behind your algorithm and argue why it is good for control.

To make life easier, you should design your controller to run the two miles in no longer than 120 seconds.

The TA will tally the team’s numbers and a team (who’s controller functioned the best, i.e., had the largest gpm) will be chosen. The top 3 teams will gain 3, 2 and 1 additional points!