Go to Post However, the best responses come with patience. It might be a couple of days before you get a good answer or it could be 10 minutes. - Molten [more]
Home
Go Back   Chief Delphi > Technical > Programming > Java
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 03-02-2012, 22:04
techkid86's Avatar
techkid86 techkid86 is offline
Magic Programer
FRC #3044 (0xBE4)
Team Role: Alumni
 
Join Date: Jan 2011
Rookie Year: 2010
Location: ballston spa
Posts: 58
techkid86 is an unknown quantity at this point
Question PID drive paramiters?

hey there. we're having some issues with out PID speed controller. we are working on setting the appropriate P value, and things are just not working. does anyone have any ball park estimates for the values?
__________________
"you can build a perfect machine out of imperfect parts" -Urza
Reply With Quote
  #2   Spotlight this post!  
Unread 03-02-2012, 22:14
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 8,102
Ether has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond repute
Re: PID drive paramiters?

Quote:
Originally Posted by techkid86 View Post
things are just not working
Not working how?


Quote:
does anyone have any ball park estimates for the values?
depends on the dynamics of what you are trying to control. you'll need to provide a lot more detail to get a useful answer. The effort you put into framing the question will be proportional to the quality of the responses to your post.

Reply With Quote
  #3   Spotlight this post!  
Unread 03-02-2012, 22:27
techkid86's Avatar
techkid86 techkid86 is offline
Magic Programer
FRC #3044 (0xBE4)
Team Role: Alumni
 
Join Date: Jan 2011
Rookie Year: 2010
Location: ballston spa
Posts: 58
techkid86 is an unknown quantity at this point
Re: PID drive paramiters?

we are trying to control a drive motor using an encoder and a jaguar. it is not working in that, we have the motor set point on and off every so many seconds. we range the P up and up and up, looking for any change. it does not change until the P value is at 10*10^4, then it stops the motor, and it will not turn on again until we are at a P value of 1. we are using a single cim motor, up on blocks.

thanks in advance, don't hesitate if you need more info. ^_^
__________________
"you can build a perfect machine out of imperfect parts" -Urza

Last edited by techkid86 : 03-02-2012 at 22:31.
Reply With Quote
  #4   Spotlight this post!  
Unread 03-02-2012, 22:34
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 8,102
Ether has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond repute
Re: PID drive paramiters?

Quote:
Originally Posted by techkid86 View Post
we are trying to control a drive motor using an encoder and a jaguar. it is not working in that, we have the motor set point on and off every so many seconds. we range the up and up and up, looking for any change. it does not change until the P value is at 10*10^4, then it stops the motor, and it will not turn on again until we are at a P value of 1. we are using a single cim motor, up on blocks.

thanks in advance, don't hesitate if you need more info. ^_^
does the motor operate properly open loop?

what's the motor connected to?

is the encoder signal going to the Jag or the DS?

what PID are you using?

what value of setpoint are you using?

how did you scale the value of the encoder?

what does this mean: "we range the up and up and up"?

you get the idea.


Last edited by Ether : 03-02-2012 at 22:36.
Reply With Quote
  #5   Spotlight this post!  
Unread 03-02-2012, 22:44
techkid86's Avatar
techkid86 techkid86 is offline
Magic Programer
FRC #3044 (0xBE4)
Team Role: Alumni
 
Join Date: Jan 2011
Rookie Year: 2010
Location: ballston spa
Posts: 58
techkid86 is an unknown quantity at this point
Re: PID drive paramiters?

does the motor operate properly open loop?
yes it does


what's the motor connected to?
black Jag PWM


is the encoder signal going to the Jag or the DS?
Digital Sidecar


what PID are you using?
PIDController


what value of setpoint are you using?
every few seconds, it alternates between 0, and 0.3


how did you scale the value of the encoder?
what ever the default is. that there could be the problem, but i am unsure. i could post the code if you want.


what does this mean: "we range the up and up and up"?
sorry, i fixed that later. we ranged the P value up and up. nothing seemed to change. we are further trouble shooting my getting the exact Jag value.

tell me if you need anything else ^_^ thanks again.
__________________
"you can build a perfect machine out of imperfect parts" -Urza
Reply With Quote
  #6   Spotlight this post!  
Unread 03-02-2012, 23:53
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 8,102
Ether has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond repute
Re: PID drive paramiters?

Quote:
Originally Posted by techkid86 View Post
what's the motor connected to?
black Jag PWM
what's the business end of the motor connected to?


Quote:
is the encoder signal going to the Jag or the DS?
Digital Sidecar
are you getting a proper signal from the encoder? e.g. if you run the motor open loop and just read the encoder value, does it change linearly with the open-loop voltage supplied to the motor?

Quote:
what PID are you using?
PIDController
I assume you mean from from WPIlib?


Quote:
what value of setpoint are you using?
every few seconds, it alternates between 0, and 0.3
0 and .3 what? fraction of 100% command?


Quote:
how did you scale the value of the encoder?
what ever the default is. that there could be the problem, but i am unsure.
you need to scale the encoder signal so that it corresponds to the setpoint. otherwise the PID cannot form a proper error signal.

Reply With Quote
  #7   Spotlight this post!  
Unread 04-02-2012, 08:08
techkid86's Avatar
techkid86 techkid86 is offline
Magic Programer
FRC #3044 (0xBE4)
Team Role: Alumni
 
Join Date: Jan 2011
Rookie Year: 2010
Location: ballston spa
Posts: 58
techkid86 is an unknown quantity at this point
Re: PID drive paramiters?

what's the business end of the motor connected to?
the motor is connected to a gear box, where it interacts with the wheel. the encoder and wheel are in a 1:1 ratio, but the motor spindle to encoder is not. i'll find out what it is if you need it.


are you getting a proper signal from the encoder? e.g. if you run the motor open loop and just read the encoder value, does it change linearly with the open-loop voltage supplied to the motor?

we thoroughly tested the encoder before hand, and all funtions seemed to work fine.



I assume you mean from from WPIlib?
yes


0 and .3 what? fraction of 100% command?
yes. as the jags take an input value of -1-1, i assumed that that was the what the setpoint was supposed to be in.


you need to scale the encoder signal so that it corresponds to the setpoint. otherwise the PID cannot form a proper error signal.

ok, how would i find out what that is? I assume that that is the SetDistancePerPulse function?

anything else?
__________________
"you can build a perfect machine out of imperfect parts" -Urza
Reply With Quote
  #8   Spotlight this post!  
Unread 04-02-2012, 10:30
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 8,102
Ether has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond repute
Re: PID drive paramiters?

Quote:
Originally Posted by techkid86 View Post
Quote:
you need to scale the encoder signal so that it corresponds to the setpoint. otherwise the PID cannot form a proper error signal.
ok, how would i find out what that is? I assume that that is the SetDistancePerPulse function?
Yes.

SetDistancePerPulse() so that a call to GetRate() returns +1 when the speed is what you expect to get when setpoint is +1.

As for tuning a speed PID, read this thread:
http://www.chiefdelphi.com/forums/sh...90#post1115090


Last edited by Ether : 04-02-2012 at 10:35.
Reply With Quote
  #9   Spotlight this post!  
Unread 04-02-2012, 10:34
techkid86's Avatar
techkid86 techkid86 is offline
Magic Programer
FRC #3044 (0xBE4)
Team Role: Alumni
 
Join Date: Jan 2011
Rookie Year: 2010
Location: ballston spa
Posts: 58
techkid86 is an unknown quantity at this point
Re: PID drive paramiters?

do you know what that might be? ive spent the morning trying to figure out what that number is. the GetRate() is DistancePerPulse/GetPeriod();

is there something i can do that would make this relitivly easy?
__________________
"you can build a perfect machine out of imperfect parts" -Urza
Reply With Quote
  #10   Spotlight this post!  
Unread 04-02-2012, 10:47
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 8,102
Ether has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond repute
Re: PID drive paramiters?

Quote:
Originally Posted by techkid86 View Post
do you know what that might be? ive spent the morning trying to figure out what that number is. the GetRate() is DistancePerPulse/GetPeriod();

is there something i can do that would make this relitivly easy?
tell me what rpm you expect to get at the encoder when setpoint is +1
(and explain how you got that)

tell me your encoder part number

Reply With Quote
  #11   Spotlight this post!  
Unread 04-02-2012, 17:34
techkid86's Avatar
techkid86 techkid86 is offline
Magic Programer
FRC #3044 (0xBE4)
Team Role: Alumni
 
Join Date: Jan 2011
Rookie Year: 2010
Location: ballston spa
Posts: 58
techkid86 is an unknown quantity at this point
Re: PID drive paramiters?

hey. thank you so much. i found the correct number for that now. it was 1/2000 which was the reciprical of the max speed. now we have the issue in which the P value seems to be a scaler for the jaguar, as opposed to a proportional controler. as we increse P, the target speed seems to incress. any ideas?
__________________
"you can build a perfect machine out of imperfect parts" -Urza
Reply With Quote
  #12   Spotlight this post!  
Unread 04-02-2012, 18:23
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 8,102
Ether has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond repute
Re: PID drive paramiters?

Quote:
Originally Posted by techkid86 View Post
hey. thank you so much. i found the correct number for that now. it was 1/2000 which was the reciprical of the max speed. now we have the issue in which the P value seems to be a scaler for the jaguar, as opposed to a proportional controler. as we increse P, the target speed seems to incress. any ideas?
Read these posts/threads:

http://www.chiefdelphi.com/forums/sh...38&postcount=4

http://www.chiefdelphi.com/forums/sh...90#post1115090


Reply With Quote
  #13   Spotlight this post!  
Unread 04-02-2012, 20:47
techkid86's Avatar
techkid86 techkid86 is offline
Magic Programer
FRC #3044 (0xBE4)
Team Role: Alumni
 
Join Date: Jan 2011
Rookie Year: 2010
Location: ballston spa
Posts: 58
techkid86 is an unknown quantity at this point
Re: PID drive paramiters?

Thank you so much. PID is working fine. one more issue that we met was that the encoder direction was reversed, but that was easily enough solved. now the PID is working fine, and this record will be kept for future years of this team.

Thank you so much for your patiance and help ^_^
GO TEAMS!
__________________
"you can build a perfect machine out of imperfect parts" -Urza
Reply With Quote
  #14   Spotlight this post!  
Unread 05-02-2012, 00:30
techkid86's Avatar
techkid86 techkid86 is offline
Magic Programer
FRC #3044 (0xBE4)
Team Role: Alumni
 
Join Date: Jan 2011
Rookie Year: 2010
Location: ballston spa
Posts: 58
techkid86 is an unknown quantity at this point
Re: PID drive paramiters?

On second thought, we are having issues implementing one of the methods you recommended earlier. We have decided to use the

Output= Output +...

method, but out issue is, how do we get the value of the PIDControllor without setting a PIDOutput? could we just make an output object, feed it to the controller, and further ignore it?

Jaguar leftJ=new Jaguar(1,1);
Encoder leftE= new Encoder(1,1,1,2);
PIDOutput myoutput;
PIDController leftController= new PIDController(P,I,D, leftE, myoutput);

double speed=0;

{
speed=speed+ leftController.get();
leftJ.set(speed);
}


excluding ofcourse some details, but this is the general idea.
__________________
"you can build a perfect machine out of imperfect parts" -Urza
Reply With Quote
  #15   Spotlight this post!  
Unread 05-02-2012, 01:04
Ginto8's Avatar
Ginto8 Ginto8 is offline
Programming Lead
AKA: Joe Doyle
FRC #2729 (Storm)
Team Role: Programmer
 
Join Date: Oct 2010
Rookie Year: 2010
Location: Marlton, NJ
Posts: 174
Ginto8 is a glorious beacon of lightGinto8 is a glorious beacon of lightGinto8 is a glorious beacon of lightGinto8 is a glorious beacon of lightGinto8 is a glorious beacon of light
Re: PID drive paramiters?

I actually did some stuff with this quite recently; my image tracking code outputs an angle that the robot should be at, and this angle is fed into a PIDController. For testing, I wanted this same setup to remain there, but also didn't want it to be doing anything.

2 things I learned about the PIDController: 1) it does not like either its PIDSource or its PIDOutput being null. It will crash if either is null. 2) interface/abstract class implementation is extremely convenient.
The basic setup I had was this:
Code:
PIDController pid = new PIDController(PID_P,PID_I,PID_D,
                           new PIDSource() { public double pidGet() { return 0; } },
                           new PIDOutput() { public void pidWrite(double) {} });
This let me set and get the PIDController's setpoint without messing anything up, and at the same time made it so that when I actually got the PIDController up and running, I wouldn't have to change too much.

If you wanted to put in a valid PIDSource that would work just as well.
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 13:18.

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