Log in

View Full Version : switching the x & y on joy stick


/*P4bl0*/
21-02-2010, 12:36
hello i been trying to get the holonomicDrive working right for some time now i just want to get the joy stick to switch its x & y input and i cant get in to the joystick source code and change it plz some one help me :confused:

Bryan Herbst
21-02-2010, 12:50
Can't you just reverse how you are implementing the axes in your code?

For example, if you are setting variable "velocity" to the y-axis, just set it to the x axis instead.

Alternatively, you could create new variables such as "newX" and set the actual y-axis to newX.

/*P4bl0*/
21-02-2010, 13:18
ok i may be saying some thing wrong or i dont get what your saying (this is my first year mostly alone on getting this to work) ok i have this

m_robotDrive.holonomicDrive(m_rightStick.getMagnit ude(), m_rightStick.getDirectionDegrees(), m_leftStick.getX());

in the code and its the only places i have the joystick input i dont want to change the left stick at all i tried swiching m_rightStick.getMagnitude() and m_rightStick.getDirectionDegrees() but it goes hay wire and i did not change anything else.

were using mecanum wheels and i have them on inputs of

front
4 2
1 3
back

some how it works but i just have the x and y mest up ..
i might be giving random info and not making any scenes :confused:

Bryan Herbst
21-02-2010, 13:45
I haven't looked at the default holonomic code this year, but from that code it looks as though the holonomic drive function is expecting you to use a 3-axis joystick.
m_rightStick.getMagnitude() would be the y-direction
m_rightStick.getDirectionDegrees() would be the "twist" of the joystick
m_leftStick.getX() would, of course, be the x direction.

Are you using a 3-joystick set up? If not, then you will need to use a different holonomic drive method. If so, then all you should have to do is switch getMagnitute() and getX(). Thus the line would read-

m_robotDrive.holonomicDrive(m_leftStick.getX(), m_rightStick.getDirectionDegrees(), m_rightStick.getMagnitude());

/*P4bl0*/
21-02-2010, 13:58
no were using 2 logtech atk 3 joysticks witch you cant twist the joystick and changing

m_rightStick.getMagnitude()
to
m_rightStick.getX()

just disable are y axis from the right joy stick

/*P4bl0*/
21-02-2010, 13:59
sorry i read the code wrong i did not see you switch something else

Bryan Herbst
21-02-2010, 14:20
Well since you do not have a 3-axis joystick you need to send something other than m_rightStick.getDirectionDegrees().

And wow, sorry, I just realized that you already have two different joysticks there. My bad! In any case, they still wont be able to give you a degree measurement.

Is the second parameter just a float (does getDirectionDegrees() return an int from 0 to 360 or a float from -1 to 1)? If so, I would replace m_rightStick.getDirectionDegrees() with m_rightStick.getX()