Go to Post I know I will never be part of an alliance this incredible, ever again (my apologies to all future partners, but you've got BIG shoes to fill.) - JVN [more]
Home
Go Back   Chief Delphi > Technical > Programming > C/C++
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Reply
 
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 16-01-2013, 17:15
turtleman turtleman is offline
Captain/ Programmer
AKA: Carlos Jimenez
FRC #4369 (Brick City Bots)
Team Role: Leadership
 
Join Date: Nov 2011
Rookie Year: 2011
Location: Sanford, NC
Posts: 17
turtleman is an unknown quantity at this point
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.

Code:
#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;
}
__________________
Cav Pride
Reply With Quote
  #2   Spotlight this post!  
Unread 16-01-2013, 17:47
dyanoshak dyanoshak is offline
Registered User
AKA: David Yanoshak
FRC #2158 (ausTIN CANs)
Team Role: Mentor
 
Join Date: Dec 2007
Rookie Year: 2007
Location: Austin, TX
Posts: 189
dyanoshak has a reputation beyond reputedyanoshak has a reputation beyond reputedyanoshak has a reputation beyond reputedyanoshak has a reputation beyond reputedyanoshak has a reputation beyond reputedyanoshak has a reputation beyond reputedyanoshak has a reputation beyond reputedyanoshak has a reputation beyond reputedyanoshak has a reputation beyond reputedyanoshak has a reputation beyond reputedyanoshak has a reputation beyond repute
Re: Manual Ramping

Quote:
Originally Posted by turtleman View Post
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.
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.

Quote:
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
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 12:28.

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