Intake Claw using Victor SPX


#1

So I’m coding the claw intake for my team’s robot which is the Greyt Roller Claw with the two motors. However, we’re using Victor SPX for those two motors and we’re going to use the triggers in the Xbox 360 controllers (right trigger to intake and left trigger for dispense). I’m a beginner in Java and this is new territory for me. Although I already made the subsystem for the Victor SPX and the motors and command for it. Could someone help me?

Also, where my OI.java and Robot.java.


#2

I would suggest looking at the Joystick screenstep slide and doing something similar to what’s in our code here:

https://wpilib.screenstepslive.com/s/currentCS/m/java/l/599723-joysticks
https://github.com/BREAD5940/frc-java-command-codebase/blob/master/src/main/java/frc/robot/subsystems/Intake.java#L96 (to set motor to a power)

I know it’s a little complicated and mixed in with a million other things, but hmu if you have questions and I’ll try to help.


#3

Woah, this is very confusing. So you have the pistons and the intake motors in one subsystem? Also, do I just focus on this portion?

private Intake(int cargoPort, int hatchPort) {
cargoTalon = new WPI_TalonSRX(cargoPort);
hatchTalon = new WPI_TalonSRX(hatchPort);
// talon.configOpenloopRamp(0.15);
// talon.configContinuousCurrentLimit(30);
// talon.configPeakCurrentLimit(40);
// talon.enableCurrentLimit(true);
// talon.setName(“Intake”);
cargoTalon.configPeakOutputForward(.4);
cargoTalon.configPeakOutputReverse(-.4);
}

private Intake() {
	this(35, 34);
}

/**
 * Set the cargo intake speed as a percent vbus
 * @param speed
 */
public void setCargoSpeed(double speed) {
	cargoTalon.set(ControlMode.PercentOutput, speed);
	SmartDashboard.putNumber("Cargo speed setpoint", speed);
}

/**
 * Set the cargo intake speed as a percent vbus
 * @param speed
 */
public void setHatchSpeed(double speed) {
	hatchTalon.set(ControlMode.PercentOutput, speed);
	SmartDashboard.putNumber("Hatch speed setpoint", speed);
}

public void setSpeed(double hatch, double cargo) {
	setCargoSpeed(cargo);
	setHatchSpeed(hatch);
}

public void stop() {
	setCargoSpeed(0);
	setHatchSpeed(0);
}

@Override
public void periodic() {
	// setSpeed(Robot.m_oi.getIntakeSpeed());
	// System.out.println("speed " + Robot.m_oi.getIntakeSpeed());
}

@Override
public void initDefaultCommand() {
	// Set the default command for a subsystem here.
	setDefaultCommand(new IntakeTelop());
}

}


#4

Just focus on the hatchTalon and cargoTalon calls - those are the two different rollers that we use, sometimes together and sometimes one at a time.