From 7b58370a6d4174f2e007264c58bebe7868e7fdc3 Mon Sep 17 00:00:00 2001 From: kartofen Date: Sun, 11 Feb 2024 22:48:38 +0200 Subject: imu added --- src/main/java/frc/robot/Constants.java | 35 +++++++++++++++------------------- 1 file changed, 15 insertions(+), 20 deletions(-) (limited to 'src/main/java/frc/robot/Constants.java') diff --git a/src/main/java/frc/robot/Constants.java b/src/main/java/frc/robot/Constants.java index f517f08..41c9689 100644 --- a/src/main/java/frc/robot/Constants.java +++ b/src/main/java/frc/robot/Constants.java @@ -1,37 +1,32 @@ package frc.robot; -import edu.wpi.first.math.controller.SimpleMotorFeedforward; -import edu.wpi.first.wpilibj.AnalogGyro; +import com.revrobotics.CANSparkMax; +import com.revrobotics.CANSparkLowLevel.MotorType; + import edu.wpi.first.wpilibj.Encoder; -import edu.wpi.first.wpilibj.drive.DifferentialDrive; -import edu.wpi.first.wpilibj.motorcontrol.PWMSparkMax; +import edu.wpi.first.wpilibj.I2C; +import edu.wpi.first.wpilibj.I2C.Port; +import frc.robot.util.IMUGyro; public class Constants { - // other constants - public static final int PortDriverController = 0; - public static final double DriveMaxSpeed = 0; - public static final double DriveMaxAngular = 0; + public static final double DriveMaxSpeed = 20; // m/s + public static final double DriveMaxAngular = Math.PI; // rad/s? public static final double WheelRadius = 0; // in meters public static final double TrackWidth = 0; // in meters public static final double EncoderResolution = 4096; - - // public static final DifferentialDrive drive = new DifferentialDrive(...); - public static final AnalogGyro gyro = new AnalogGyro(...); - - public static final PWMSparkMax motorL_leader = new PWMSparkMax(...); - public static final PWMSparkMax motorL_follower = new PWMSparkMax(...); - public static final PWMSparkMax motorR_leader = new PWMSparkMax(...); - public static final PWMSparkMax motorR_follower = new PWMSparkMax(...); - + public static final IMUGyro gyro = new IMUGyro(new I2C(Port.kOnboard, 0x68)); - public static final Encoder encoderL = new Encoder(...); - public static final Encoder encoderR = new Encoder(...); + public static final CANSparkMax motorL_leader = new CANSparkMax(40, MotorType.kBrushed); + public static final CANSparkMax motorL_follower = new CANSparkMax(41, MotorType.kBrushed); + public static final CANSparkMax motorR_leader = new CANSparkMax(42, MotorType.kBrushed); + public static final CANSparkMax motorR_follower = new CANSparkMax(43, MotorType.kBrushed); - public static final SimpleMotorFeedforward feedforward = new SimpleMotorFeedforward(...); + public static final Encoder encoderL = new Encoder(0, 1); + public static final Encoder encoderR = new Encoder(2, 3); } -- cgit v1.2.3