Using encoder with jaguar

My team saw in a PDF that it was possible to use an encoder connected to a jaguar to regulate the speed. Unfortunately, we haven’t been able to find any information about actually DOING this in C++. Is there any example code that shows how to do this?

If there was example code for everything, FIRST wouldn’t exist.

Learn how to use the encoder, learn how to use the Jaguars, research on closed-loop controllers. Do your homework! :smiley:

It’s possible, and example code exists (see the CANJaguar project on FIRST Forge) but you’ll need to use CAN instead of PWM control for your Jags, which is a whole 'nother can of worms.

Oh, we’re already using CAN, so that’s not a problem.
We think we ended up finding out what we needed, we just have to initialize it with kSpeed, set the speed reference, and convert joystick values into RPM.

Don’t forget to set your PID values…

Sorry, using velocity or another other closed loop control on the Jaguars has been deemed illegal. See here: http://www.chiefdelphi.com/forums/showthread.php?p=1004743#post1004743

Ouch. Welll…I guess that settles it, then.

it is allowed from what i’ve seen, check team update 4
http://usfirst.org/uploadedFiles/Robotics_Programs/FRC/Game_and_Season__Info/2011_Assets/Team_Updates/Team_Update_04.pdf

Yeah, we found that. Thank you!