mirror of
https://github.com/Team4388/Shirt-Cannon.git
synced 2026-06-09 00:28:01 -06:00
Manual impementation of drive
This commit is contained in:
@@ -62,7 +62,7 @@ public class RobotContainer {
|
||||
|
||||
/* Default Commands */
|
||||
// drives the robot with a two-axis input from the driver controller
|
||||
m_robotDrive.setDefaultCommand(new RunCommand(() -> m_robotDrive.arcadeDrive(getController().getLeftY(), getController().getRightX()), m_robotDrive));
|
||||
m_robotDrive.setDefaultCommand(new RunCommand(() -> m_robotDrive.hotwireDrive(getController().getLeftY(), getController().getRightX()), m_robotDrive));
|
||||
// m_robotDrive.setDefaultCommand(new RunCommand(() -> m_robotDrive.tankDrive(getController().getLeftY(), getController().getLeftY()), m_robotDrive));
|
||||
}
|
||||
|
||||
|
||||
@@ -31,6 +31,26 @@ public class Drive extends SubsystemBase {
|
||||
|
||||
}
|
||||
|
||||
public void hotwireDrive(double xStick, double yStick) {
|
||||
// deadzone constraints
|
||||
double deadzone = 0.1d;
|
||||
|
||||
if (xStick <= (0.5+deadzone) && xStick >= (0.5-deadzone)) {xStick = 0.5d;}
|
||||
if (yStick <= (0.5+deadzone) && yStick >= (0.5-deadzone)) {yStick = 0.5d;}
|
||||
|
||||
// if stick forword, drive both motors forward
|
||||
double leftSpeed = -2 * (yStick - 0.5d);
|
||||
double rightSpeed = -2 * (yStick - 0.5d);
|
||||
|
||||
// if stick right turn right
|
||||
leftSpeed -= 2 * (xStick - 0.5d);
|
||||
rightSpeed += 2 * (xStick - 0.5d);
|
||||
|
||||
//set the motors
|
||||
m_leftMotor.set(-leftSpeed);
|
||||
m_rightMotor.set(rightspeed);
|
||||
}
|
||||
|
||||
public void tankDrive(double leftSpeed, double rightSpeed) {
|
||||
m_leftMotor.set(leftSpeed);
|
||||
m_rightMotor.set(rightSpeed);
|
||||
|
||||
Reference in New Issue
Block a user