View Single Post
  #2   Spotlight this post!  
Unread 16-02-2015, 13:34
JacobD's Avatar
JacobD JacobD is offline
Registered User
AKA: Jacob
FRC #1672 (Mahwah Robo T-Birds)
Team Role: Leadership
 
Join Date: Jan 2015
Rookie Year: 2013
Location: New Jersey
Posts: 91
JacobD is an unknown quantity at this point
Re: Turning with the right trigger?

I'm assuming that the z-axis on your controller doesn't exist and that is why you want the triggers to rotate. So, here you go.

Code:
public final int rightTrigger = 4;
public final int leftTrigger = 5;
int rotationDirection;

if(stick.getRawButton(rightTrigger)) {
	rotationDirection=1;
}
if(stick.getRawButton(leftTrigger)) {
	rotationDirection=-1;
else{
	rotationDirection=0;
}

robotDrive.mecanumDrive_Cartesian(-stick.getY(), -stick.getX(), rotationDirection, 1);
This will make it so that your robot rotates when you push the triggers but removes any functionality of the z-axis. I'm not sure if this is what you wanted. Also, just change around the button numbers for the triggers.

Btw, you wouldn't have to invert the Y and X axis if you put the ports in as 0-3 -- frontleft, rearLeft, frontRight, rearRight

Just found this:
https://github.com/FRC3571/2015/blob...ontroller.java
It might help but thank Team 3571.

Last edited by JacobD : 16-02-2015 at 13:38.
Reply With Quote