I think that's what they think you will think, therefore you are thinking what they want you to think. - Wetzel [more]
 Chief Delphi First Time PID user
 CD-Media CD-Spy
 portal register members calendar search Today's Posts Mark Forums Read FAQ rules

#1
02-13-2018, 11:12 PM
 klhutchi Registered User FRC #5736 Join Date: Feb 2016 Location: New York Posts: 9
First Time PID user

Our team is using a rotating arm to grab cubes off the floor and lift them for switch height. In order to hold position we are trying out a PID controller, We have a 30in arm ~10lbs(+4 with cube) that rotates from 0-120 degrees.

A Mini Cim geared down to 140:1 and chain driven sprockets at 12:28 to slow it down to manageable levels attached to a Analog Pot.

I've read a few forums about tuning a PID loop and was hoping for some experienced advice for this application. We added torsion springs to try and assist the arm, but the speed difference between rising and falling are not quite what we want. Currently the motors run a 75% with P at 2.25, I at .008, and D at 0. It holds position but doesn't find it very nicely (Sudden stops not much oscillation).

I was thinking of trying the AutoTuning function in Labview but not to sure of its effectiveness. Any ideas?

Additionally the Motor controller is set to brake, does that work with or against the PID control?
#2
02-14-2018, 12:00 AM
 Classified* Drive it like you stole it AKA: Julia Cecchetti FRC #0291 (CIA: Creativity in Action) Team Role: Leadership Join Date: Nov 2015 Rookie Year: 2015 Location: Erie PA Posts: 222
Re: First Time PID user

We have an arm this year as well. It all comes down to telling your PID controller everything you can about the dynamics of your system. The simple answer is to do the math. Calculate the torque due to gravity at a given angle of the arm (this will be the weight of your arm times the distance from the pivot to the center of mass of your arm). Remember gravity always points down, so you need to factor in the angle of your arm and only take the component that points down. So this means if you define theta (the angle) with zero degrees being your arm straight up and down and 90 degrees being parallel to the floor, the torque due to gravity on your arm is:

Torque = ArmWeight*sin(theta)*DistanceOfCoM

So in your case this is (14 lbs)*sin(theta)*(20 in). I made a guess on where your center of mass would be, as it most likely isn't all the way out on the end of the arm.

Then you calculate the power you need to send to the motors to hold the arm stationary using your gear ratio and the type of motor you have. Then simply add this to your PID output! What this does is it removes the difference in the apparent weight of the system to your PID loop. So in your code, you would calculate the PID output, add the "hold Position" power you calculated, and send that to the motors.

This is exactly what we did and you can see the results in this video! Our math was a bit more complicated because we had a gas spring to help the arm up (think 4 nested trig functions) , but it works super well!

Break mode won't really affect anything, It only applies when you send zero power to the motors.

If you have further questions, just ask! I hope that helps!
__________________

2017 NEOFRA MVRC Winner with 2399 and 2252
2017 Steel City Showdown Winner with 2614 and 3260
2017 WOW Championship Finalist with 4145, 3138, and 3511
2016 Rachacha Ruckus Finalist with 5406 and 639
2015 Rachacha Ruckus Finalist with 1126 and 5406
2015 NEOFRA MVRC Finalist with 48 and 379
2015 Buckeye Regional Finalist with 48 and 5413
Team291.com
#3
02-14-2018, 10:20 AM
 klhutchi Registered User FRC #5736 Join Date: Feb 2016 Location: New York Posts: 9
Re: First Time PID user

Thank you I figured it was some scaling factor didn't quite see how to apply it. I'll try it out today

 Thread Tools Display Modes Rate This Thread Linear Mode Rate This Thread: 5 : Excellent 4 : Good 3 : Average 2 : Bad 1 : Terrible

 Posting Rules You may not post new threads You may not post replies You may not post attachments You may not edit your posts vB code is On Smilies are On [IMG] code is On HTML code is Off
 Forum Jump User Control Panel Private Messages Subscriptions Who's Online Search Forums Forums Home Announcements     User Announcements FIRST     General Forum         FIRST E-Mail Blast Archive     Rumor Mill     Career     Robot Showcase Technical     Technical Discussion     Robotics Education and Curriculum     Motors     Electrical         CAN     Programming         NI LabVIEW         C/C++         Java         Python     Control System         FRC Control System         Sensors     Pneumatics     Kit & Additional Hardware     CAD         Inventor         SolidWorks         Creo     IT / Communications         3D Animation and Competition         Website Design/Showcase         Videography and Photography         Computer Graphics     National Instruments LabVIEW and Data Acquisition         LabView and Data Acquisition Competition     Unsung FIRST Heroes     Awards         Chairman's Award     Rules/Strategy         Scouting         You Make The Call     Team Organization         Fundraising         Starting New Teams         Finding A Team         College Teams     Championship Event     Regional Competitions     District Events     Off-Season Events     Thanks and/or Congrats     FRC Game Design     OCCRA         OCCRA Q&A         OCCRA Programming Other     Chit-Chat         Games/Trivia             Fantasy FIRST     Car Nack's Corner     College & University Education     Dean Kamen's Inventions     FIRST-related Organizations         Western Region Robotics Forum         Southern California Regional Robotics Forum         The Blue Alliance             Video Archives     FIRST In the News...     FIRST Lego League         Lego Mindstorm Discussion     FIRST Tech Challenge     VEX         VEX Robotics Competition         VEX IQ     Televised Robotics     Math and Science         NASA Discussion ChiefDelphi.com Website     CD Forum Support     Extra Discussion

All times are GMT -5. The time now is 04:55 AM.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.

 -- English (12 hour) -- English (24 hour) Contact Us - Chief Delphi - Rules - Archive - Top