Go to Post I always mean what I say. I just don't always say what I mean. - dlavery [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

 
 
 
Thread Tools Rating: Thread Rating: 31 votes, 5.00 average. Display Modes
Prev Previous Post   Next Post Next
  #7   Spotlight this post!  
Unread 01-28-2012, 07:17 PM
rrossbach rrossbach is offline
Registered User
AKA: Ron R
FRC #2607 (RoboVikings)
Team Role: Mentor
 
Join Date: Nov 2008
Rookie Year: 2008
Location: Warrington PA
Posts: 90
rrossbach is a splendid one to beholdrrossbach is a splendid one to beholdrrossbach is a splendid one to beholdrrossbach is a splendid one to beholdrrossbach is a splendid one to beholdrrossbach is a splendid one to beholdrrossbach is a splendid one to behold
Re: Help Setting Up PID System for Tank Drive Train

Quote:
Originally Posted by mbushroe View Post
how about a code sample to connect the cRIO to the internal PID of the Jaguar? ... We would like to use the internal Jaguar PID, but have not yet found a way to control it through the robot.
You can look at our team's 2011 code for an example if you like - it's available at http://code.google.com/p/robovikings-2607/. In particular look at the LogomotionDriveTrain class.

Basically, in robotInit() you would do something similar to this:
Code:
public void robotInit() {
   try {
      m = new CANJaguar(2);    // change 2 to match the CAN id of the Jag
      m.changeControlMode(CANJaguar.ControlMode.kSpeed);
      m.setSpeedReference(CANJaguar.SpeedReference.kEncoder);
      m.configEncoderCodesPerRev(240);  // change 240 to match your encoder
      m.setPID(.350, .004, .001);  // change gains to whatever you need based on tuning
      m.enableControl();
   } catch (Exception e) {
       ...
   }
}
Then in the autonomous or teleop methods use the m.setX() to set the speed you want the motor to run at.

Quote:
Originally Posted by Ether View Post
... I don't have access to an FRC Java installation so I can't confirm whether this class supports the serial-to-CAN interface.
The WPILib classes for CAN support in Java and C++ (and Labview for that matter) are all independent of the type of CAN interface used (serial or 2CAN). The actual comms are handled via the "plugin" (BlackJag plugin for serial, or 2CAN plugin for the 2CAN) and the WPILib routines communicate through those plugins.

Hope this helps!

- Ron
Team #2607 controls mentor
__________________

FIRST Mid-Atlantic Volunteer
FRC Team #2607 Mentor
Reply With Quote
 


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 08:16 AM.

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