Quote:
Originally Posted by jkjohnson
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