Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Java (http://www.chiefdelphi.com/forums/forumdisplay.php?f=184)
-   -   switching the x & y on joy stick (http://www.chiefdelphi.com/forums/showthread.php?t=83270)

/*P4bl0*/ 02-21-2010 12:36 PM

switching the x & y on joy stick
 
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 02-21-2010 12:50 PM

Re: switching the x & y on joy stick
 
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*/ 02-21-2010 01:18 PM

Re: switching the x & y on joy stick
 
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 02-21-2010 01:45 PM

Re: switching the x & y on joy stick
 
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*/ 02-21-2010 01:58 PM

Re: switching the x & y on joy stick
 
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*/ 02-21-2010 01:59 PM

Re: switching the x & y on joy stick
 
sorry i read the code wrong i did not see you switch something else

Bryan Herbst 02-21-2010 02:20 PM

Re: switching the x & y on joy stick
 
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()


All times are GMT -5. The time now is 09:02 AM.

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