mirror of
https://github.com/Team4388/RiseOfRidgebotics2020.git
synced 2026-06-09 00:38:00 -06:00
boilerplate for new BarrelEnd, TankDrive testing
Co-Authored-By: Nirvan Bhalala <78400306+nbhalala27@users.noreply.github.com>
This commit is contained in:
@@ -184,8 +184,11 @@ public class RobotContainer {
|
|||||||
private void configureButtonBindings() {
|
private void configureButtonBindings() {
|
||||||
/* Test Buttons */
|
/* Test Buttons */
|
||||||
// A driver test button
|
// A driver test button
|
||||||
|
// new JoystickButton(getDriverJoystick(), XboxController.A_BUTTON)
|
||||||
|
// .whenPressed(new DriveStraightAtVelocityPID(m_robotDrive, 1000));
|
||||||
|
|
||||||
new JoystickButton(getDriverJoystick(), XboxController.A_BUTTON)
|
new JoystickButton(getDriverJoystick(), XboxController.A_BUTTON)
|
||||||
.whenPressed(new DriveStraightAtVelocityPID(m_robotDrive, 1000));
|
.whileHeld(new RunCommand(() -> m_robotDrive.tankDriveVelocity(6000, 6000), m_robotDrive));
|
||||||
|
|
||||||
// B driver test button
|
// B driver test button
|
||||||
new JoystickButton(getDriverJoystick(), XboxController.B_BUTTON)
|
new JoystickButton(getDriverJoystick(), XboxController.B_BUTTON)
|
||||||
|
|||||||
@@ -0,0 +1,40 @@
|
|||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* Copyright (c) 2019 FIRST. All Rights Reserved. */
|
||||||
|
/* Open Source Software - may be modified and shared by FRC teams. The code */
|
||||||
|
/* must be accompanied by the FIRST BSD license file in the root directory of */
|
||||||
|
/* the project. */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
package frc4388.robot.commands.auto;
|
||||||
|
|
||||||
|
import edu.wpi.first.wpilibj2.command.CommandBase;
|
||||||
|
|
||||||
|
public class BarrelEnd extends CommandBase {
|
||||||
|
/**
|
||||||
|
* Creates a new BarrelEnd.
|
||||||
|
*/
|
||||||
|
public BarrelEnd() {
|
||||||
|
// Use addRequirements() here to declare subsystem dependencies.
|
||||||
|
}
|
||||||
|
|
||||||
|
// Called when the command is initially scheduled.
|
||||||
|
@Override
|
||||||
|
public void initialize() {
|
||||||
|
}
|
||||||
|
|
||||||
|
// Called every time the scheduler runs while the command is scheduled.
|
||||||
|
@Override
|
||||||
|
public void execute() {
|
||||||
|
}
|
||||||
|
|
||||||
|
// Called once the command ends or is interrupted.
|
||||||
|
@Override
|
||||||
|
public void end(boolean interrupted) {
|
||||||
|
}
|
||||||
|
|
||||||
|
// Returns true when the command should end.
|
||||||
|
@Override
|
||||||
|
public boolean isFinished() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -454,13 +454,18 @@ public class Drive extends SubsystemBase {
|
|||||||
// m_currentAngleYaw+(360));
|
// m_currentAngleYaw+(360));
|
||||||
// double targetGyro = (m_kinematicsTargetAngle / 360) *
|
// double targetGyro = (m_kinematicsTargetAngle / 360) *
|
||||||
// DriveConstants.TICKS_PER_GYRO_REV;
|
// DriveConstants.TICKS_PER_GYRO_REV;
|
||||||
double moveVelLeft = inchesToTicks(metersToInches(leftSpeed)) / DriveConstants.SECONDS_TO_TICK_TIME;
|
|
||||||
double moveVelRight = inchesToTicks(metersToInches(rightSpeed)) / DriveConstants.SECONDS_TO_TICK_TIME;
|
//double moveVelLeft = inchesToTicks(metersToInches(leftSpeed)) / DriveConstants.SECONDS_TO_TICK_TIME;
|
||||||
|
//double moveVelRight = inchesToTicks(metersToInches(rightSpeed)) / DriveConstants.SECONDS_TO_TICK_TIME;
|
||||||
|
|
||||||
// SmartDashboard.putNumber("Move Vel Left", moveVelLeft);
|
double moveVelLeft = leftSpeed;
|
||||||
|
double moveVelRight = rightSpeed;
|
||||||
|
|
||||||
|
// SmartDashboard.putNumber("Move Vel Left", moveVelLeft)
|
||||||
// SmartDashboard.putNumber("Move Vel Right", moveVelRight);
|
// SmartDashboard.putNumber("Move Vel Right", moveVelRight);
|
||||||
|
|
||||||
// runDriveVelocityPID(moveVel*2, targetGyro);
|
// runDriveVelocityPID(moveVel*2, targetGyro);
|
||||||
|
|
||||||
|
|
||||||
m_rightBackMotor.selectProfileSlot(DriveConstants.SLOT_VELOCITY, DriveConstants.PID_PRIMARY);
|
m_rightBackMotor.selectProfileSlot(DriveConstants.SLOT_VELOCITY, DriveConstants.PID_PRIMARY);
|
||||||
m_leftBackMotor.selectProfileSlot(DriveConstants.SLOT_VELOCITY, DriveConstants.PID_PRIMARY);
|
m_leftBackMotor.selectProfileSlot(DriveConstants.SLOT_VELOCITY, DriveConstants.PID_PRIMARY);
|
||||||
@@ -470,6 +475,8 @@ public class Drive extends SubsystemBase {
|
|||||||
m_leftFrontMotor.follow(m_leftBackMotor);
|
m_leftFrontMotor.follow(m_leftBackMotor);
|
||||||
m_rightFrontMotor.follow(m_rightBackMotor);
|
m_rightFrontMotor.follow(m_rightBackMotor);
|
||||||
|
|
||||||
|
SmartDashboard.putNumber("TankDrive Speed", inchesToMeters(getVelocityInchesPerSecond(m_rightBackMotor)));
|
||||||
|
|
||||||
m_driveTrain.feedWatchdog();
|
m_driveTrain.feedWatchdog();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user