Go to Post I've always suspected that one could find glimpses of wisdom, setting priorities, and responsibility - and ways to balance them, in the contents of a coffee cup. - JaneYoung [more]
Home
Go Back   Chief Delphi > Technical > Programming
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Closed Thread
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 21-02-2005, 15:16
archimedes archimedes is offline
Registered User
#1303
 
Join Date: Dec 2004
Location: Wyoming
Posts: 4
archimedes is an unknown quantity at this point
Calibration/Zeroing of Joystick

We are trying to use a different joystick then what came in the kit. Its center is not at (127, 127). We need a way to center. Right now, we have a button that is not on the joystick wired up so that we can press it and it will then be calibrated. We don't have the code to do this. Our code right now will add a constant (either pos. or neg) to the joystick values which would then in theory have the joystick centered. The problem comes in getting that constant. How can we keep a constant wth the looped structure of the FRC code? We have tried putting it in User_Initialization and also at the spot that where the inputs are mapped to the drive PWMs. Any help would be appreciated.

archimedes, Wyoming Aftershock
  #2   Spotlight this post!  
Unread 21-02-2005, 15:22
JoshJ JoshJ is offline
Registered User
#0316 (LuNaTeCs)
Team Role: College Student
 
Join Date: Mar 2003
Rookie Year: 2002
Location: Salem County
Posts: 44
JoshJ is on a distinguished road
Send a message via AIM to JoshJ
Re: Calibration/Zeroing of Joystick

If you button is NOT coded, that isnt too bad. Just dont touch the joystick and let it center itself and push the button. Code would be something like:

if (switchname)
{
consty=p1_y-127;
constx=p1_x-127;
}

and then modify the drive code so it takes
pwmxx= LimitMix((p1_y-consty)+(p1_x-constx)-127);

Good Luck
  #3   Spotlight this post!  
Unread 21-02-2005, 18:01
archimedes archimedes is offline
Registered User
#1303
 
Join Date: Dec 2004
Location: Wyoming
Posts: 4
archimedes is an unknown quantity at this point
Re: Calibration/Zeroing of Joystick

That is basicly what I have already programmed in. The problem is keeping that constant throughout the loop or getting it assigned. When I put code like that in our program, the offset, constatn, whatever you want to call it, is not right and it doesn't work. Where do we define our variables and assign to them so that they are trully global?

archimedes
  #4   Spotlight this post!  
Unread 21-02-2005, 19:10
JoshJ JoshJ is offline
Registered User
#0316 (LuNaTeCs)
Team Role: College Student
 
Join Date: Mar 2003
Rookie Year: 2002
Location: Salem County
Posts: 44
JoshJ is on a distinguished road
Send a message via AIM to JoshJ
Re: Calibration/Zeroing of Joystick

Just thought of something else.
What you can do is take out your offset code (and unplug any motor PWM cables!) and map p1_y and p1_x (or whatever) to individual PWM(1-16). Then open up IFI Dashboard and see how far off you are, and just code the number into your initialization at the top of user_routines.c

so you could just have char xoffset= 7 or whatever it is, just make sure in your pwm mixing code you add or subtract accordingly.

Also, if you post code, I or somebody else can look at it and see if there is anything throwing you off. I also recommend programming deadbands so that your joystick doesnt output anything but 127 for the first few values of x and y.

Oh yea, there is also a thing you can do to calibrate your speed controllers to your joystick. I am not sure how to do this, but I know there is a post on it. This may fix your centering problems, and should give you full range on your stick instead of the (most likely) shortened range that it would have otherwise

Good luck
Closed Thread


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

Similar Threads
Thread Thread Starter Forum Replies Last Post
Tri-axis Analog Joystick KVermilion Control System 5 19-01-2005 00:24
Changing 1 joystick code to 2 (rookie team) Brawler006 Programming 5 20-02-2004 17:00
robot goes haywire with the one joystick default code Miles Programming 7 24-01-2003 14:58
joystick problem archiver 2000 12 23-06-2002 23:08
switching joystick axis????? team222badbrad Technical Discussion 9 16-01-2002 23:07


All times are GMT -5. The time now is 00:15.

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