0% found this document useful (0 votes)
77 views11 pages

ENGG 3490 Mechatronics Systems Design: Lab 3: Closed Loop Control

1) The purpose of the lab was to gain insight into closed loop control systems by creating a robot with automatic path correction using a gyro sensor and PD control function. 2) Key equipment included a Handy Board, gyro sensor, rangefinder, and DC motors. The gyro was used to measure angular velocity which was calibrated. The rangefinder tracked the robot's position. 3) Tuning the PD control involved gradually increasing the proportional term until the robot compensated for impulses without overcorrecting. The integral term was then increased to eliminate steady-state error. Finally, the derivative term improved response time but was kept small to reduce noise sensitivity.

Uploaded by

assnad
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
77 views11 pages

ENGG 3490 Mechatronics Systems Design: Lab 3: Closed Loop Control

1) The purpose of the lab was to gain insight into closed loop control systems by creating a robot with automatic path correction using a gyro sensor and PD control function. 2) Key equipment included a Handy Board, gyro sensor, rangefinder, and DC motors. The gyro was used to measure angular velocity which was calibrated. The rangefinder tracked the robot's position. 3) Tuning the PD control involved gradually increasing the proportional term until the robot compensated for impulses without overcorrecting. The integral term was then increased to eliminate steady-state error. Finally, the derivative term improved response time but was kept small to reduce noise sensitivity.

Uploaded by

assnad
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 11

ENGG*3490 MECHATRONICS SYSTEMS DESIGN Lab 3: Closed Loop Control

Group xx Student1(0111119) Student2(0111118)

SCHOOL OF ENGINEERING University of Guelph February 1, 2006

Lab 3

Group xx

Table of Contents
Table of Contents ...............................................................................................................................1 Purpose ...............................................................................................................................................2 Equipment ..........................................................................................................................................2 Handy Board ..................................................................................................................................2 Interactive C ...................................................................................................................................2 DC Motor .......................................................................................................................................2 Micro Piezo Gyro (PG-2033).........................................................................................................3 SHARP GP2D12 Rangefinder .......................................................................................................3 Results and Discussion.......................................................................................................................4 Determining Angular Velocity.......................................................................................................4 Integral of Angular Velocity ..........................................................................................................6 System Tuning ...............................................................................................................................6 Conclusions and Recommendations...................................................................................................9 Appendix A: Source/Pseudo Code...................................................................................................10 Appendix B: Raw Data ....................................................................................................................10

Lab 3

Group xx

Purpose
The purpose of this lab was to gain insight into simple signal filtering, numeric integration and closed loop control systems. To accomplish this we created a robot with an automatic path correction system. This was performed using a PD control function and gyro rotational sensor. The Euler method for numeric integration and conversion functions were employed to create the function, as well as a range sensor to track and tune its performance.

Equipment
Handy Board
The Handy Board is a board based on the Motorola MC68HC11 processor which features a system of analog and digital connectors that allow active sensors to be individually plugged into the board. It comes equipped with an LCD screen, a battery pack and is mainly used for experimental robotics, or other embedded control applications.

Interactive C
This piece of software is used to load the Handy Boards existing firmware with a C program, written by the students, to accomplish a certain task (i.e. gathering data through the polling of the sensors).

DC Motor
This is a modified servo motor. Three similar yet unique motors were used in this laboratory. The gearing is set to a 300:1 ratio to lower the maximum rpm range and also improve torque.

Lab 3

Group xx

Micro Piezo Gyro (PG-2033)

Figure 1- Gyro
MAXX Products International, Inc. (www.maxxprod.com)

The micro piezo gyro system is a sensor which is able to detect changes in position about a central axis. When oriented with the axis vertical on the robot the sensor detects rotational acceleration which is internally integrated and received as measurements of the robots rotational velocity. These values can then be calibrated and integrated to reflect the robots deviation from its original heading.

SHARP GP2D12 Rangefinder


The Sharp GP2D12 takes continuous infrared distance readings within a peak operational range of about 10-80cm. In this lab the device was used to track the position of the robot relative to a reference wall perpendicular to the path of the robot.

Figure 2 - GP2D12 Rangefinder


http://www.acroname.com/robotics/parts/R48-IR12.html

Lab 3

Group xx

Results and Discussion


Determining Angular Velocity
To perform a rough calibration of the assembled robot, the motors were turned on at a designated power level and the gyro was polled every 0.1 seconds over 100 samples. This process was repeated for every grading power level. The gyro was also polled while at a stand still to determine the reading of zero (0) rotation. These experiments yielded the results found in table 1.
Motor Speed Full Rotation Time (s) Rotational (RPM) Average Reading Away from neutral angular (degrees/s) ang vel. (rad/s) ang vel (rad/min) velocity 0.45 0.28 16.91 1.52 0.95 57.12 1.92 1.21 72.50 2.17 1.37 81.95 2.33 1.46 87.67 2.38 1.50 89.76 2.39 1.50 90.19 2.41 1.51 90.84 2.50 1.57 94.25 2.56 1.61 96.66 Gyro 82.81 1.81 87.04 6.04 88.79 7.79 90.08 9.08 90.46 9.46 90.18 9.18 90.68 9.68 90.93 9.93 91.09 10.09 91.20 10.20 Velocity 2.69 9.09 11.54 13.04 13.95 14.29 14.35 14.46 15.00 15.38 10 22.3 20 6.6 30 5.2 40 4.6 50 4.3 60 4.2 70 4.18 80 4.15 90 4 100 3.9

Table 1 - Rotational Testing Results

The zero reading was 81, so it was determined that:


1) (Gyro Reading) 81 = Adjusted Gyro Reading

would be used to represent the values found by the gyro, Away from neutral found in Table 1. This decision later permitted negative and positive angular velocities to be used. Concurrently, the physical 360-degree rotation was timed 3 times per power level to find the Full Rotation Time. The RPM was calculated, followed by the various angular velocities using the experimental values. The angular velocity (rad/s) was graphed versus the Adjusted Gyro Reading to make an accurate calibration curve, Chart 1. This curve, which was a linear relation, permitted us to determine the

Lab 3 yielded the following equation:


2) Angular Velocity (rad/s) = 0.1557 * Adjusted Gyro Reading

Group xx

instantaneous angular velocity of the robot by taking a value from the gyro. The calibration curve

Angular Velocity Read from Gyro


1.80 1.60 1.40 Angular Velocity (rad/s) 1.20 1.00 y = 0.1557x 0.80 0.60 0.40 0.20 0.00 0.00

2.00

4.00

6.00 Adjusted Gyro Reading

8.00

10.00

12.00

Figure 3 - Angular Velocity Calibration Curve

The previous equation is used in the PID controller to derive the total angular movement of the robot over a given period of time. The next process was to determine the power level required by the motor to achieve a certain angular velocity. This curve, Chart 2, is used later to feed the motor the appropriate power to counteract external disturbances and ensure that the robot regains a zero degree heading. The equation yielded:
3) Power = 67.652*Ang.Vel 47.724

Motor Power Required


70 60 50 Motor Power (%) y = 67.652x - 47.724 40 30 20 10 0 0.90 1.00 1.10 1.20 1.30 1.40 1.50 1.60 Angular Velocity (rad/s) Figure 4 - Motor Power Calibration Curve

Lab 3

Group xx

Integral of Angular Velocity


To determine the integrals of the measured angular velocities we chose to use the Euler method of numeric integration for several reasons. The basic Euler method of numeric integration is a very simple and quick method of determining the integral of a function over time. This makes it ideal for embedded systems since it is easy to implement and is light on the system resources. The Improved Euler method offers a lower error over the basic Euler method (4th order vs 3rd order), but is more complicated to implement since it involves the calculation of the midpoint before the difference can be found. The reduction of the error term is also less of a consideration in this case given the high error in the measurements and the constants involved in the PD control function which can be made to compensate for errors in the calculated integrals of the measured values. The final alternative method is the Runge-Kutta method which involves the calculation of the integral using a recursive calculation with the next value based on the present value, the size of the interval and an estimated slope as a collection of weighted averages. Needless to say this method is significantly more difficult to implement, though it again reduces the error of the resultant values to the order of h5 per step, though the total error remains a forth order function. When deciding on an appropriate method for the approximation of the integral of a numeric function the required accuracy must be considered in relation to the simplicity of implementation and required responsiveness and load of the system. The PID controller uses tuning variables to control the reaction of the motor to various outside disturbances. As described in section 1, the motors reaction is dependant on the speed at which the robot is put off course. The k-transform value is found by the trend lines equation in chart 2. The trend line was found using exclusively data between 20 and 60% power because that was the most reliable operating range. Once put into test, the turning wheel reacted appropriately, but often overcompensated in the event of a small change. The turning variable, Td, was lowered to 0.8, from the original value of 1. This caused the wheel to have a weaker reaction to disturbances, while keeping a quick reaction time.

System Tuning
To tune the system we chose a conventional procedure in which the control term constants are set to zero and then each increased gradually until a controlled response is achieved. In this case we gradually increased the proportional term until it began to compensate adequately to impulse 6

Lab 3

Group xx

horizontal movement, we then increased the derivative term until a reasonable response time was achieved. We encountered some difficulty in overshoot with higher values in the derivative term, which resulted in us setting a very small constant to control the overshoot. This term did, however, still offer an acceptable rate of response, especially when the total function gain constant was set. The system constant was set to a value that was derived from a calibration of the power of the motor in relation to the resultant rotational velocity, for max voltage percentages between 20 and 60. We chose this range as a reasonable rate of correction for the system to allow a reasonably quick course correction without increasing the overshoot of the system. The overall system response ended up being quite good as shown in charts 3-5, though we did have some error in the response of the system over time as a result of the error in the integration and instabilities in the control function. These might have been accounted for had we included an integral term into the control function, though we believe that our PD system showed an adequate response to horizontal impulses given the required responsiveness and accuracy of the robot. Straight-line tests were conducted on the final robot configuration to demonstrate that our calibration was done properly. The four tests are presented in chart 3. The sensor took 50 range samples at increments of 0.25s, totaling a 12 second test period. Try 1 is a perfect example of base movement: the range readings stay consistent as the robot maintains its course. The sectioned wheels introduce some element of error as the robot rumbles across the surface because they create a vibration throughout the machine. Also, because of the nature of the GP2D12, the values oscillate slightly due to lower precision being exchanged for a greater range. As demonstrated in lab 1, the GP2D12 will sometimes return an erroneous value, the values circled in red on Try 1, are an example of these errors, they can also be seen in all the other Tries. Try 2, 3, and 4 are imperfect tests, but the sloping values can be explained. Try 2 sees a low, linear slope. In all tests the surface used for the reading, a piece of tabletop, is held by a group member parallel to the robot and slid along the surface as the robot moves forward. In the case of Try 2, the robot was not placed exactly parallel to this surface, and the gyro, sensing no rotation, rightly did not correct the robot. The values read increase linearly, demonstrating a true path. Try 3 and 4 see friction error. When activated, the robot had more traction on one wheel than the other. This difference affected the robot immediately, and caused it to move off at an angle. However the movement was sensed by the gyro, and over the following four (4) seconds the orientation of the robot was corrected. 7

Lab 3

Group xx

Figure 5 Straight Line Testing

The following tests introduced outside disturbances onto the robot. The test again takes 50 range samples over a period of 12 seconds.
Outside Disturbance 1: Rotation Away From Wall
100 90

Outside Disturbance 2: Rotation Towards Wall


140

120
80 70 GP2D12 Range Reading 60 50 40 30 20

100 GP2D12 Range Reading

80

60

40

20
10 0 0.00

2.00

4.00

6.00 Time Elapsed (s)

8.00

10.00

12.00

0 0.00

2.00

4.00

6.00 Time Elapsed (s)

8.00

10.00

12.00

Figure 7 , 7 - Counter-clockwise Rotation/Clockwise Rotation

Lab 3

Group xx

For chart 4 and 5, the robot was turned approximately 45degrees in the appropriate direction. The disturbance can be seen plainly by the spike in the graph. The slope that follows is the robot using the turning wheel to regain a 0degree heading. The sensor sees the hypotenuse as the distance, so both graphs appear as if the robot is getting closer to the wall, when in fact it represents the robot turning until the sensor is perpendicular to the wall. Both graphs then level indicating that the robot is once again heading parallel to the wall.

Conclusions and Recommendations


The robot was assembled and tuned successfully. The software aspect of this lab was hard to envision. The integral equation in the lab hand-out causes confusion; it is hard to know exactly what the integral is. We eventually determined that the integral was in fact a theta directional value, and we must use angular velocity to update the robots heading. But this information was not evident when reading through the material. The turning motors worked well, it kept the robot on course, regardless of the outside disturbance. The PID controller was well handled, and readily relayed any heading changes to the turning motor. However, the two driving motors were determined to be incongruent. One wheel has more traction while the other runs faster. Varying the power output of these motors made little difference to the forward heading of the robot. The motors reactions were also very dependant on the material of the underlying surface. Thankfully, the turning motor corrected any glitches caused by surfaces or variable power, and helped the robot maintain a true heading.

Lab 3

Group xx

Appendix A: Source/Pseudo Code


Insert relevant source code (not necessarily all of it)

Appendix B: Raw Data


Insert important raw data

10

You might also like