View Single Post
  #2   Spotlight this post!  
Unread 07-02-2016, 19:22
minutebot minutebot is offline
Programming Captain
FRC #4536 (The Minutebots)
Team Role: Programmer
 
Join Date: Mar 2014
Rookie Year: 2014
Location: Saint Paul, Minnesota
Posts: 26
minutebot is a glorious beacon of lightminutebot is a glorious beacon of lightminutebot is a glorious beacon of lightminutebot is a glorious beacon of lightminutebot is a glorious beacon of light
Re: RobotDrive with left joystick only? (XboxController)

I'm not familiar with RobotDrive. We always set up our drive from scratch by making a DriveTrain subsystem (command base) or class (iterative).

It uses however many motor controllers your team uses which in our case is 4.

Here's some sample code:

public void arcadeDrive(double forwardThrottle, double turnThrottle) {
double leftVictorSPThrottle = forwardThrottle + turnThrottle;
double rightVictorSPThrottle = -forwardThrottle + turnThrottle;

leftBackVictorSP.set(leftVictorSPThrottle);
leftFrontVictorSP.set(leftVictorSPThrottle);
rightBackVictorSP.set(rightVictorSPThrottle);
rightFrontVictorSP.set(rightVictorSPThrottle);

}

You set motor values from the drive train methods. To receive input you use an XBox controller or joystick like you did and you can use the Joystick.getY() method to use the y axis for forward throttle and Joystick.get() method to use the x axis for turning throttle.

Here's a link to the 2016 WPILIB API which has all the classes like joystick and the thing they can do (methods).

http://first.wpi.edu/FRC/roborio/release/docs/java/
Reply With Quote