|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
| Thread Tools | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Need to invert Joystick axis output
Our team is moving into Java for the first time this year, and we are creating our "Hello World" program (Simple driving). We are using the arcadeDrive method of a RobotDrive class object. It will drive forwards and backwards in the way we want, but the turning is inverted. Left joystick results in a right turn, and right joystick in a left. Inverting motors does not solve this problem, so I think we need to invert the x axis output from the joystick. Has anyone had this problem before? Any help inverting these values? Thanks.
|
|
#2
|
|||||
|
|||||
|
Re: Need to invert Joystick axis output
Quote:
Code:
robotDrive.arcadeDrive(joystick.getY(), -joystick.getX()); |
|
#3
|
|||
|
|||
|
Re: Need to invert Joystick axis output
Have you thought about looking in the driverstation and switching your joystick ports under the setup tab switching the joystick imports. Your java code calls for a joystick in port one or port two. Your computer doesn't have a USB port one or port two.. Thats where the FRC driverstation comes in.. to define what is port one and port two. You just need to switch the joystick ports. This method works better versus putting inverse in front of your code.
|
|
#4
|
|||||
|
|||||
|
Re: Need to invert Joystick axis output
Quote:
|
|
#5
|
|||
|
|||
|
Re: Need to invert Joystick axis output
Yes, we only have one joystick. Everything works except we need to invert x. With the code notmattlythgoe showed, don't you normally use a normal joystick object? as in define the object and then just call it in? I haven't seen Joystick.getx and Joystick.gety before
|
|
#6
|
|||
|
|||
|
Re: Need to invert Joystick axis output
notmattlythgoe, thanks so much that method worked perfectly. Problem solved.
|
|
#7
|
||||
|
||||
|
Re: Need to invert Joystick axis output
Quote:
|
|
#8
|
|||||
|
|||||
|
Re: Need to invert Joystick axis output
I agree with Ether, this isn't something you normally have to do, so it could be an indication that something is backwards somewhere.
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|