Manual Ramping

I’m not sure if the title really explains what I’m talking about.
Rather than abrupt acceleration and deceleration, my team thought that it would be better if we went in increments, increasing speed on every iteration of the main loop.

I sort of have an idea of the GET functions in the Jaguar, but are there any kind of SET functions that would allow for me to explicitly change the rpm?

This is more or less of my pseudocode as of now, if this helps my rather horrid explanation/request.

#include "WPILib.h"
int oldX = 0;
CANJaguar::CANJaguar LPort = new CANJaguar::CANJaguar;
CANJaguar::CANJaguar RPort = new CANJaguar::CANJaguar;
global int currentX = Joystick::GetX(PORT);
global double speed = (6 * pi) * CANJaguar::GetSpeed();

while(true)
{
	if(currentX>oldX)
	{
		//Accel
	}
	else if(currentX < oldX)
	{
		//Decel
	}
oldX = currentX;
}

Jaguar has an output ramp setting built in. I don’t know the specific APIs but you basically set the ramp rate and the Jaguar takes care of the rest.

This only works in %Vbus mode and not the closed loop modes. If you plan on using Speed Mode you will need to ramp the speed commands sent to the Jag in the code running on the cRIO.

I don’t think it is exactly what you’re looking for but there is one more way to ramp the output on the Jag without writing any code. You can rotate the two limit switch jumpers on the Jag horizontally (default is vertical) and the Jaguar will automatically set the ramp rate so that it ramps from full forward to full reverse in 1/8th of a second. This rate is hard coded in the firmware, so if you need something different you need to use the APIs. The Jaguar FAQ describes this in more detail.

I sort of have an idea of the GET functions in the Jaguar, but are there any kind of SET functions that would allow for me to explicitly change the rpm?

You are pretty much describing Jaguar’s Speed Mode: An encoder is connected to the encoder input on the Jag and the Jaguar handles all the closed-loop speed control.

If you don’t want to use Speed Mode, you can still read the speed of an encoder connected to the Jag. You just have to enable speed mode and configure the encoder before switching back and operating in a different mode (like %Vbus).

Again, I’m not familiar with the APIs, but I know they exist to operate all the different modes and features of Jaguar. I recommend trying things out with BDC-COMM, a Windows utility that allows you to play with all the features without writing code.

-David