Published: November 10, 2014
dSPACE congratulates Thomas (Tom) Pruett, Senior Engineering Specialist at Fiat Chrysler Automobiles, for his first-place win in the Freescale Cup competition held at the SAE Convergence conference, October 21-22, 2014, in Detroit, Michigan, USA.
Tom designed and built an autonomous model race car using model based design to develop the control algorithms. This enabled Tom to keep his model car under control when confronting sharp curves on the race track, and earned him the fastest racing time and a first-place win.
The Freescale Cup is a global competition, open to both university students and industry professionals. The competition challenges participants to build, program and race an autonomous model car. It’s a great forum for participants to demonstrate their knowledge of electrical and mechanical engineering, including circuitry, interfacing and software design and control theory.
“It’s a great experience for any participant to work on the challenge to create this car, race it against others for time and have lots of engineering fun. ” said Damaris Ochoa, Freescale University Programs, Americas Coordinator.
Q: Can you tell us a bit about the competition and what attracted you to participate?
A: I have been an electronic hobbyist since I was a teenager. My degree is in electrical engineering. Before joining Chrysler, I did both hardware and software, and this project allows me to do both, which I enjoy.
Q: What particular challenges did you face in designing your entry - your car in this competition?
A: The track design is different for each race. This year, the black lines are on the edges of the track which requires the camera to have a wider field of vision. In the past, there was a single black line in the middle of the track. So, this year, I had to increase the height at which the camera was mounted.
Q: How did you go about the image processing algorithm development?
A: Freescale provided the low-level framework for capturing the image and driving the steering servo and left and right drive motors. The image processing algorithm has to determine where the car is on the track versus where it should be. Then I used a PID controller for steering. Having the algorithm modeled in Simulink made it easy to test in simulation.
Q: Can you tell us a bit about the car?
A: The car is driven by two motors in the rear. The motors are driven by independent PWM circuits. This year I applied more torque to the outside wheel during cornering, sort of a crude “torque vectoring”. This allowed me to go faster in the turns and still prevent understeer. A servo motor on the front wheels controls the steering linkage.
Another new addition this year was a Bluetooth interface. This allowed me to control the car from my phone or tablet. I could start and stop the car, change tuning parameters and even dump the camera image while it was running on the track. My son wrote me an Android app to visualize what the camera was seeing. It’s a line camera providing one row of 128 pixels.
Q: How do you relate your experience in developing your small competition car to larger vehicles you develop in your daily work life?
A: I work with control engineers and assist software engineers in developing production software with TargetLink. This competition allows me to wear both hats.
Q: Can you tell us about the software footprint in your vehicle and its criticalness in meeting the objectives of your vehicle?
A: The camera software driver captures an image every 1.32 milliseconds. I need about 400 milliseconds for the algorithm calculation. I discard every other image frame, and therefore, achieve an effective 2.64 millisecond processing rate. Other details are:
|Controller application (Auto-Coded)||2608 Bytes||54 Bytes|
|Main (Hand-Coded, mostly Bluetooth
command handling, camera buffer, etc)
|2690 Bytes||555 Bytes|
|Low-Level (Freescale)||4294 Bytes||1164 Bytes|
|Libraries||13462 Bytes||3021 Bytes|
|Total||23054 Bytes||4794 Bytes|
Q: How do you go about having quality bug-free code?
A: I started by synthesizing several test cases and running through the model as it was developed. Once it’s working Model-in-loop, I run the same tests using Software-in-loop and compare the results. This gives me confidence that my code works like the model.
Q: How have you leveraged model-based design, and specifically, TargetLink, for your competition entry vehicle?
A: There are several advantages of model-based design and auto-code generation. One of them is simulation. The image data I captured over Bluetooth can be used in MATLAB® for running simulations. Several image captures (e.g. carpet, finish line, test vectors of track) can be fed into the model and with TargetLink, model-in-the-loop and software-in-the-loop capabilities, I can make sure the code works correctly.
Another advantage of model-based design and auto-code generation is the ability to make quick changes. For example, this year the track had a crossing, where there was no black line. Initially my car would veer to the right. With the model-based design approach, it was very easy to add a plausibility check. Within 5 minutes, I modified the application, generated code with TargetLink® and downloaded the new application.
Q: How did TargetLink help?
A: The strength of TargetLink is the way it handles fixed point code. And fixed-point code was important, as the controller does not handle floating-point calculations.
Q: What is the secret to your success?
A: Using model-based design. It encourages a top-down approach which helps you think of it as a classical control problem. That is why I have applied a PID controller. Without a proper control design approach, it is a struggle to meet the objectives of the competition.
Q: How long did it take for you to prepare for this competition?
Overall, it took 6 weeks to get the car ready. In addition to
Freescale offered training every Wednesday at their office. I
it off and on and had my car ready about a week before the
Our sincerest congratulations to Tom on his win!