Skip to content
698ben edited this page Mar 16, 2020 · 13 revisions

Overview

The intake is in charge of taking in balls from the ground storing them.

Theory

The intake has three neo 550s controlled by 3 spark maxes

line by line

Let's go through a line by line explanation of Intake.java

package frc.robot.subsystems;

import com.ctre.phoenix.motorcontrol.TalonFXControlMode;
import com.ctre.phoenix.motorcontrol.can.TalonFX;

import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard;
import edu.wpi.first.wpilibj2.command.SubsystemBase;
import frc.robot.Constants;

import com.revrobotics.CANEncoder;
import com.revrobotics.CANSparkMax;
import com.revrobotics.EncoderType;
import com.revrobotics.CANSparkMaxLowLevel.MotorType;

Again there is nothing really important in the imports. Just importing the libraries for the spark maxes that we are using

  private static Constants consts = new Constants();
  public static CANSparkMax intake = new CANSparkMax(consts.intake, MotorType.kBrushless);
  public static CANSparkMax serializer2 = new CANSparkMax(consts.serializer2, MotorType.kBrushless);
  public static CANSparkMax serializer1 = new CANSparkMax(consts.serializer1, MotorType.kBrushless);

And again we have to define the motor controllers that make up the intake. Again not using static numbers like 4 but pulling numbers from constants.Java

public void retrieveBall(double speed)
  {
    intake.set(speed);
  }

This method just takes in a speed and sets the intake motor to that speed to intake balls.

public void outtakeBall(double speed)
  {
    intake.set(-speed);
  }

This one is the same but sets it to negative speed to out take balls

public void upserializer1(double speed)
  {
    serializer1.set(-speed);
  }

  public void upserializer2(double speed)
  {
    serializer2.set(-speed);
  }

  public void downserializer1(double speed)
  {
    serializer1.set(speed);
  }

  public void downserializer2(double speed)
  {
    serializer2.set(speed);
  }

These four are just like the last two but for the serializer motors.

Shooter >

Clone this wiki locally