Go to Post I don't think FIRST is the reason for following rules, being respectful, etc. We should do that anyway. - Dan Zollman [more]
Home
Go Back   Chief Delphi > Technical > Control System
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #3   Spotlight this post!  
Unread 21-02-2007, 08:07
Mike Copioli's Avatar
Mike Copioli Mike Copioli is offline
You make it pretty We make it dance
no team (Retired(3539, 217))
Team Role: Engineer
 
Join Date: Jan 2006
Rookie Year: 2001
Location: Romeo
Posts: 454
Mike Copioli has a reputation beyond reputeMike Copioli has a reputation beyond reputeMike Copioli has a reputation beyond reputeMike Copioli has a reputation beyond reputeMike Copioli has a reputation beyond reputeMike Copioli has a reputation beyond reputeMike Copioli has a reputation beyond reputeMike Copioli has a reputation beyond reputeMike Copioli has a reputation beyond reputeMike Copioli has a reputation beyond reputeMike Copioli has a reputation beyond repute
Exclamation Re: Inverting x-axis

Quote:
Originally Posted by jkjohnson View Post
When my team and I were testing the usb chicklet with the Logitech Dual action gamepad we experinced some difficulties with the x-axis of the left joystick. When attempting to turn the robot left it turned right, when attempting to turn right it turned left. We have tried re-calibrating it but it continued to give us the same reaction. Although it turns correctly with the KOP joystick we would really like the usb chicklet to work for us. We are not looking for advice on adjusting our program because we want the program to work with either the KOP joystick or the usb chicklet. If anyone knows any solution to this to problem we would greatly appreciate it.
By default you will have to change the mapping of the joysticks when transitioning from two joy drive to a gamepad. Since the gamepad uses one port and joysticks require two. So no matter what you will have to change your code. My suggestion is to use preprocessor defines to make the transition easy.

For example:


// set the condition to 1 for gamepad assignments
#if (1)
#define LEFT_DRIVE 254-p1_y
#define RIGHT_DRIVE 254-p1_x


// change the above condition to 0 to use joystick assignments
#else
#define LEFT_DRIVE p1_y
#define RIGHT_DRIVE p2_y

Or if you like, you could use a switch on the O/I to select from joy to gamepad. Preprocessor define will not work for this. You would use the same logic but during program flow.

#define LEFT_DRIVE pwm01
#define RIGHT_DRIVE pwm02

// if switch is true, use gamepad assignments
if(switch_x)
{
LEFT_DRIVE = 254-p1_y;
RIGHT_DRIVE = 254-p1_x;
}

// if switch is not true, use joystick assignments
else
{
LEFT_DRIVE = p1_y;
RIGHT_DRIVE = p2_y;
}
__________________
Mike Copioli
CTRE Hardware Engineer
http://www.ctr-electronics.com

Team 3539 The Byting Bull Dogs
2013 Michigan State Champions
Team 217 The Thunder Chickens
2006 World Champions
2008 World Champions
2009 Michigan State Champions
Reply With Quote
 


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
Inverting Joysticks? The yellowdart Programming 5 20-02-2006 20:05
Dual-Axis Accelerometer naor52 Programming 18 27-01-2006 22:06
Reversing the joystick axis JBotAlan Programming 3 09-02-2005 19:47
Inverting Y axis on joystick FormatteD_C Programming 7 24-02-2004 16:56
switching joystick axis????? team222badbrad Technical Discussion 9 16-01-2002 23:07


All times are GMT -5. The time now is 23:54.

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