View Single Post
  #6   Spotlight this post!  
Unread 17-09-2013, 12:43
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
Re: Coasting Problems

Quote:
Originally Posted by BigJ View Post
Can you elaborate more by what you mean by this:



To me that sounds like you're trying to set a deadzone, but I'm not sure.
Yep, that code is to set a deadzone, although since I have to keep increasing it's size, I'm losing a lot of mobility.

It might be an issue with zeroing the motor controllers, although, it works fine with Labview.

Heres the code:

public class DriveControl {
double leftJoystickValue = 0;
double rightJoystickValue = 0;

/**
* Controls the Joystick Read-in.
* Reads the joystick values and directs values to the motors.
*/
public void driveRobot() {

if(Math.abs(Hardware.leftJoystick.getY()) > .25){
leftJoystickValue = Hardware.leftJoystick.getY();
}
if(Math.abs(Hardware.rightJoystick.getY()) > .25){
rightJoystickValue = Hardware.rightJoystick.getY();
}

SmartDashboard.putNumber("leftJoystickValue", leftJoystickValue);
SmartDashboard.putNumber("righttJoystickValue", rightJoystickValue);

//decrease values by 3/4 for each trigger pressed
if (Hardware.leftJoystick.getRawButton(1)) {
leftJoystickValue = leftJoystickValue * (.75);
rightJoystickValue = leftJoystickValue * (.75);
}
SmartDashboard.putBoolean("leftJoystickTrigger Pressed", Hardware.leftJoystick.getRawButton(1));
//reduces values even more
if (Hardware.rightJoystick.getRawButton(1)) {
leftJoystickValue = leftJoystickValue * (.75);
rightJoystickValue = leftJoystickValue * (.75);
}
SmartDashboard.putBoolean("rigbhtJoystickTrigger Pressed", Hardware.rightJoystick.getRawButton(1)); //sends signal to bot with the adjusted drive values

Hardware.chassis.tankDrive(leftJoystickValue, rightJoystickValue);
}
Reply With Quote