View Single Post
  #2   Spotlight this post!  
Unread 29-01-2014, 22:07
otherguy's Avatar
otherguy otherguy is offline
sparkE
AKA: James
FRC #2168 (The Aluminum Falcons)
Team Role: Mentor
 
Join Date: Feb 2010
Rookie Year: 2009
Location: CT
Posts: 429
otherguy is a splendid one to beholdotherguy is a splendid one to beholdotherguy is a splendid one to beholdotherguy is a splendid one to beholdotherguy is a splendid one to beholdotherguy is a splendid one to beholdotherguy is a splendid one to behold
Re: Code for Can jaguars.

I haven't implemented code for any of this myself, but from what I can tell from the wpilib source and javadocs:

The mechanumDrive_Cartesian (which you talk about using in the other thread) expects the x and y values you are passing in to be scaled from 1.0 to -1.0 implying that this method is driving the motor controllers open loop. So no encoders are being used by this method.
Furthermore the source calls the .set() method for the SpeedController. I'm not sure this will work if you're using the CANJaguar class. .set() is deprecated. You're supposed to use .setX()

IF you are dead set on using a CANJaguar, with encoders wired to them, and use the mechanum cartesian method... you could always write your own implementation of the mecanumDrive_Cartesian method. The source is here, it shouldn't be that hard to modify for your own uses.

The gyro should be wired in to the crio.

Also, using the Encoder class, for encoders, implies that the encoder is wired to the DSC. There are many constructors for the Encoder class. Fore example you could just pass in the pin numbers that the encoder is plugged into.
The constructors taking in DigitalSource objects would be used if you had already created a DigitalInput object for the specific pin your encoder is wired to.
__________________
http://team2168.org

Last edited by otherguy : 29-01-2014 at 22:14.
Reply With Quote