Skip to content

Commit

Permalink
Neo config
Browse files Browse the repository at this point in the history
  • Loading branch information
cherriae committed Jan 20, 2024
1 parent cac4f32 commit 54dc0e3
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 3 deletions.
23 changes: 23 additions & 0 deletions src/main/java/frc/robot/subsystems/IntakeSubsystem.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
// Copyright (c) FIRST and other WPILib contributors.
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.

package frc.robot.subsystems;

import edu.wpi.first.math.controller.PIDController;
import edu.wpi.first.wpilibj2.command.SubsystemBase;
import frc.robot.Constants;

import com.revrobotics.CANSparkMax;
import com.revrobotics.RelativeEncoder;
import com.revrobotics.CANSparkLowLevel.MotorType;

public class IntakeSubsystem extends SubsystemBase {
/** Creates a new IntakeSubsystem. */
public IntakeSubsystem() {}

@Override
public void periodic() {
// This method will be called once per scheduler run
}
}
24 changes: 24 additions & 0 deletions src/main/java/frc/robot/utils/NeoConfig.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package frc.robot.utils;

import com.revrobotics.CANSparkMax;
import com.revrobotics.CANSparkBase.IdleMode;
import com.revrobotics.CANSparkBase.SoftLimitDirection;


/**
* @author Ze Rui Zheng
* @author Elvis Osmanov
*/
public class NeoConfig {
public static void configureNeo(CANSparkMax neo, boolean invert) {

neo.setIdleMode(IdleMode.kCoast);
neo.enableSoftLimit(SoftLimitDirection.kForward, false);
neo.enableSoftLimit(SoftLimitDirection.kReverse, false);
neo.setInverted(invert);
}
public static void configureFollowerNeo(CANSparkMax neo, CANSparkMax master, boolean opposeMaster) {
configureNeo(neo, false);
neo.follow(master);
}
}
4 changes: 1 addition & 3 deletions src/main/java/frc/robot/utils/TalonFXConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@ public static TalonFXConfiguration configureFalcon(TalonFX falcon, boolean inver
TalonFXConfiguration config = new TalonFXConfiguration();

falcon.getConfigurator().DefaultTimeoutSeconds = Constants.CAN.CAN_TIMEOUT;
// falcon.getConfigurator().apply(config); // FACTORY RESET

falcon.getConfigurator().refresh(config);

config.MotorOutput.DutyCycleNeutralDeadband = 0.01;
Expand All @@ -54,7 +52,7 @@ public static TalonFXConfiguration configureFalcon(TalonFX falcon, boolean inver
* @param master - The master motor.
* @param opposeMaster - Boolean for whether the follower motor inverted to the master.
*/
public static void configureDriveFollowerFalcon(
public static void configureFollowerFalcon(
TalonFX falcon, TalonFX master, boolean opposeMaster) {
configureFalcon(falcon, false);
falcon.setControl(new Follower(master.getDeviceID(), opposeMaster));
Expand Down

0 comments on commit 54dc0e3

Please sign in to comment.