Go to Post If you speak three languages, you're trilingual. If you speak two languages, you're bilingual. And if you speak one language, you're American. - Hieb [more]
Home
Go Back   Chief Delphi > FIRST > General Forum
Team 51   CD-Events   CD-Media   CD-Swap   CD-Spy   FRC-Spy   Unsung FIRST Heroes   WFA
portal register members calendar search Today's Posts Mark Forums Read FAQ rules
VEXpro
The Chief Delphi Forums are sponsored by Innovation First International, Inc.
Chief Delphi Alumni
ADVERTISEMENT

 
Reply
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 05-10-2012, 03:25 PM
SoyStuff SoyStuff is offline
Registered User
FRC #1257
 
Join Date: Jan 2012
Location: Brooklyn
Posts: 29
SoyStuff is a jewel in the roughSoyStuff is a jewel in the roughSoyStuff is a jewel in the rough
CANJaguar Control C++

We are working with CANJaguar for the first time, and we are sort of lost. We have the motors themselves spinning, but we can't seem to control them as we want to. We're in PercentVBus mode, and we are using the regular old set function (we pass it a value between -1 and 1 using the axes on our gamepad). Instead of moving the motor at the speed that is specified, though, it gradually approaches that speed.

Here is a rough outline of our code, just highlighting stuff relating to the CANJags:
Code:
cjag(12, CANJaguar::kPercentVbus), // This is in the constructor for our drivetrain class

// Settings
cjag.SetPID(0.4, 0.005, 0);
cjag.ConfigEncoderCodesPerRev(200);
cjag.SetSpeedReference(CANJaguar::kSpeedRef_Encoder);
cjag.EnableControl();

// Moving 
cjag.Set(gamepad.GetY());
Reply With Quote
  #2   Spotlight this post!  
Unread 05-10-2012, 04:11 PM
Andrew Schreiber's Avatar
Andrew Schreiber Andrew Schreiber is offline
Data Nerd
no team (EWCP)
Team Role: Mentor
 
Join Date: Jan 2005
Rookie Year: 2000
Location: Tampa, FL
Posts: 2,570
Andrew Schreiber has a reputation beyond reputeAndrew Schreiber has a reputation beyond reputeAndrew Schreiber has a reputation beyond reputeAndrew Schreiber has a reputation beyond reputeAndrew Schreiber has a reputation beyond reputeAndrew Schreiber has a reputation beyond reputeAndrew Schreiber has a reputation beyond reputeAndrew Schreiber has a reputation beyond reputeAndrew Schreiber has a reputation beyond reputeAndrew Schreiber has a reputation beyond reputeAndrew Schreiber has a reputation beyond repute
Send a message via AIM to Andrew Schreiber Send a message via Skype™ to Andrew Schreiber
Re: CANJaguar Control C++

This is because you are using a PID controller on them. You are telling it to try to get to a certain value. Try not using the PID controller (try removing the cjag.EnableControl(); line and see if you get the same behavior)
__________________

27->397 > 2337 + 314 + 3450 > 79
Reply With Quote
  #3   Spotlight this post!  
Unread 05-10-2012, 06:30 PM
dudefise dudefise is offline
Registered User
FRC #2637 (Panthers)
Team Role: Leadership
 
Join Date: Feb 2011
Rookie Year: 2011
Location: CA
Posts: 77
dudefise is an unknown quantity at this point
Re: CANJaguar Control C++

Quote:
Originally Posted by Andrew Schreiber View Post
This is because you are using a PID controller on them. You are telling it to try to get to a certain value. Try not using the PID controller (try removing the cjag.EnableControl(); line and see if you get the same behavior)
He's right, it's due to the PID control. We also used CAN and C++ on our robot this year, and started with P as 1.0, I as 0.01 and D as 0. It will still loop, but will get to speed much quicker, although it may have significant overshoot until you tune it.

As far as I know, there is no way to control the Jaguars with encoders without a PID loop being involved.

I'm not a programmer so I'm not sure about this, but you might also need to construct the CANJaguar as CANJaguar::kSpeed instead of kPercentVbus.

Hope this helps!
__________________
2010 VRC 2453B - Team Captain - 19th Word Champs Math Division
2011 FRC 2637 - Electrical - Las Vegas Regional Semifinalists with 1726 and 166
2012 FRC 2637 - Electronics Captain - Las Vegas Regional Semifinalists with 1661 and 2984
2012 FRC 2637 - Build Captain - Inland Empire Quarterfinalists with 3925 and 207
Reply With Quote
  #4   Spotlight this post!  
Unread 05-10-2012, 06:37 PM
slijin's Avatar
slijin slijin is offline
Pockets
AKA: Samuel Lijin
FRC #0694 (StuyPulse)
Team Role: Electrical
 
Join Date: Jan 2010
Rookie Year: 2010
Location: New York City
Posts: 536
slijin is a splendid one to beholdslijin is a splendid one to beholdslijin is a splendid one to beholdslijin is a splendid one to beholdslijin is a splendid one to beholdslijin is a splendid one to beholdslijin is a splendid one to behold
Re: CANJaguar Control C++

Quote:
Originally Posted by Andrew Schreiber View Post
This is because you are using a PID controller on them. You are telling it to try to get to a certain value. Try not using the PID controller (try removing the cjag.EnableControl(); line and see if you get the same behavior)
Also note that the mode you're using uses neither PID nor encoders. You want to use speed control to use them.

It also seems to me, looking through the FIRSTForge documentation, that kPercentVbus is no longer a control mode, and has been renamed to be "kPercentVoltage".
__________________

2010-12 CT Chairman's
2011 Galileo 5th seed
2010 NY Regional Winners
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 01:09 AM.

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


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Copyright © Delphi and Pontiac Central High School