Data Logging 4 PID Tuning By Hugh Meyer Red Alert Robotics FRC Team 1741 Center Grove High School...
-
Upload
kristian-bryan -
Category
Documents
-
view
224 -
download
0
Transcript of Data Logging 4 PID Tuning By Hugh Meyer Red Alert Robotics FRC Team 1741 Center Grove High School...
![Page 1: Data Logging 4 PID Tuning By Hugh Meyer Red Alert Robotics FRC Team 1741 Center Grove High School Greenwood Indiana October 24, 2015.](https://reader035.fdocuments.net/reader035/viewer/2022062222/5697bfc81a28abf838ca83aa/html5/thumbnails/1.jpg)
Data Logging 4 PID Tuning
By Hugh Meyer
Red Alert Robotics FRC Team 1741
Center Grove High School
Greenwood Indiana
October 24, 2015
![Page 2: Data Logging 4 PID Tuning By Hugh Meyer Red Alert Robotics FRC Team 1741 Center Grove High School Greenwood Indiana October 24, 2015.](https://reader035.fdocuments.net/reader035/viewer/2022062222/5697bfc81a28abf838ca83aa/html5/thumbnails/2.jpg)
Compelling Reasons for Data Logging
Capture fast events Thoughtful evaluation process Verify repeatability
![Page 3: Data Logging 4 PID Tuning By Hugh Meyer Red Alert Robotics FRC Team 1741 Center Grove High School Greenwood Indiana October 24, 2015.](https://reader035.fdocuments.net/reader035/viewer/2022062222/5697bfc81a28abf838ca83aa/html5/thumbnails/3.jpg)
Compelling Reasons for Data Logging
Establish normal operating range Detect leading edge of failure before
disaster Verify design target
![Page 4: Data Logging 4 PID Tuning By Hugh Meyer Red Alert Robotics FRC Team 1741 Center Grove High School Greenwood Indiana October 24, 2015.](https://reader035.fdocuments.net/reader035/viewer/2022062222/5697bfc81a28abf838ca83aa/html5/thumbnails/4.jpg)
![Page 5: Data Logging 4 PID Tuning By Hugh Meyer Red Alert Robotics FRC Team 1741 Center Grove High School Greenwood Indiana October 24, 2015.](https://reader035.fdocuments.net/reader035/viewer/2022062222/5697bfc81a28abf838ca83aa/html5/thumbnails/5.jpg)
Different Approaches for Logging Data
Use built in logging feature of the driver station.
Located on the “Charts” tab Click “Launch Viewer” button for more
detail Windows on the left indicate the file and
location of the data files
![Page 6: Data Logging 4 PID Tuning By Hugh Meyer Red Alert Robotics FRC Team 1741 Center Grove High School Greenwood Indiana October 24, 2015.](https://reader035.fdocuments.net/reader035/viewer/2022062222/5697bfc81a28abf838ca83aa/html5/thumbnails/6.jpg)
Driver Station Charts
Charts tab give a continuous display of many useful attributes
If you click on the “Launch Viewer” button it opens the Log File Viewer
![Page 7: Data Logging 4 PID Tuning By Hugh Meyer Red Alert Robotics FRC Team 1741 Center Grove High School Greenwood Indiana October 24, 2015.](https://reader035.fdocuments.net/reader035/viewer/2022062222/5697bfc81a28abf838ca83aa/html5/thumbnails/7.jpg)
Log File Viewer
![Page 8: Data Logging 4 PID Tuning By Hugh Meyer Red Alert Robotics FRC Team 1741 Center Grove High School Greenwood Indiana October 24, 2015.](https://reader035.fdocuments.net/reader035/viewer/2022062222/5697bfc81a28abf838ca83aa/html5/thumbnails/8.jpg)
Different Approaches for Logging Data
The supplied Driver Station Log File Viewer is helpful, but you really need data that is specific to your robot to be helpful
I suggest you create your own logging system
You have several options
![Page 9: Data Logging 4 PID Tuning By Hugh Meyer Red Alert Robotics FRC Team 1741 Center Grove High School Greenwood Indiana October 24, 2015.](https://reader035.fdocuments.net/reader035/viewer/2022062222/5697bfc81a28abf838ca83aa/html5/thumbnails/9.jpg)
Different Approaches for Logging Data
Save the data on the driver station computer
Save the data on the RoboRIO Save the data on an external memory
card Save the data on an external computer
![Page 10: Data Logging 4 PID Tuning By Hugh Meyer Red Alert Robotics FRC Team 1741 Center Grove High School Greenwood Indiana October 24, 2015.](https://reader035.fdocuments.net/reader035/viewer/2022062222/5697bfc81a28abf838ca83aa/html5/thumbnails/10.jpg)
What you need for saving data on the RoboRIO
Code that reads the data
Writes the data to disk
Move data from RoboRIO to processing system
![Page 11: Data Logging 4 PID Tuning By Hugh Meyer Red Alert Robotics FRC Team 1741 Center Grove High School Greenwood Indiana October 24, 2015.](https://reader035.fdocuments.net/reader035/viewer/2022062222/5697bfc81a28abf838ca83aa/html5/thumbnails/11.jpg)
Code to open log file and write data
void Tshirt::WriteToLogFile(){
if (!logfile.is_open()) {logfile.open("logging.csv", ios_base::out);logfile << "SteerSetpoint,SteerActual,SteerOutput\n";
}
logfile << steer_control->GetSetpoint() << ',' << steer_encoder->GetDistance() << ',' << steer_control->Get() << "\n";
}
void Tshirt::DisabledPeriodic(){
if (logfile.is_open()) {logfile << flush; // Make sure any messages still
// in the buffer get written to "disk"logfile.close();
}}
void Tshirt::TeleopPeriodic(){...
WriteToLogFile();}
![Page 12: Data Logging 4 PID Tuning By Hugh Meyer Red Alert Robotics FRC Team 1741 Center Grove High School Greenwood Indiana October 24, 2015.](https://reader035.fdocuments.net/reader035/viewer/2022062222/5697bfc81a28abf838ca83aa/html5/thumbnails/12.jpg)
Moving Data from the RoboRIO
Use FTP to transfer the file back to the driver station after the match is concluded
We create a batch file that does this
This batch file is in the same folder destination where the data is to go
The batch file renames the file to include the date and time in the file name
![Page 13: Data Logging 4 PID Tuning By Hugh Meyer Red Alert Robotics FRC Team 1741 Center Grove High School Greenwood Indiana October 24, 2015.](https://reader035.fdocuments.net/reader035/viewer/2022062222/5697bfc81a28abf838ca83aa/html5/thumbnails/13.jpg)
Data Transfer Batch File
# ftpcmds.txt file
get logging.csvget config.txtbye
# GetLogging.bat file
cd C:\FIRSTrobotics\RA14_LogFileArchive\2014_HomeComingftp -A -s:ftpcmds.txt 10.17.44.2
for /f "tokens=1-3 delims=/- " %%a in ('date /t') do set XDate=%%a-%%b-%%cfor /f "tokens=1-2 delims=: " %%a in ('time /t') do set XTime=%%a.%%brename "config.txt" "config-%XDate%-%XTime%.txt"rename "logging.csv" "logging-%XDate%-%XTime%.csv"
![Page 14: Data Logging 4 PID Tuning By Hugh Meyer Red Alert Robotics FRC Team 1741 Center Grove High School Greenwood Indiana October 24, 2015.](https://reader035.fdocuments.net/reader035/viewer/2022062222/5697bfc81a28abf838ca83aa/html5/thumbnails/14.jpg)
Data Folder Example
![Page 15: Data Logging 4 PID Tuning By Hugh Meyer Red Alert Robotics FRC Team 1741 Center Grove High School Greenwood Indiana October 24, 2015.](https://reader035.fdocuments.net/reader035/viewer/2022062222/5697bfc81a28abf838ca83aa/html5/thumbnails/15.jpg)
Analyzing the Data
Import into a spread sheet program Create specialized evaluation program Moving data from capture device to
evaluation device Archiving data into a subversion
repository
![Page 16: Data Logging 4 PID Tuning By Hugh Meyer Red Alert Robotics FRC Team 1741 Center Grove High School Greenwood Indiana October 24, 2015.](https://reader035.fdocuments.net/reader035/viewer/2022062222/5697bfc81a28abf838ca83aa/html5/thumbnails/16.jpg)
The Data File an Example
SteerSetpoint,SteerActual,SteerOutput0,0,00.0866142,0,00.102362,0,0.04330710.11811,0,0.05118110.125984,0,0.05905510.133858,0,0.06299210.149606,0,0.06692910.165354,0,0.07480320.19685,0,0.08267720.228346,0,0.09842520.251969,0,0.1141730.291339,0.045,0.1047340.314961,0.115,0.08816930.346457,0.1,0.106230.377953,0.0975,0.1402260.401575,0.145,0.1282870.425197,0.2275,0.09884840.448819,0.26,0.08259840.503937,0.26,0.09440950.559055,0.255,0.1244690.598425,0.28,0.1592130.661417,0.44,0.1132090.692913,0.65,0.006958660.748031,0.7225,0.01276570.787402,0.745,0.02120080.818898,0.745,0.03694880.858268,0.745,0.05663390.889764,0.745,0.05663390.944882,0.745,0.0999410.984252,0.745,0.1196260.992126,0.75,0.1210631,0.765,0.11751,0.78,0.11
![Page 17: Data Logging 4 PID Tuning By Hugh Meyer Red Alert Robotics FRC Team 1741 Center Grove High School Greenwood Indiana October 24, 2015.](https://reader035.fdocuments.net/reader035/viewer/2022062222/5697bfc81a28abf838ca83aa/html5/thumbnails/17.jpg)
Open Data in OpenOffice Calc
![Page 18: Data Logging 4 PID Tuning By Hugh Meyer Red Alert Robotics FRC Team 1741 Center Grove High School Greenwood Indiana October 24, 2015.](https://reader035.fdocuments.net/reader035/viewer/2022062222/5697bfc81a28abf838ca83aa/html5/thumbnails/18.jpg)
Text Import to OpenOffice Calc
![Page 19: Data Logging 4 PID Tuning By Hugh Meyer Red Alert Robotics FRC Team 1741 Center Grove High School Greenwood Indiana October 24, 2015.](https://reader035.fdocuments.net/reader035/viewer/2022062222/5697bfc81a28abf838ca83aa/html5/thumbnails/19.jpg)
![Page 20: Data Logging 4 PID Tuning By Hugh Meyer Red Alert Robotics FRC Team 1741 Center Grove High School Greenwood Indiana October 24, 2015.](https://reader035.fdocuments.net/reader035/viewer/2022062222/5697bfc81a28abf838ca83aa/html5/thumbnails/20.jpg)
![Page 21: Data Logging 4 PID Tuning By Hugh Meyer Red Alert Robotics FRC Team 1741 Center Grove High School Greenwood Indiana October 24, 2015.](https://reader035.fdocuments.net/reader035/viewer/2022062222/5697bfc81a28abf838ca83aa/html5/thumbnails/21.jpg)
??? Questions ???
These are the steps to getting the data from the robot to a graph.
Are there any questions about this process before we move on?
![Page 22: Data Logging 4 PID Tuning By Hugh Meyer Red Alert Robotics FRC Team 1741 Center Grove High School Greenwood Indiana October 24, 2015.](https://reader035.fdocuments.net/reader035/viewer/2022062222/5697bfc81a28abf838ca83aa/html5/thumbnails/22.jpg)
PID Tuning Process
Need method to command a step response
Easy ability to change PID gain values
![Page 23: Data Logging 4 PID Tuning By Hugh Meyer Red Alert Robotics FRC Team 1741 Center Grove High School Greenwood Indiana October 24, 2015.](https://reader035.fdocuments.net/reader035/viewer/2022062222/5697bfc81a28abf838ca83aa/html5/thumbnails/23.jpg)
Step Response
One must be able to command an immediate change to a different value
This should be done in a very controlled and precise manner
Essentially the command to the system should be a few cycles of square wave
This can be as simple as a button for the user to press, or as complex as an automation sequence
![Page 24: Data Logging 4 PID Tuning By Hugh Meyer Red Alert Robotics FRC Team 1741 Center Grove High School Greenwood Indiana October 24, 2015.](https://reader035.fdocuments.net/reader035/viewer/2022062222/5697bfc81a28abf838ca83aa/html5/thumbnails/24.jpg)
Step Response
We usually just add a button for testing and have the user command the change
![Page 25: Data Logging 4 PID Tuning By Hugh Meyer Red Alert Robotics FRC Team 1741 Center Grove High School Greenwood Indiana October 24, 2015.](https://reader035.fdocuments.net/reader035/viewer/2022062222/5697bfc81a28abf838ca83aa/html5/thumbnails/25.jpg)
logging-Thu-09-18-09.12.csv
![Page 26: Data Logging 4 PID Tuning By Hugh Meyer Red Alert Robotics FRC Team 1741 Center Grove High School Greenwood Indiana October 24, 2015.](https://reader035.fdocuments.net/reader035/viewer/2022062222/5697bfc81a28abf838ca83aa/html5/thumbnails/26.jpg)
Easy Method to change PID gain values
Setup a configuration file on the RoboRIO
Include in that configuration file the 3 gain values
Develop a simple procedure to apply a changed configuration file to the system
![Page 27: Data Logging 4 PID Tuning By Hugh Meyer Red Alert Robotics FRC Team 1741 Center Grove High School Greenwood Indiana October 24, 2015.](https://reader035.fdocuments.net/reader035/viewer/2022062222/5697bfc81a28abf838ca83aa/html5/thumbnails/27.jpg)
Configuration Code
Config.h
Config.cpp
config.txt
putconfig.bat
ftpcmds.txt
![Page 28: Data Logging 4 PID Tuning By Hugh Meyer Red Alert Robotics FRC Team 1741 Center Grove High School Greenwood Indiana October 24, 2015.](https://reader035.fdocuments.net/reader035/viewer/2022062222/5697bfc81a28abf838ca83aa/html5/thumbnails/28.jpg)
Config File Initialization
void Tshirt::RobotInit()
{
//Start robot
cout << "Starting up..." << endl;
cout<<"Loading Config File..... "<<endl;
Config::LoadFromFile("config.txt");
cout<<"Done!"<<endl;
![Page 29: Data Logging 4 PID Tuning By Hugh Meyer Red Alert Robotics FRC Team 1741 Center Grove High School Greenwood Indiana October 24, 2015.](https://reader035.fdocuments.net/reader035/viewer/2022062222/5697bfc81a28abf838ca83aa/html5/thumbnails/29.jpg)
Using Config function to initialize PID values
cout << "Initializing PID control...";steer_control = new PIDController(
Config::GetSetting("steer_p", 1),Config::GetSetting("steer_i", 0),Config::GetSetting("steer_d", 0),steer_encoder,axle,Config::GetSetting("steer_period", 0.010 ));
steer_control->SetInputRange( - MAX_RANGE_OF_STEER, MAX_RANGE_OF_STEER); // in revolutions, just for testing
steer_control->SetOutputRange(-1, 1);steer_control->SetSetpoint(0);steer_control->Enable();
cout << "PID enabled!" << endl;
![Page 30: Data Logging 4 PID Tuning By Hugh Meyer Red Alert Robotics FRC Team 1741 Center Grove High School Greenwood Indiana October 24, 2015.](https://reader035.fdocuments.net/reader035/viewer/2022062222/5697bfc81a28abf838ca83aa/html5/thumbnails/30.jpg)
Reset code to reload new PID values
void Tshirt::ResetPID(){
Config::LoadFromFile("config.txt");steer_control->SetPID(
Config::GetSetting("steer_p", 1),Config::GetSetting("steer_i", 0),Config::GetSetting("steer_d", 0)
);steer_control->Reset();
cout << "PID:" << endl;cout << "P: " << steer_control->GetP() << endl;cout << "I: " << steer_control->GetI() << endl;cout << "D: " << steer_control->GetD() << endl;
}
![Page 31: Data Logging 4 PID Tuning By Hugh Meyer Red Alert Robotics FRC Team 1741 Center Grove High School Greenwood Indiana October 24, 2015.](https://reader035.fdocuments.net/reader035/viewer/2022062222/5697bfc81a28abf838ca83aa/html5/thumbnails/31.jpg)
Config File Example
# .d8888b. .d88888b. 888b 888 8888888888 8888888 .d8888b. #d88P Y88b d88P" "Y88b 8888b 888 888 888 d88P Y88b #888 888 888 888 88888b 888 888 888 888 888 #888 888 888 888Y88b 888 8888888 888 888 #888 888 888 888 Y88b888 888 888 888 88888 #888 888 888 888 888 Y88888 888 888 888 888 #Y88b d88P Y88b. .d88P 888 Y8888 888 888 Y88b d88P # "Y8888P" "Y88888P" 888 Y888 888 8888888 "Y8888P88
#8888888888 8888888 888 8888888888 #888 888 888 888 #888 888 888 888 #8888888 888 888 8888888 #888 888 888 888 #888 888 888 888 #888 888 888 888 #888 8888888 88888888 8888888888
# This is the config file
steer_p = 0.220steer_i = 0.005steer_d = 0.300
steer_period = 0.010
![Page 32: Data Logging 4 PID Tuning By Hugh Meyer Red Alert Robotics FRC Team 1741 Center Grove High School Greenwood Indiana October 24, 2015.](https://reader035.fdocuments.net/reader035/viewer/2022062222/5697bfc81a28abf838ca83aa/html5/thumbnails/32.jpg)
FTP Transfer System
# putconfig.bat
cd C:/WindRiver/workspace/Tshirtftp -A -s:ftpcmds.txt 10.17.44.2pause
# ftpcmds.txt
asciisend config.txtbye
![Page 33: Data Logging 4 PID Tuning By Hugh Meyer Red Alert Robotics FRC Team 1741 Center Grove High School Greenwood Indiana October 24, 2015.](https://reader035.fdocuments.net/reader035/viewer/2022062222/5697bfc81a28abf838ca83aa/html5/thumbnails/33.jpg)
Questions
We now have in place all we need to be able to easily change the PID gain variables
Are there any questions at this point?
![Page 34: Data Logging 4 PID Tuning By Hugh Meyer Red Alert Robotics FRC Team 1741 Center Grove High School Greenwood Indiana October 24, 2015.](https://reader035.fdocuments.net/reader035/viewer/2022062222/5697bfc81a28abf838ca83aa/html5/thumbnails/34.jpg)
PID Tuning Strategies
Iteration by experience
Ziegler-Nichols and other tuning strategies
Several are mentioned on Chief Delphi http://www.chiefdelphi.com/forums/portal.php
PID without a PhD by Tim Wescott
![Page 35: Data Logging 4 PID Tuning By Hugh Meyer Red Alert Robotics FRC Team 1741 Center Grove High School Greenwood Indiana October 24, 2015.](https://reader035.fdocuments.net/reader035/viewer/2022062222/5697bfc81a28abf838ca83aa/html5/thumbnails/35.jpg)
Iteration by Experience
After doing this for a while you will get to recognize different patterns and what will correct them
P will make slower oscillations
D will make fast high frequency oscillations
I helps reach the target
Not very scientific
Can take really long time to find a solution
![Page 36: Data Logging 4 PID Tuning By Hugh Meyer Red Alert Robotics FRC Team 1741 Center Grove High School Greenwood Indiana October 24, 2015.](https://reader035.fdocuments.net/reader035/viewer/2022062222/5697bfc81a28abf838ca83aa/html5/thumbnails/36.jpg)
Start with P Tuning ProcessFor small, low torque motors with little or no gearing, one procedure you can use to
get a good baseline tune is to probe it’s response to a disturbance.
To tune a PID use the following steps:
1. Set all gains to zero.
2. Increase the P gain until the response to a disturbance is a steady oscillation.
3. Increase the D gain until the oscillations go away (i.e. it’s critically damped).
4. Repeat steps 2 and 3 until increasing the D gain does not stop the oscillations.
5. Set P and D to the last stable values.
6. Increase the I gain until it brings you to the set point with the number of oscillations desired (normally zero but a quicker response can be had if you don’t mind a couple oscillations of overshoot)
What disturbance you use depends on the mechanism the control is attached to. Normally moving the mechanism by hand away from the set point and letting go is enough. If the oscillations grow bigger and bigger then you need to reduce the P gain.
If you set the D gain too high the system will begin to chatter (vibrate at a higher frequency than the P gain oscillations). If this happens, reduce the D gain until it stops.
![Page 37: Data Logging 4 PID Tuning By Hugh Meyer Red Alert Robotics FRC Team 1741 Center Grove High School Greenwood Indiana October 24, 2015.](https://reader035.fdocuments.net/reader035/viewer/2022062222/5697bfc81a28abf838ca83aa/html5/thumbnails/37.jpg)
Start with D Tuning Process
To tune a PID use the following steps:
1. Set all gains to 0.
2. Increase Kd until the system oscillates.
3. Reduce Kd by a factor of 2-4.
4. Set Kp to about 1% of Kd.
5. Increase Kp until oscillations start.
6. Decrease Kp by a factor of 2-4.
7. Set Ki to about 1% of Kp.
8. Increase Ki until oscillations start.
9. Decrease Ki by a factor of 2-4.
![Page 38: Data Logging 4 PID Tuning By Hugh Meyer Red Alert Robotics FRC Team 1741 Center Grove High School Greenwood Indiana October 24, 2015.](https://reader035.fdocuments.net/reader035/viewer/2022062222/5697bfc81a28abf838ca83aa/html5/thumbnails/38.jpg)
Ziegler-Nichols & Other Tuning Strategies
Set one of the variables to where the system just oscillates
Measure the time period of the oscillation
Calculate the PID values from some formula or look up table based on these measurements
![Page 39: Data Logging 4 PID Tuning By Hugh Meyer Red Alert Robotics FRC Team 1741 Center Grove High School Greenwood Indiana October 24, 2015.](https://reader035.fdocuments.net/reader035/viewer/2022062222/5697bfc81a28abf838ca83aa/html5/thumbnails/39.jpg)
Ziegler-Nichols
The Ziegler–Nichols tuning method is a heuristic method of tuning a PID controller. It was developed by John G. Ziegler and Nathaniel B. Nichols.
It is performed by setting the I (integral) and D (derivative) gains to zero. The "P" (proportional) gain, KP is then increased (from zero) until it reaches the ultimate gain KU , at which the output of the control loop oscillates with a constant amplitude.
KU and the oscillation period TU are used to set the P, I, and D gains depending on the type of controller used.
Use the table to determine the final gains.
![Page 40: Data Logging 4 PID Tuning By Hugh Meyer Red Alert Robotics FRC Team 1741 Center Grove High School Greenwood Indiana October 24, 2015.](https://reader035.fdocuments.net/reader035/viewer/2022062222/5697bfc81a28abf838ca83aa/html5/thumbnails/40.jpg)
Ziegler-Nichols
![Page 41: Data Logging 4 PID Tuning By Hugh Meyer Red Alert Robotics FRC Team 1741 Center Grove High School Greenwood Indiana October 24, 2015.](https://reader035.fdocuments.net/reader035/viewer/2022062222/5697bfc81a28abf838ca83aa/html5/thumbnails/41.jpg)
Ziegler-Nichols & Others – Links
1. Ziegler-Nichols Method http://en.wikipedia.org/wiki/Ziegler%E2%80%93Nichols_method
2. Tyreus-Luyben Tuning http://www.chem.mtu.edu/~tbco/cm416/zn.html
3. Comparison of PID Controller Tuning Methods by Mohammad Shahrokhi and Alireza Zomorrodi
![Page 42: Data Logging 4 PID Tuning By Hugh Meyer Red Alert Robotics FRC Team 1741 Center Grove High School Greenwood Indiana October 24, 2015.](https://reader035.fdocuments.net/reader035/viewer/2022062222/5697bfc81a28abf838ca83aa/html5/thumbnails/42.jpg)
Questions?
Are there any questions regarding tuning methods?
![Page 43: Data Logging 4 PID Tuning By Hugh Meyer Red Alert Robotics FRC Team 1741 Center Grove High School Greenwood Indiana October 24, 2015.](https://reader035.fdocuments.net/reader035/viewer/2022062222/5697bfc81a28abf838ca83aa/html5/thumbnails/43.jpg)
Steering System Example
Position control for an Ackermann steering mechanism
http://en.wikipedia.org/wiki/Ackermann_steering_geometry
Servo style motor control Joystick position translates to steer
angle
![Page 44: Data Logging 4 PID Tuning By Hugh Meyer Red Alert Robotics FRC Team 1741 Center Grove High School Greenwood Indiana October 24, 2015.](https://reader035.fdocuments.net/reader035/viewer/2022062222/5697bfc81a28abf838ca83aa/html5/thumbnails/44.jpg)
Ackermann Steering Example
![Page 45: Data Logging 4 PID Tuning By Hugh Meyer Red Alert Robotics FRC Team 1741 Center Grove High School Greenwood Indiana October 24, 2015.](https://reader035.fdocuments.net/reader035/viewer/2022062222/5697bfc81a28abf838ca83aa/html5/thumbnails/45.jpg)
Ackermann Steering Example
![Page 46: Data Logging 4 PID Tuning By Hugh Meyer Red Alert Robotics FRC Team 1741 Center Grove High School Greenwood Indiana October 24, 2015.](https://reader035.fdocuments.net/reader035/viewer/2022062222/5697bfc81a28abf838ca83aa/html5/thumbnails/46.jpg)
First Pass at Tuning
113
2537
4961
7385
97109
121133
145157
169181
193205
217229
241253
265277
289301
313325
337349
361373
385397
409421
433
-8
-6
-4
-2
0
2
4
6
8
SteerSetpoint
SteerActual
SteerOutput
P = .125I = .001D = .00125
![Page 47: Data Logging 4 PID Tuning By Hugh Meyer Red Alert Robotics FRC Team 1741 Center Grove High School Greenwood Indiana October 24, 2015.](https://reader035.fdocuments.net/reader035/viewer/2022062222/5697bfc81a28abf838ca83aa/html5/thumbnails/47.jpg)
Second Pass at Tuning
222
4262
82102
122142
162182
202222
242262
282302
322342
362382
402422
442462
482502
522542
562582
602622
642662
682702
722
-8
-6
-4
-2
0
2
4
6
8
SteerSetpoint
SteerActual
SteerOutput
P = .220I = .005D = .320
![Page 48: Data Logging 4 PID Tuning By Hugh Meyer Red Alert Robotics FRC Team 1741 Center Grove High School Greenwood Indiana October 24, 2015.](https://reader035.fdocuments.net/reader035/viewer/2022062222/5697bfc81a28abf838ca83aa/html5/thumbnails/48.jpg)
Third Pass at Tuning
224
4668
90112
134156
178200
222244
266288
310332
354376
398420
442464
486508
530552
574596
618640
662684
706728
750
-8
-6
-4
-2
0
2
4
6
8
SteerSetpoint
SteerActual
SteerOutput
P = .220I = .005D = .300
![Page 49: Data Logging 4 PID Tuning By Hugh Meyer Red Alert Robotics FRC Team 1741 Center Grove High School Greenwood Indiana October 24, 2015.](https://reader035.fdocuments.net/reader035/viewer/2022062222/5697bfc81a28abf838ca83aa/html5/thumbnails/49.jpg)
Launching Mechanism Example
Position control for a Leonardo Da Vinci cam mechanism
Reflective index sensor for homing each cycle
Schmitt trigger (7414) for optical sensor http://www.digikey.com/product-detail/en/SN7414N/296-33604-5-ND/1575159
http://www.ti.com/lit/ds/symlink/sn7414.pdf
![Page 50: Data Logging 4 PID Tuning By Hugh Meyer Red Alert Robotics FRC Team 1741 Center Grove High School Greenwood Indiana October 24, 2015.](https://reader035.fdocuments.net/reader035/viewer/2022062222/5697bfc81a28abf838ca83aa/html5/thumbnails/50.jpg)
De Vinci CamRed Alert Cam
![Page 51: Data Logging 4 PID Tuning By Hugh Meyer Red Alert Robotics FRC Team 1741 Center Grove High School Greenwood Indiana October 24, 2015.](https://reader035.fdocuments.net/reader035/viewer/2022062222/5697bfc81a28abf838ca83aa/html5/thumbnails/51.jpg)
De Vinci Cam
![Page 52: Data Logging 4 PID Tuning By Hugh Meyer Red Alert Robotics FRC Team 1741 Center Grove High School Greenwood Indiana October 24, 2015.](https://reader035.fdocuments.net/reader035/viewer/2022062222/5697bfc81a28abf838ca83aa/html5/thumbnails/52.jpg)
First Pass at Tuning
-2000
-1500
-1000
-500
0
500
1000
1500
2000
2500
0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8
ShooterMotorLeftPositionSetpointShooterMotorPositionActualShooterMotorLeftDemand
# CAM PIDcam_p = .06cam_i = .003cam_d = .003
logging-Wed-02-26-07.37.csv
![Page 53: Data Logging 4 PID Tuning By Hugh Meyer Red Alert Robotics FRC Team 1741 Center Grove High School Greenwood Indiana October 24, 2015.](https://reader035.fdocuments.net/reader035/viewer/2022062222/5697bfc81a28abf838ca83aa/html5/thumbnails/53.jpg)
Next Pass at Tuning
-20
0
20
40
60
80
100
0 1 2 3 4 5 6 7
ShooterMotorLeftPos itionSetpoint
ShooterMotorPos itionActual
ShooterMotorLeftDemand
logging-Mon-02-24-08.13.csv
# CAM PIDcam_p = .75cam_i = 0cam_d = 0
![Page 54: Data Logging 4 PID Tuning By Hugh Meyer Red Alert Robotics FRC Team 1741 Center Grove High School Greenwood Indiana October 24, 2015.](https://reader035.fdocuments.net/reader035/viewer/2022062222/5697bfc81a28abf838ca83aa/html5/thumbnails/54.jpg)
Better But Still Oscillatinglogging-Mon-02-24-08.19.csv
-10
0
10
20
30
40
50
60
70
80
90
0 1 2 3 4 5 6 7 8
ShooterM otorLeftPos itionSetpoint
ShooterM otorPos itionActual
ShooterM otorLeftDem and
# CAM PIDcam_p = .1cam_i = 0cam_d = 0
![Page 55: Data Logging 4 PID Tuning By Hugh Meyer Red Alert Robotics FRC Team 1741 Center Grove High School Greenwood Indiana October 24, 2015.](https://reader035.fdocuments.net/reader035/viewer/2022062222/5697bfc81a28abf838ca83aa/html5/thumbnails/55.jpg)
Another Pass Tuning
-10
0
10
20
30
40
50
60
70
80
90
0 10 20 30 40 50
ShooterMotorLeftPos itionSetpoint
ShooterMotorPos itionActual
ShooterMotorLeftDemand
logging-Mon-02-24-08.22.csv
# CAM PIDcam_p = .01cam_i = 0cam_d = 0
![Page 56: Data Logging 4 PID Tuning By Hugh Meyer Red Alert Robotics FRC Team 1741 Center Grove High School Greenwood Indiana October 24, 2015.](https://reader035.fdocuments.net/reader035/viewer/2022062222/5697bfc81a28abf838ca83aa/html5/thumbnails/56.jpg)
Nearing Final Solutionlogging-Mon-02-10-10.44.csv
-20
0
20
40
60
80
100
120
1 224 447 670 893 1116 1339 1562 1785 2008 2231 2454 2677 2900 3123 3346
ShooterMotorLeftPos itionSetpointShooterMotorPos itionActualShooterMotorLeftDemand
# CAM PIDcam_p = 0.017cam_i = 0.0005cam_d = 0.00
![Page 57: Data Logging 4 PID Tuning By Hugh Meyer Red Alert Robotics FRC Team 1741 Center Grove High School Greenwood Indiana October 24, 2015.](https://reader035.fdocuments.net/reader035/viewer/2022062222/5697bfc81a28abf838ca83aa/html5/thumbnails/57.jpg)
Wind Up Detail
![Page 58: Data Logging 4 PID Tuning By Hugh Meyer Red Alert Robotics FRC Team 1741 Center Grove High School Greenwood Indiana October 24, 2015.](https://reader035.fdocuments.net/reader035/viewer/2022062222/5697bfc81a28abf838ca83aa/html5/thumbnails/58.jpg)
Launch Detail
![Page 59: Data Logging 4 PID Tuning By Hugh Meyer Red Alert Robotics FRC Team 1741 Center Grove High School Greenwood Indiana October 24, 2015.](https://reader035.fdocuments.net/reader035/viewer/2022062222/5697bfc81a28abf838ca83aa/html5/thumbnails/59.jpg)
Sequence of Several Launches
![Page 60: Data Logging 4 PID Tuning By Hugh Meyer Red Alert Robotics FRC Team 1741 Center Grove High School Greenwood Indiana October 24, 2015.](https://reader035.fdocuments.net/reader035/viewer/2022062222/5697bfc81a28abf838ca83aa/html5/thumbnails/60.jpg)
Speed Control for Frisbee Launcher Example
Velocity control for drive wheels
![Page 61: Data Logging 4 PID Tuning By Hugh Meyer Red Alert Robotics FRC Team 1741 Center Grove High School Greenwood Indiana October 24, 2015.](https://reader035.fdocuments.net/reader035/viewer/2022062222/5697bfc81a28abf838ca83aa/html5/thumbnails/61.jpg)
Frisbee Launcher
![Page 62: Data Logging 4 PID Tuning By Hugh Meyer Red Alert Robotics FRC Team 1741 Center Grove High School Greenwood Indiana October 24, 2015.](https://reader035.fdocuments.net/reader035/viewer/2022062222/5697bfc81a28abf838ca83aa/html5/thumbnails/62.jpg)
Shooter Testing - March 11, 2012
0
200
400
600
800
1000
1200
1400
1600
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
Time - 50 Millisecond Steps
RP
M
-20
-10
0
10
20
30
40
50
60
70
80
Cu
rren
t &
Vo
ltag
e
BottomShooter RPM Target Bottom Shooter RPM Actual BottomShooter Voltage BottomShooter Current
![Page 63: Data Logging 4 PID Tuning By Hugh Meyer Red Alert Robotics FRC Team 1741 Center Grove High School Greenwood Indiana October 24, 2015.](https://reader035.fdocuments.net/reader035/viewer/2022062222/5697bfc81a28abf838ca83aa/html5/thumbnails/63.jpg)
Drive Base Example
Mecanum Drive
![Page 64: Data Logging 4 PID Tuning By Hugh Meyer Red Alert Robotics FRC Team 1741 Center Grove High School Greenwood Indiana October 24, 2015.](https://reader035.fdocuments.net/reader035/viewer/2022062222/5697bfc81a28abf838ca83aa/html5/thumbnails/64.jpg)
Drive Wheel PID Tuning
-6000
-4000
-2000
0
2000
4000
6000
1 78 155 232 309 386 463 540 617 694 771 848 925 1002 1079
Front Left Target
Front Left Actual
Front Left Voltage
M:\FirstRobotics\RA12_LogFileArchive\20120307_PIDTuning\Logging-Wed-03-07-07.52.csv
![Page 65: Data Logging 4 PID Tuning By Hugh Meyer Red Alert Robotics FRC Team 1741 Center Grove High School Greenwood Indiana October 24, 2015.](https://reader035.fdocuments.net/reader035/viewer/2022062222/5697bfc81a28abf838ca83aa/html5/thumbnails/65.jpg)
Drive Wheel PID Tuning
-6000
-4000
-2000
0
2000
4000
6000
1 83 165 247 329 411 493 575 657 739 821 903 985 1067 1149 1231 1313
Front Left Target
Front Left Actual
Front Left Voltage
M:\FirstRobotics\RA12_LogFileArchive\20120307_PIDTuning\Logging-Wed-03-07-08.43.csv
![Page 66: Data Logging 4 PID Tuning By Hugh Meyer Red Alert Robotics FRC Team 1741 Center Grove High School Greenwood Indiana October 24, 2015.](https://reader035.fdocuments.net/reader035/viewer/2022062222/5697bfc81a28abf838ca83aa/html5/thumbnails/66.jpg)
Conclusion
Log as much data as you can Build your code as modular as possible
so you can reuse it Implement a config file for your robot Save your config file with the log data
file
![Page 67: Data Logging 4 PID Tuning By Hugh Meyer Red Alert Robotics FRC Team 1741 Center Grove High School Greenwood Indiana October 24, 2015.](https://reader035.fdocuments.net/reader035/viewer/2022062222/5697bfc81a28abf838ca83aa/html5/thumbnails/67.jpg)
Questions
Any questions?
![Page 68: Data Logging 4 PID Tuning By Hugh Meyer Red Alert Robotics FRC Team 1741 Center Grove High School Greenwood Indiana October 24, 2015.](https://reader035.fdocuments.net/reader035/viewer/2022062222/5697bfc81a28abf838ca83aa/html5/thumbnails/68.jpg)
Contact Information
Find this presentation at http://hughmeyer.com/workshops
Hugh Meyer Phone: 317 786-9214 Email: [email protected]