I was trying to work around that using
Code:
double m_y = m_driveStick.getY();
double m_x = m_driveStick.getX();
if (m_y >= 0) //the Y axis is inverted, so going forward is negative number
m_x = 0-m_x; //inverting X value
m_robotDrive.arcadeDrive(m_y, m_x);
The problem I faced with that was that the joystick wasn't giving me a perfect 0.. I added a simple println statement to get the y values, and it ranged anywhere from -0.3 to 0.3...
Ether, it looks like your solution
Quote:
|
if(Yj<=0){L=-Yj+Xj; R=-Yj-Xj;}
|
would have the same problem.
I tried something like if m_y >= -0.3, but it results in motors rapidly switching directions if starting slowly..
Another possible solution would be treating anything within .2 or so from the axis as 0.. but it doesn't seem like the best way of doing it either.
Thanks in advance,
j.