Go to Post Upon entering FIRST you immediately apply Murphy's Laws. - A_Reed [more]
Home
Go Back   Chief Delphi > Technical > Programming > Python
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Reply
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 16-12-2016, 20:31
StrMNX StrMNX is offline
Registered User
no team
 
Join Date: Oct 2016
Location: Youngstown Ohio
Posts: 2
StrMNX is an unknown quantity at this point
PID Questions

Hello, So i'm trying to understand PID in the off-season before 2017. For the most part things have been normal and fully working but i do have some questions on certain things. Any assistance would be greatly appreciated

1. How would you handle an output to multiple motors? i know for 2 motors most teams would use a "y" cable, but what would you do if you had to control 3 motors (such as a 6 cim drive-train)? is there any example code on how to do so?

2. I've studied up on the methods of tuning (Ziegler-Nichols) and i'm aware of how to properly tune the loop, but what are your starting value for the constants? like people say "increase P Gain until it oscillates", but what is a good starting point for the P Gain, I Gain, and D Gain?

Thank you for your time
Reply With Quote
  #2   Spotlight this post!  
Unread 16-12-2016, 23:12
phurley67 phurley67 is offline
Programming Mentor
FRC #0862 (Lightning Robotics)
Team Role: Mentor
 
Join Date: Apr 2014
Rookie Year: 2013
Location: Michigan
Posts: 63
phurley67 is an unknown quantity at this point
Re: PID Questions

Quote:
Originally Posted by StrMNX View Post
1. How would you handle an output to multiple motors?
For CAN Talons you can put one or more into "follow mode". That said, we never bothered with a y-cable in two motor configuration either. We would just set both motors in code to the same value, it was never a problem.

Quote:
Originally Posted by StrMNX View Post
2. I've studied up on the methods of tuning (Ziegler-Nichols) and i'm aware of how to properly tune the loop, but what are your starting value for the constants? like people say "increase P Gain until it oscillates", but what is a good starting point for the P Gain, I Gain, and D Gain?
Thank you for your time
Set I and D to zero. For your initial P you can just guess or do a little math. Based on the 2/3 motor question I am assuming this is a drive train, and I am going to assume you going for a distance PID. Using your max error (which is going to be the longest distance you will be going), a reasonable swag would be 0.7 / that distance, but if 0.7 of your max accel is too strong, set it lower. Feel free to go up and down in pretty large increments. I always test first on blocks and generally with a max power limit set to ~.3 just as a sanity check (are the wheels going the right direction, the same direction, etc).
Reply With Quote
  #3   Spotlight this post!  
Unread 18-12-2016, 13:08
DonRotolo's Avatar
DonRotolo DonRotolo is offline
Back to humble
FRC #0832
Team Role: Mentor
 
Join Date: Jan 2005
Rookie Year: 2005
Location: Atlanta GA
Posts: 6,976
DonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond repute
Re: PID Questions

1. Just as you can define a single motor, you can define several motors. You do this for left and right already, right? So define many motors for a side, and when you send the value to one motor, repeat that same line of code to send it to motor 2, motor 3, and so on. That sends the same drive value to multiple motors.

Note that there may be more efficient ways, depending on the programming language, but brute force will get it done.

2. Asphurley67 stated, do a little math for P by following your code on paper, and see what multiplier will give you something reasonably in range.

When trying something new, it never hurts to step through each line of code by hand, on paper, to see what will happen. Lots of bugs are found this way...
__________________

I am N2IRZ - What's your callsign?
Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

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


All times are GMT -5. The time now is 21:41.

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


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi