RC-presentation

Download Report

Transcript RC-presentation

RC Car
Thomas Chau, Ben Sack, Peter Tsonev
Overview


Goal: to build a smart
RC car that corrects
itself using sensors.
Objective: testing our
run at high speed
towards an object and
halt before crashing.
Architecture and Design

NIOS system.

PWM component to interface Altera with Car

Ultrasonic Sensor component with interrupts.


Software component – feedback loop
integrating sensor readings and outputting to
PWM.
Additional servo to rotate sensor 90 degrees.
Algorithm

D = distance read from sensor (inches)

S = speed calculated from D and previous D (inches per second)

While (D is not target D)

Read D. Let S = (D' – D) * dt

Let new speed = function (D, S)

Let PWM level = normalization (speed) => [6% to 9%]

Write PWM level to register.
PID Equations




Two equations; two degrees of freedom
Gain equation tries to get car as close to target
as possible.
Differentiator equation opposes the first
equation if the speed of approach is too high.
The balance of the two equations brings the car
to target.
Implementation


Engineering a good
feedback loop takes a
great deal of
experimentation.
Precise distance
measurements are tough;
precise speed
measurements are even
harder.
Implementation Cont'd



PID theory is for linear behavior; however, the physical
system of the car and especially the throttle control is
highly nonlinear.
Our task is critical damping. The PID equations work
best for under-damping.
Solution: introduce a nonlinearity in the equations; the
differentiator is also a measure of distance to target.
(Smaller distance -> more reverse throttle)
Results



Engine lost reverse throttle capability.
The following graphs show our measurements
while the engine was still performing.
Graphs: Overdamping, Critical Damping, Dirty
Measurements
140
120
100
80
60
40
20
0
-20
Row 5 Row 11 Row 17 Row 23 Row 29 Row 35 Row 41 Row 47 Row 53 Row 59 Row 65 Row 71 Row 77 Row 83 Row 89 Row 95 Row 101
Row 2 Row 8 Row 14 Row 20 Row 26 Row 32 Row 38 Row 44 Row 50 Row 56 Row 62 Row 68 Row 74 Row 80 Row 86 Row 92 Row 98
distance
dirty_distance
delta_dist
120
100
80
60
40
20
0
-20
Row 4 Row 8 Row 12 Row 16 Row 20 Row 24 Row 28 Row 32 Row 36 Row 40 Row 44 Row 48 Row 52 Row 56 Row 60 Row 64 Row 68 Row 72 Row 76 Row 80
Row 2 Row 6 Row 10 Row 14 Row 18 Row 22 Row 26 Row 30 Row 34 Row 38 Row 42 Row 46 Row 50 Row 54 Row 58 Row 62 Row 66 Row 70 Row 74 Row 78 Row 82
distance
dirty_distance
delta_dist
140
Results
120

Graph
100
80
60
40
20
0
-20
Row 5
Row 11 Row 17
Row 23 Row 29 Row 35
Row 41 Row 47 Row 53
Row 59 Row 65
Row 71 Row 77 Row 83
Row 2
Row 8
Row 14 Row 20 Row 26
Row 32 Row 38 Row 44
Row 50 Row 56
Row 62 Row 68 Row 74
Row 80
distance
dirty_distance
delta_dist
100
80
60
40
20
0
-20
Row 4
Row 8
Row 12
Row 16
Row 20
Row 24
Row 28
Row 32
Row 36
Row 40
Row 44
Row 48
Row 2
Row 6
Row 10
Row 14
Row 18
Row 22
Row 26
Row 30
Row 34
Row 38
Row 42
Row 46
filtered_distance
dirty_distance
distance_delta
New Demo instead of Throttle Demo




Uses PID concept except with steering rather
than braking.
New challenges: sensor reads wall at a bad
incident angle.
Nonlinear throttle affects turning rate.
Poor sensor resolution requires larger
distances.
Difficulties



The car exploded
Physical difficulties:
measurement; figuring out
parameters for feedback
equations; hacking the
hardware; fundamental
nonlinearities.
Physical limitations; ultrasonic
sensor updating every 50ms
with 1” granularity. Car engine
with very rough speed control.
Unpredictable battery
conditions.
Lessons Learned



Be careful not to jerk the PWM levels,
damaging transistors.
Wiring is too low-level; it complicates debugging
and increases the development time.
Data filtering for dirty measurement data;
unforeseen sources of interference (ethernet,
battery, servos, engines, etc.)
Thanks!

Peter cuts a
breadboard down to
size.