turning joystick controls 90% in programming

We are a rookie team. We have been running the robot with the joystick controller turned at 90 degrees for about a week because the intitial set up from LabView is causing it to be this way.

We want to fixt the axis im programming but are unsure where. I know the axis values are 0 to 254 from reading the posts.

Where and how do I switch the locations?

Is it in the WPI_JoystickGet.vi and is it that I swap the x for y and y for x in the bundle? It appears that the x is being used for fore aft rather than front to back if I am reading the code correctly.

Can someone look at this and confirm?:confused:

EDIT: I gave it more thought and your problem can be solved by inverting either your left or right motor. Do this in the begin subvi

Disreguard:
by turning 90 degrees, I would have to assume that you have the x axis and y axis switched in your program. switching the values would do nothing except reverse the controls, they would still be off by 90 degrees.

I am assuming you are useing the base code that unbundles the axis data into x axis and y axis. those should simply be fed into their respective x and y inputs into your robot drive subvi. If they match then try mismatching them to see if that solves your problem, as it may just be a problem with the joystick you are using.

You can find this in the teleop subvi.

Thanks for the feedback.

We found the mis match on both the Joysticks in the KOP and a X-box contoller. So I am thinking the issue is in the code.

We tried to flip the inputs at the motor level and it still didnt solve the issue.

When I go to the area in the WPI_JoystickGet.vi it appears that the for/aft movement is being sent into the wrong output to the motors.

You are speaking to the true false statements in the motor as it sits one is true the other is false.

You should just be able to swap the X and Y axis values, if you are using labview then just swap the wires going to axis 1 and axis2.

You should try different variations of true/false as I am like 90% sure that is your problem.

The reasons you see different numbers being output to your motors than the values that are sent into the subvi is because the arcadedrive vi squares your inputs to allow for a smoother control.

indubitably is correct. One of your motors is running backwards. You can fix that by either swapping the wires or by changing its “invert” constant on the Open Drive in Begin.

Put the robot up on blocks. Push the joystick forward. Observe which motor is doing the wrong thing. Fix it to do the right thing.

(If you then find that the robot is turning the wrong direction when you push the joystick sideways, that would be because you have the left and right motors swapped. Fix that in the Begin vi as well, by changing the left and right motor PWM definitions.)

when you say swap wires you are talking on the physical robot or in the code?

When you say invert in the OPEN drive it is swapping the true false statement?

Then finally it is changing to reverse the PMW1 address to PMW2 and vise versa in the Drive.vi?

Sorry to be tedious but I want to be sure. Thanks for the assistance by the way

@Coach#3536:

You can physically swap the wires going to the motor which is going in the wrong direction, or

you can reverse the motor direction in software by setting the appropriate “motor inverted” input to True or False in the “Drive Open Motor” vi.

you can swap left and right (or front and rear for that matter) motors by changing the PWM channels.

see attached screenshot.

**





As I stated before…“the WPI_JoystickGet.vi it appears that the for/aft movement is being sent into the wrong output to the motors.”

When I switched them in this area the control issue was corrected. Thanks for the input to get me to the correct spot.

We have the same problem (x and y axis inverted). How do you fix it if we are using C++ ?

thank you

Gmzcarlos, you’ll need to post the parts of your code that affect drive so we can help you.

We are using the “SimpleRobot” template Code.

When in Autonomous, the robot just spins and in teleoperated the x and y axis are inverted.

Let me know if you need additional information.

  • UPDATE -

    We got it, just needed to revert the polarity of one the engines, and its now working.