Go to Post I'm pretty sure Andrew Baker and Andy Baker are the same person. Then again, Andy may just be holding out on us. - Amanda Morrison [more]
Home
Go Back   Chief Delphi > Technical > Programming > Java
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Spotlight this post!  
Unread 14-11-2013, 09:53
Matt_4505 Matt_4505 is offline
Registered User
FRC #4505
Team Role: Programmer
 
Join Date: Nov 2012
Rookie Year: 2012
Location: United States
Posts: 16
Matt_4505 is on a distinguished road
Tank Drive Issues

Hello,
This year I have been switching my team over to Java and we have started to work with a Command Based control system. I built my drivetrain in RobotBuilder and then added code for the Tank Drive. Unfortunately, when I try to run the code, the left Joystick controls both sides of the robot instead of just the left side.

The Code:

DriveTrain subsystem:

public void tankDrive(double leftJoystickValue, double rightJoystickValue){
robotDrive.tankDrive(leftJoystickValue, rightJoystickValue);
}
public double deadZone (double val) {
return val > 0.25 || val < -0.25? val: 0;
}
public double adjustSpeed (double val){
return Robot.oi.leftJoystick.getRawButton(1)? val*.75: (Robot.oi.rightJoystick.getRawButton(1)? val*.75: val);

}


DriveCommand:

protected void execute() {
Robot.drivetrain.tankDrive(Robot.drivetrain.adjust Speed(Robot.drivetrain.deadZone(Robot.oi.getleftJo ystick().getY())),
Robot.drivetrain.adjustSpeed(Robot.drivetrain.dead Zone(Robot.oi.getrightJoystick().getY())));
}


Thanks
Reply With Quote
 


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


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

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


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