Go to Post DonRotolo used COMMON SENSE. ... ... FIRST/Chief Delphi Community fainted! - PayneTrain [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 19-01-2012, 15:33
computerish computerish is offline
Registered User
FRC #0619
 
Join Date: Nov 2008
Location: va
Posts: 45
computerish is an unknown quantity at this point
Jaguars return zero speed

We're using black jaguars with the US Digital E4P quadrature encoders.

Using BDC-COMM, we were able to get closed loop speed control working nicely and the speed reported seemed to be accurate.

After attempting to transition to code, the speed PID loop (running on the jaguar) seems like it is working. We can't tell for sure, though, because the speed through the getSpeed() method is always zero. We've configured the encoder codes per revolution, set it in speed mode, called enable on it, and set the position reference to kQuadEncoder. What else could account for this problem?

Thanks!
Reply With Quote
  #2   Spotlight this post!  
Unread 19-01-2012, 16:56
Doc543's Avatar
Doc543 Doc543 is offline
Electrical, Pneumatics, Driver
AKA: Eric
FRC #1891 (BullBots)
Team Role: Programmer
 
Join Date: Mar 2010
Rookie Year: 2009
Location: Meridian Idaho
Posts: 63
Doc543 is an unknown quantity at this point
Re: Jaguars return zero speed

did you use position ref or speed ref? Position ref is for position mode and speed ref is for speed mode.
We used the encoders that where in the KOP the other year, I think they are the same ones. With this code It said that it was about 450 rpm. I used just regular kEncoder and that seemed to work fine.

we did some testing and we got ours to work with the getSpeed() here is that part of our code that we used.
Code:
    double DriveP = 1; //PID is not tuned
    double DriveI = 0.1;
    double DriveD = 0;
    int EncoderRev = 360;

public void robotInit() {

           Left1 = new CANJaguar(2);
           Left1.changeControlMode(CANJaguar.ControlMode.kSpeed);
           Left1.setPID(DriveP, DriveI, DriveD);
           Left1.configEncoderCodesPerRev(EncoderRev);
           Left1.setSpeedReference(CANJaguar.SpeedReference.kEncoder);
           Left1.enableControl();

}
__________________

"Its just a prototype."
2011 Chairman's Award Utah Regional
2010 Gracious Perfectionism Utah Regional
2009 Gracious Perfectionism Portland Regional
Reply With Quote
  #3   Spotlight this post!  
Unread 19-01-2012, 18:19
computerish computerish is offline
Registered User
FRC #0619
 
Join Date: Nov 2008
Location: va
Posts: 45
computerish is an unknown quantity at this point
Re: Jaguars return zero speed

Thanks! That got our speed working.

But our PID isn't working. We tuned it in BDC-COMM and found that P = 0.5, I = 0.005, and D = 0.0 work fairly well. Using these same constants in code, though, results in the motor jerking forward and backwards rapidly, making an awful noise.

It looks like a PID tuning issue, but we tuned it in BDC-COMM.... Any ideas?

Thanks!
Reply With Quote
  #4   Spotlight this post!  
Unread 20-01-2012, 00:52
Doc543's Avatar
Doc543 Doc543 is offline
Electrical, Pneumatics, Driver
AKA: Eric
FRC #1891 (BullBots)
Team Role: Programmer
 
Join Date: Mar 2010
Rookie Year: 2009
Location: Meridian Idaho
Posts: 63
Doc543 is an unknown quantity at this point
Re: Jaguars return zero speed

That is really weird. The code and the BDC-COMM program should be the same. I cant think of anything that would cause that besides typing the wrong PID values in your code. Very weird...
__________________

"Its just a prototype."
2011 Chairman's Award Utah Regional
2010 Gracious Perfectionism Utah Regional
2009 Gracious Perfectionism Portland Regional
Reply With Quote
  #5   Spotlight this post!  
Unread 21-01-2012, 14:54
Doc543's Avatar
Doc543 Doc543 is offline
Electrical, Pneumatics, Driver
AKA: Eric
FRC #1891 (BullBots)
Team Role: Programmer
 
Join Date: Mar 2010
Rookie Year: 2009
Location: Meridian Idaho
Posts: 63
Doc543 is an unknown quantity at this point
Re: Jaguars return zero speed

Oh! I think i know the problem. You didn't set your encoder revolutions on the BDC-COMM or in your code. If your Speed is 0 in BDC-COMM you don't have the encoder revolutions set right
__________________

"Its just a prototype."
2011 Chairman's Award Utah Regional
2010 Gracious Perfectionism Utah Regional
2009 Gracious Perfectionism Portland Regional
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 09:57.

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