Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Programming (http://www.chiefdelphi.com/forums/forumdisplay.php?f=51)
-   -   Inverting Joysticks? (http://www.chiefdelphi.com/forums/showthread.php?t=44426)

The yellowdart 20-02-2006 18:19

Inverting Joysticks?
 
The electrical guys and i have wired the robot and everything. All the wiring is pretty neat and tidy, but we have a problem.... we have 2 right handed transmissions and need to invert one of our joysticks.

I was just wondering what i would do in the code to invert the joysticks. Any and all help or ideas would be greatly appreciated.

**we dont wanna rewire anything, we would like to change the code

sanddrag 20-02-2006 18:30

Re: Inverting Joysticks?
 
It is very easy to just swap the wires on the motor side of the victor. If you want to do it in the program, replace all your pwm values with
Code:

254-whateveryoucurrentlyhave
That should invert it.

The yellowdart 20-02-2006 19:01

Re: Inverting Joysticks?
 
we only need it switched for one joystick.....will doing 254 - whatever really invert, or is there a command to invert it?

Travis Hoffman 20-02-2006 19:24

Re: Inverting Joysticks?
 
joystickvar = 254 - joystickvar;


That's all you need.

Keith Watson 20-02-2006 19:53

Re: Inverting Joysticks?
 
Quote:

Originally Posted by The yellowdart
we only need it switched for one joystick.....will doing 254 - whatever really invert, or is there a command to invert it?

Yes, it really inverts it. There is no command although you could right your own function.

Quote:

Originally Posted by sanddrag
It is very easy to just swap the wires on the motor side of the victor.

On one of our motors this is what our programmer chose to do. Just swap the red and black wires on the output. It's probably helpful to document that someplace in case the wires are ever disconnected and need to be reconnected in the correct place.

Idaman323 20-02-2006 20:05

Re: Inverting Joysticks?
 
Wow I didn't think of it being as easy as 254-p1_y.......

I came up with 127-(p1_y-127) which essentially does the same thing... I think to much...


All times are GMT -5. The time now is 01:36.

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