Hi everyone, I once again apologize for the probably simple question, however I couldn’t find any related resources online.
My team and I utilize Thrustmaster T.16000M JoySticks to control our Robot with Tank Drive.
With this, we obviously have button bindings for our shooter, intake, so on and so forth.
I was wondering if there was a specific way I could adjust the speed of the intake (live) with the sliders provided on the JoyStick. As I understand with some preliminary research the sliders are considered an axis. I know I have to fetch that number as a double but I’m unsure how to make it pass through and control the motor speed live.
Intake Command
public class IntakeManipulator extends CommandBase {
private final Intake intake;
public IntakeManipulator(Intake intake) {
this.intake = intake;
// each subsystem used by the command must be passed into the
// addRequirements() method (which takes a vararg of Subsystem)
addRequirements(this.intake);
}
/**
* The initial subroutine of a command. Called once when the command is initially scheduled.
*/
@Override
public void initialize() {
}
@Override
public void execute() {
SmartDashboard.putString("Intake Enabled", "yes");
intake.intakeBalls();
}
@Override
public boolean isFinished() {
// TODO: Make this return true when this Command no longer needs to run execute()
return false;
}
@Override
public void end(boolean interrupted) {
SmartDashboard.putString("Intake Enabled", "no");
intake.stopMotor();
}
}
Intake Subsystem
public class Intake extends SubsystemBase {
private final VictorSPX intake_motor;
public Intake() {
intake_motor = new VictorSPX(Constants.INTAKE_MOTOR_PORT);
intake_motor.clearStickyFaults();
intake_motor.setInverted(InvertType.None);
intake_motor.configFactoryDefault();
}
public synchronized void intakeBalls() {
intake_motor.set(ControlMode.PercentOutput, 1);
}
public synchronized void stopMotor() {
intake_motor.set(ControlMode.PercentOutput, 0);
}
@Override
public void periodic() {
// This method will be called once per scheduler run
}
@Override
public void simulationPeriodic() {
// This method will be called once per scheduler run during simulation
}
}
Initiation of command
putBallsIn.whileHeld(new IntakeManipulator(intake));
So with that I’m not exactly sure how to pass the data to the joystick all the way through to the place were the motor speed is set, and live.
Any help would be appreicated.