Quote:
|
Originally Posted by bglass
I have been working with the user_routine.c file quite a bit lately, and my first task was to combine our two motors onto one joystick. The code we used was successful, but we believe that our axes are defined wrong. When we push the control forward, our robot turns left. When we push it right, it goes forward, etc. In short, our code must define forward and backward is as the x-axis, and lateral control as the y-axis. Though this could simply be solved by turning our joystick 90 degrees, we would rather solve the problem through our code.
|
It sounds like one of your drive motors is running backwards from the way your code intends. That can be solved by subtracting the pwm value from 254 before outputting it, but it is more appropriate to reverse the connections to the motor from the victor, so that "plus" always equals "forward". (You might also have left and right swapped; you can figure that out later.)
On the other hand, maybe you do have your axes confused. The x axis is left-right joystick motion, and the y axis is forward-backward joystick motion. Swap x and y in your code if you've assumed otherwise.