Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Programming (http://www.chiefdelphi.com/forums/forumdisplay.php?f=51)
-   -   Inverting a joystick axis in arcade mode (http://www.chiefdelphi.com/forums/showthread.php?t=54905)

gabrielse 23-02-2007 12:07

Inverting a joystick axis in arcade mode
 
Is there any easy way to invert one joystick axis in arcade mode?

We just got a USB-Chicklet and a Logitech Dual Action Gamepad. Our code uses arcade mode and works perfectly with the joystick from the kit of parts. Unfortunately, the chicklet inverts the x-axis of the gamepad's joystick.

We do not want to change the direction the robot drives.

The only way I know how to work around this problem is to rewrite the arcade function (using the default MPLab 1-joystick drive code as a model). Our rookie programmer won't have time to do that.

kaszeta 23-02-2007 12:35

Re: Inverting a joystick axis in arcade mode
 
Quote:

Originally Posted by gabrielse (Post 584954)
The only way I know how to work around this problem is to rewrite the arcade function (using the default MPLab 1-joystick drive code as a model). Our rookie programmer won't have time to do that.

Not quite. None of the modes for the Chicklet use the "aux" analog input for a real axis, they use them for encoding buttons. So, if no buttons are pressed p1_aux (or whatever port you're using) should be larger than 127 all the time if you are using the chicklet. So do a check for that, and if p1_aux is significantly greater than 127, switch the X axis.

I've considered something similar to make sure nothing goes weird if our chicklet is malfunctioning.

Not that unless you're in your fix-it window, you shouldn't be coding right now, however.

Kingofl337 23-02-2007 13:38

Re: Inverting a joystick axis in arcade mode
 
You can also invert all four motors and that should effectivly invert the axis.

Dad1279 23-02-2007 13:46

Re: Inverting a joystick axis in arcade mode
 
You can do it in hardware by swapping the pwms on the robot. You may then need to reverse the Red & Black leads from the motor to the Victors.

Or in software just swap the Arcade PWMs for rightmotor/leftmotor. You may also need to check the 'Invert Direction' boxes.

gabrielse 05-03-2007 10:16

Re: Inverting a joystick axis in arcade mode
 
Our programmer switched the left and right motors in the Arcade block and solved the problem. Unfortunately, we have to reprogram if we want to use the KOP joystick. Thanks for all your help.


All times are GMT -5. The time now is 04:53.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi