DOC PREVIEW
UIUC GE 423 - Motor Control and Straight-Line Robot Driving

This preview shows page 1-2 out of 5 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 5 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 5 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 5 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

Mechatronics Laboratory Assignment 5Motor Control and Straight-Line Robot DrivingRecommended Due Date: By your lab time the week of March 10thPossible Points: If checked off before your lab time the week of Mar. 17th … 14 pointsIf checked off after your lab time the week of Mar. 17th and before 4:00PM Mar. 21st … 11 pointsIf work not finished before 4:00PM Mar. 21st … 0 pointsMechatronics Laboratory Assignment 5Motor Control and Straight-Line Robot DrivingRecommended Due Date: By your lab time the week of March 10thPossible Points: If checked off before your lab time the week of Mar. 17th … 14 pointsIf checked off after your lab time the week of Mar. 17th and before 4:00PM Mar. 21st … 11 points If work not finished before 4:00PM Mar. 21st … 0 pointsGoals for this Lab Assignment:1. Learn why feedback control is used to complete a straight-line driving task by comparing open-loop, decoupledloop, and coupled-loop control methods.2. Create a VB interface to communicate with the robot and display the current robot position. DSP/BIOS Objects Used:PRDLibrary Functions Used:Global variables: enc1_rad, enc2_rad, enc3_rad and enc4_rad, switchstate Functions: void PWM_out(enum epwm ep, float u)Lecture Topics:PI Control and Integral Wind-upPrelab:As a prerequisite for this class, all students should have completed a first course in control theory. We thereforeexpect that at some time, the student has already learned about basic feedback loops, specifically PI control. Please reviewyour notes on this subject, as you are expected to implement a PI-type controller in lab. Read the lab and begin coding aPI speed controller for the right and left drive sides. This will help you finish the lab in a timely fashion.Laboratory Exercise: In this lab, we will be attempting to control the motion of the robot and testing this by driving therobot in a straight line. There are many different ways to do this; we will investigate very standard techniques:Exercise 1: Open-Loop Robot Driving.Starting with a new project, implement open-loop control of the robot just as you did in Lab 3. The value read fromoptical encoder 3 divided by 100 should be sent to both motors as an open-loop torque command. We are going tocompare the open-loop to the closed-loop controls designed later in lab. Setup your program (in a switch-case statement)so that when all the dip-switches are FORWARD (towards the front of the robot) nothing is output to the motors. Alsodisplay “Robot Off” to the LCD screen. When the first dip-switch is back and all others forward, run the open-loopcontroller. Display something like “Open Loop” to the LCD screen.Always test your code out first on the bench before putting the robot on the ground.We suggest a certain organizational structure to help you better debug your code. The following pseudo-code willhelp guide you through the steps needed. Inside the “void control(void)” function just after the call to “updateData()”:1. Remember that “void control(void)” is the function for the SWI, SWI_control. SWI_control is posted in thegiven code every 1ms after all the optical encoder channels have been read.2. Increment a long integer to keep track of elapsed time;3. Use the drive-motor optical encoders (Encoders #1 & #2) to calculate the motor velocity in tiles/second;GE423, Mechatronic Systems Lab 5, Page 1 of 54. Calculate the robot’s position from the average of the two motor velocities;5. The global variable “switchstate” contains the status of the four white switches on the “shield” board just to theleft of the color LCD screen. Since there are 4 switches, the value of switchstate ranges from 0 to 15.6. Use a switch-case code structure to implement different control algorithms for different dip-switch settings;7. Inside the open-loop case statements, set control efforts u1 and u2 to Encoder #3’s value divided by 100. Inexercises 2, 3 and 4, encoder #3’s value will be used as the desired velocity set point for the control or the desiredturn set point.8. Modify resulting u1 and u2 by adding friction compensation (use 60% of the values found in Lab 3). Make sureNOT to apply friction compensation when the robot is in the OFF state. The OFF state should send 0, with“PWM_out”, to both motors.9. Output u1 and u2 to the motors with the “PWM_out” command;10. Save past variables as needed;11. Print to LCD on line 1 a text message indicating which control algorithm is active and on line 2 the open-loopcommand (or reference velocity) and measured motor velocities with only 1 decimal resolution. Remember notto print too fast to the LCD. After testing your code on the bench, place the robot on the floor and drive the robot back and forth and see howstraight it follows a line. Some robots drive at a more noticeable curve than others. All the robot’s drive pretty straightbut can we do better? What are possible problems with open loop driving even if it is straight enough?Exercise 2: Closed-Loop Robot Driving with Decoupled Control Loops (See Figure 1).Partners switch so that the other person can do some coding.1. Add another case statement to check if the second switch is back and all others forward. If so, your casestatement will calculate u1 and u2 from two different PI control loops. You will be implementing the codeequivalent to the diagram in Figure 1. As a start, use Kp = 3 and Ki = 5. These are good starting gains assumingthat all velocities are measured in tiles/second. You will tune these slightly in lab to achieve a more responsive PIcontrol. Also, print a message to the LCD screen like “PI”.2. Check for integral wind-up. Add another ‘if’ statement inside your case statement that checks if the controlefforts (u1 for motor 1 and u2 for motor 2) are within the range of +/- 10. If the control command is outside thisregion, make sure that the integral term does not wind up by multiplying the integral sum by 0.99. This willforce a decay of the integral term. Why is this necessary?3. Build and run your code. Test the robot first on your bench. When you change the desired speed (you shouldname this variable “vref”) by rotating encoder #3 the robot’s wheel velocity should, after a small transient, matchthe desired speed. Tune the Ki gain slightly to see if you can achieve a quicker transient response in motor speed.Put the robot on the floor a test the


View Full Document

UIUC GE 423 - Motor Control and Straight-Line Robot Driving

Documents in this Course
ARTWORK

ARTWORK

16 pages

Load more
Download Motor Control and Straight-Line Robot Driving
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Motor Control and Straight-Line Robot Driving and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Motor Control and Straight-Line Robot Driving 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?