Brett Browning and M. Bernardine Dias Spring 2011
Lab #1 feedback Final project overview Final project teams Lab #2 overview Slide 2
Cluttered racing task Probably want to be able to accelerate fast, brake fast, turn quickly Reduce mass (better power to weight) Lower Center of Gravity Reduce rotational inertia (bring mass close to CG) Sensing Ensuring that your sensors can see the interesting bits for the task is essential E.g. where should lasers be, where should they aim? Protection Ensuring that computers/sensors can t be damaged is a good idea Always remember wires in a layout Accessibility Being able to access all the parts is very useful Slide 3
Hopefully you learned to Be prepared and on time for the demo Make sure it all works for the demo Start early, have a plan, re-evaluate as you proceed Driving Ramping up/down speeds is crucial to control Encoders are good, but may have calibration issues Sensor is good, but doesn t see everything Plotting Learn to use Matlab (initial pain, but very useful) Save data in text files: one sample per row, space or comma separated e.g. 1.3654 3.3 4.5678 1.4663 3.5 4.222 Load with matlab: data=load( foo.txt ); Slide 4
Slide 5
Slide 6
Introduction to control Closed-loop control PID control ER1 control Drive to a point Path following Next Slide 8
Detailed topic, but we ll just focus on PID control We won t be concerned with detailed analysis There are many books on the topic if you are interested! Also many courses (e.g. TAMUQ, CMU-P ) Key concepts Open loop vs closed (feedback) loop control Input vs. Response PID control Rules of thumb for tuning PID loops Slide 9
How to correct the command to achieve target? E.g. g Turn to point ω θ Slide 10
Generate a command (or sequence) to achieve the desired trajectory No feedback based on outcome Path planning is often done this way: have a model of how system will respond, pick the best command, then execute Slide 11 What can go wrong?
Generate a command (or sequence) to achieve the desired trajectory and adjust it based on sensed feedback Velocity control can be done this way, same for steering or visual servoing: See where we are and adjust based on our observed error Slide 12 What can go wrong?
Give an input, measure the output v cmd Input Response Linear speed robot Step input t Usually called the plant t If we knew the system response we could invert it to find the best command Slide 13
Slide 14
Step Parabola t t Ramp Sinusoidal t t Slide 15
** Multiple ways to define rise time Overshoot Input Ringing (non shown) Steady state error Rise time** Output Transitory Response Steady State Response Settling time t Typical control problem: For given input design system to achieve target response outputs Slide 16
Add feedback path and use error as input Command/in put v cmd (t) Error + e(t) - Robot (or plant) Sensed output v act (t) Actual Slide 17
Add feedback path and use error as input Command/in put v cmd (t) + - Error e(t) Controller Robot (or plant) Sensed Output v act (t) Actual Slide 18
Command is function of error and its integral/derivatives Proportional, Integral, Derivative In discrete time: v cmd (t) + - e(t ) v act (t) Controller Robot Sensed Output Slide 19
Command is function of error and its integral/derivatives Proportional, Integral, Derivative P I D In discrete time: v cmd (t) + e(t ) Controller Robot Sensed Output - v act (t) Slide 20
Typical response Input Smaller Kp Underdamped Output Larger Kp Overdamped t Slide 21
PIDControl(Kp,Ki,Kd,deltat): ierr=0 elast=0 while (1) { vdesired = get_new_command() vactual = sense_output() err = vdesired-vactual ierr += err*deltat derr = (err-elast)/deltat elast = err } vcmd = Kp*err + Ki*ierr + Kd*derr Slide 22
1. Check open loop response 2. Tune Kp to get okay performance (Ki=Kd=0) 3. Tune Ki to get zero S.S. Error 4. Tune Kd to reduce overshoot and improve rise-time response 5. Micro-tune Kp, Ki, Kd until target achieved Tuning by hand is an art. Mathematical derivation is better for serious vehicles. Slide 23
ER1 Controller Runs PID on (scaled) robot speed and rotation, with commands (vn,van) Returns encoder counts on left and right wheels (n r, n l ) Robot_server (C++) Performs translation from (v,w) to commands (vn,van) Performs dead reckoning to return (x,y,θ) (x,y) ω v Slide 24 Aligned with robot start position θ
javaer1 Lidar Server Robot*Main Net server Shared Memory UDP UDP ER1 Controller 2xDC Motors 2xOptical encoders, 512 CPR Lead-acid battery Slide 25 Robot Server er1_stereo Run remotely via ssh Xdriver BShell
Goal: Given target goal point, drive to it How do we do this? Driving arcs PID Trapezoidal control Slide 26
Given a path, how do we stay on the path? Carrot following and Pure pursuit PID on heading Dual controller Slide 27
Pick a point ahead on the path and execute drive to point How to pick the point? How far ahead? How to drive to point? Heading error? Closest point on path Slide 28 L Intersection with circle radius L
Circle intersection with path Drive a circular arc to intersect the point Driving Arc, radius r Intersection with circle Slide 29
Circle intersection with path Drive a circular arc to intersect the point Driving Arc, radius r curvature Intersection with circle L Slide 30
Given v, calculate w (some prefer curvature so invert accordingly) Driving Arc, radius r Note, sign takes care of left vs right turn Intersection with circle L Slide 31
Variations: Run a PID loop on target v Generalize eqn to PID loop Driving Arc, radius r Proportional control, can also add integral, derivative Intersection with circle L Slide 32
May care about heading error when we reach the path Run a PID on heading error Or, combine with pure pursuit Can get very creative but need to tune to vehicle and environment Pure pursuit Heading error Heading error Slide 33
Obstacle avoidance and navigation Arcs and potential fields Slide 34