Go to Post Programming humor is funny, period. - 1168Programmer [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 21-02-2012, 12:15
therealman1's Avatar
therealman1 therealman1 is offline
Registered User
FRC #3044
Team Role: Programmer
 
Join Date: Oct 2011
Rookie Year: 2011
Location: ballston spa
Posts: 14
therealman1 can only hope to improve
encoder uneven

The programming team has been recently been working on our PID loop but the encoder is not keeping it near steady at all. I will soon hopefuly post the code, can anyone give us some advice?
Reply With Quote
  #2   Spotlight this post!  
Unread 21-02-2012, 12:22
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: encoder uneven

Quote:
Originally Posted by therealman1 View Post
The programming team has been recently been working on our PID loop but the encoder is not keeping it near steady at all. I will soon hopefuly post the code, can anyone give us some advice?
You're much more likely to get useful answers if you provide useful information.

Have you looked at the output of the encoder and is it sufficiently noise free and accurate?

What device is the PID controlling?

Is the PID in cRIO or a Jaguar?

Speed, linear position, or angle?

What scaling are you using for the setpoint and process variable?

What encoder part number?

4x 2x or 1x ?

What are your P, I, and D gains?

etc etc etc


Reply With Quote
  #3   Spotlight this post!  
Unread 21-02-2012, 12:58
therealman1's Avatar
therealman1 therealman1 is offline
Registered User
FRC #3044
Team Role: Programmer
 
Join Date: Oct 2011
Rookie Year: 2011
Location: ballston spa
Posts: 14
therealman1 can only hope to improve
Re: encoder uneven

Have you looked at the output of the encoder and is it sufficiently noise free and accurate?
it is not noise free. that is the main problem.

What device is the PID controlling?
shooter drive motors. two jags, connected by a splitter cable

Is the PID in cRIO or a Jaguar?
cRIO

Speed, linear position, or angle?
speed

What scaling are you using for the setpoint and process variable?
all parts are -1-1

What encoder part number?
E4P

4x 2x or 1x ?
4x

What are your P, I, and D gains?
we are setting them. we varry p, while i and d remain at 0

etc etc etc
anything else?
Reply With Quote
  #4   Spotlight this post!  
Unread 21-02-2012, 13:13
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: encoder uneven

Quote:
Originally Posted by therealman1 View Post
Have you looked at the output of the encoder and is it sufficiently noise free and accurate?

it is not noise free. that is the main problem.

4x 2x or 1x ?
4x
What is the encoder speed? There is a limit to how fast the FPGA can count.

Try using 1x. You don't need 4x for the high speed of a shooter wheel.

If that signal isn't quiet enough, then do this:

instead of using GetRate(), read the encoder counts (still using 1x) instead, subtract the previous counts [see footnote] , and divide that by the sample time. Then scale appropriately.


Quote:
anything else?
Yes:

Quote:
What device is the PID controlling?
shooter drive motors. two jags, connected by a splitter cable
Are these identical motors, and are their outputs mechanically linked so they are at the same speed?

Quote:
Is the PID in cRIO or a Jaguar?
cRIO
Home-brew or WPI library?


Quote:
What are your P, I, and D gains?
we are setting them. we varry p, while i and d remain at 0

Speed, linear position, or angle?
speed
Are you integrating the output of the PID?


Quote:
What scaling are you using for the setpoint and process variable?
all parts are -1-1
What do you mean by "-1 -1"


footnote: or do this: read the encoder counts, divide that by the sample time, then reset the encoder counts to zero. I don't know how long it takes the encoder counts to overflow


Last edited by Ether : 21-02-2012 at 13:37.
Reply With Quote
  #5   Spotlight this post!  
Unread 21-02-2012, 13:14
therealman1's Avatar
therealman1 therealman1 is offline
Registered User
FRC #3044
Team Role: Programmer
 
Join Date: Oct 2011
Rookie Year: 2011
Location: ballston spa
Posts: 14
therealman1 can only hope to improve
Re: encoder uneven

that sounds good i will try that
Reply With Quote
  #6   Spotlight this post!  
Unread 21-02-2012, 13:26
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: encoder uneven

Quote:
Originally Posted by therealman1 View Post
that sounds good i will try that
I edited my previous post and added some more comments and questions. Please re-read it.


Reply With Quote
  #7   Spotlight this post!  
Unread 21-02-2012, 13:57
therealman1's Avatar
therealman1 therealman1 is offline
Registered User
FRC #3044
Team Role: Programmer
 
Join Date: Oct 2011
Rookie Year: 2011
Location: ballston spa
Posts: 14
therealman1 can only hope to improve
Re: encoder uneven

Are these identical motors, and are their outputs mechanically linked so they are at the same speed?
They are the same moters and they are both mechanically linked

it is WPI library

Are you integrating the output of the PID?
speed+=PIDshooter.get();
leftJag.set(speed);

-1-1 as from -1 to 1
Reply With Quote
  #8   Spotlight this post!  
Unread 21-02-2012, 14: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: encoder uneven

Quote:
Originally Posted by therealman1 View Post
speed+=PIDshooter.get();
leftJag.set(speed);
I assume that PIDshooter.get() returns the output of your PID, correct ?

I assume leftJag.set() is the method which sets the output to your motor controller, correct ?

What is the range of the input that the motor controller is expecting ?

Do you need to clamp that to -/+1 ?

What is the speed of the device to which the encoder is attached ? (the FPGA has a counts/sec limit)



Last edited by Ether : 21-02-2012 at 14:43.
Reply With Quote
  #9   Spotlight this post!  
Unread 21-02-2012, 14:44
therealman1's Avatar
therealman1 therealman1 is offline
Registered User
FRC #3044
Team Role: Programmer
 
Join Date: Oct 2011
Rookie Year: 2011
Location: ballston spa
Posts: 14
therealman1 can only hope to improve
Re: encoder uneven

the jag is expecting -1 to 1, and it is receiving that amount
Reply With Quote
  #10   Spotlight this post!  
Unread 21-02-2012, 14:54
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: encoder uneven

Quote:
Originally Posted by therealman1 View Post
the jag is expecting -1 to 1, and it is receiving that amount
there's no -/+1 clamp here, "speed" is being integrated without bound:

Code:
speed+=PIDshooter.get();
leftJag.set(speed);

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 12:49.

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