Skip to content

Commit

Permalink
Rename Drive to SwerveDrive (#138)
Browse files Browse the repository at this point in the history
  • Loading branch information
rcahoon authored Sep 21, 2024
1 parent 57cd027 commit f7e0feb
Show file tree
Hide file tree
Showing 9 changed files with 28 additions and 28 deletions.
6 changes: 3 additions & 3 deletions src/main/java/com/team766/robot/common/DriverOI.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@
import com.team766.hal.JoystickReader;
import com.team766.robot.common.constants.ControlConstants;
import com.team766.robot.common.constants.InputConstants;
import com.team766.robot.common.mechanisms.Drive;
import com.team766.robot.common.mechanisms.SwerveDrive;

public class DriverOI extends OIFragment {

protected static final double FINE_DRIVING_COEFFICIENT = 0.25;

protected final Drive drive;
protected final SwerveDrive drive;
protected final JoystickReader leftJoystick;
protected final JoystickReader rightJoystick;
protected double rightJoystickY = 0;
Expand All @@ -21,7 +21,7 @@ public class DriverOI extends OIFragment {

private final OICondition movingJoysticks;

public DriverOI(Drive drive, JoystickReader leftJoystick, JoystickReader rightJoystick) {
public DriverOI(SwerveDrive drive, JoystickReader leftJoystick, JoystickReader rightJoystick) {
this.drive = drive;
this.leftJoystick = leftJoystick;
this.rightJoystick = rightJoystick;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
import java.util.Optional;
import org.apache.commons.math3.geometry.euclidean.twod.Vector2D;

public class Drive extends Mechanism {
public class SwerveDrive extends Mechanism {

private final SwerveConfig config;

Expand Down Expand Up @@ -58,7 +58,7 @@ public class Drive extends Mechanism {
private double x;
private double y;

public Drive(SwerveConfig config) {
public SwerveDrive(SwerveConfig config) {
loggerCategory = Category.DRIVE;

this.config = config;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import com.team766.framework.Context;
import com.team766.framework.Procedure;
import com.team766.robot.common.constants.PathPlannerConstants;
import com.team766.robot.common.mechanisms.Drive;
import com.team766.robot.common.mechanisms.SwerveDrive;
import edu.wpi.first.math.geometry.Pose2d;
import edu.wpi.first.math.kinematics.ChassisSpeeds;
import edu.wpi.first.wpilibj.DriverStation;
Expand All @@ -16,7 +16,7 @@
import java.util.Optional;

public class FollowPath extends Procedure {
private final Drive drive;
private final SwerveDrive drive;
private PathPlannerPath path; // may be flipped
private final ReplanningConfig replanningConfig;
private final PPHolonomicDriveController controller;
Expand All @@ -27,14 +27,14 @@ public FollowPath(
PathPlannerPath path,
ReplanningConfig replanningConfig,
PPHolonomicDriveController controller,
Drive drive) {
SwerveDrive drive) {
this.path = path;
this.replanningConfig = replanningConfig;
this.controller = controller;
this.drive = drive;
}

public FollowPath(String autoName, PPHolonomicDriveController controller, Drive drive) {
public FollowPath(String autoName, PPHolonomicDriveController controller, SwerveDrive drive) {
this(
PathPlannerPath.fromPathFile(autoName),
PathPlannerConstants.REPLANNING_CONFIG,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import com.team766.framework.RunnableWithContext;
import com.team766.robot.common.constants.ConfigConstants;
import com.team766.robot.common.constants.PathPlannerConstants;
import com.team766.robot.common.mechanisms.Drive;
import com.team766.robot.common.mechanisms.SwerveDrive;
import com.team766.robot.reva.Robot;
import com.team766.robot.reva.VisionUtil.VisionSpeakerHelper;
import com.team766.robot.reva.procedures.MoveClimbersToBottom;
Expand All @@ -22,7 +22,7 @@
public class PathSequenceAuto extends Procedure {

private final LinkedList<RunnableWithContext> pathItems;
private final Drive drive;
private final SwerveDrive drive;
private final Pose2d initialPosition;
private final PPHolonomicDriveController controller;
private VisionSpeakerHelper visionSpeakerHelper;
Expand All @@ -32,15 +32,15 @@ public class PathSequenceAuto extends Procedure {
* @param drive The instantiation of drive for the robot (pass in Robot.drive)
* @param initialPosition Starting position on Blue Alliance in meters (gets flipped when on red)
*/
public PathSequenceAuto(Drive drive, Pose2d initialPosition) {
public PathSequenceAuto(SwerveDrive drive, Pose2d initialPosition) {
pathItems = new LinkedList<RunnableWithContext>();
this.drive = drive;
this.controller = createDriveController(drive);
this.initialPosition = initialPosition;
visionSpeakerHelper = new VisionSpeakerHelper(drive);
}

private PPHolonomicDriveController createDriveController(Drive drive) {
private PPHolonomicDriveController createDriveController(SwerveDrive drive) {
double maxSpeed =
ConfigFileReader.getInstance()
.getDouble(ConfigConstants.PATH_FOLLOWING_MAX_MODULE_SPEED_MPS)
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/com/team766/robot/gatorade/Robot.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import com.team766.framework.Procedure;
import com.team766.hal.RobotConfigurator;
import com.team766.robot.common.SwerveConfig;
import com.team766.robot.common.mechanisms.Drive;
import com.team766.robot.common.mechanisms.SwerveDrive;
import com.team766.robot.gatorade.constants.SwerveDriveConstants;
import com.team766.robot.gatorade.mechanisms.*;

Expand All @@ -14,7 +14,7 @@ public class Robot implements RobotConfigurator {
public static Wrist wrist;
public static Elevator elevator;
public static Shoulder shoulder;
public static Drive drive;
public static SwerveDrive drive;
public static Lights lights;

@Override
Expand All @@ -24,7 +24,7 @@ public void initializeMechanisms() {
wrist = new Wrist();
elevator = new Elevator();
shoulder = new Shoulder();
drive = new Drive(config);
drive = new SwerveDrive(config);
lights = new Lights();
}

Expand Down
6 changes: 3 additions & 3 deletions src/main/java/com/team766/robot/reva/DriverOI.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import com.team766.framework.OIFragment;
import com.team766.hal.JoystickReader;
import com.team766.robot.common.constants.ControlConstants;
import com.team766.robot.common.mechanisms.Drive;
import com.team766.robot.common.mechanisms.SwerveDrive;
import com.team766.robot.reva.VisionUtil.VisionSpeakerHelper;
import com.team766.robot.reva.constants.InputConstants;
import com.team766.robot.reva.mechanisms.Intake;
Expand All @@ -19,7 +19,7 @@ public class DriverOI extends OIFragment {
protected static final double FINE_DRIVING_COEFFICIENT = 0.25;

protected VisionSpeakerHelper visionSpeakerHelper;
protected final Drive drive;
protected final SwerveDrive drive;
protected final Shoulder shoulder;
protected final Intake intake;
protected final Shooter shooter;
Expand All @@ -35,7 +35,7 @@ public class DriverOI extends OIFragment {
private LaunchedContext visionContext;

public DriverOI(
Drive drive,
SwerveDrive drive,
Shoulder shoulder,
Intake intake,
Shooter shooter,
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/com/team766/robot/reva/Robot.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import com.team766.hal.RobotConfigurator;
import com.team766.logging.LoggerExceptionUtils;
import com.team766.robot.common.SwerveConfig;
import com.team766.robot.common.mechanisms.Drive;
import com.team766.robot.common.mechanisms.SwerveDrive;
import com.team766.robot.reva.mechanisms.Climber;
import com.team766.robot.reva.mechanisms.ForwardApriltagCamera;
import com.team766.robot.reva.mechanisms.Intake;
Expand All @@ -17,7 +17,7 @@

public class Robot implements RobotConfigurator {
// Declare mechanisms (as static fields) here
public static Drive drive;
public static SwerveDrive drive;
public static Climber climber;
public static Shoulder shoulder;
public static Intake intake;
Expand All @@ -31,7 +31,7 @@ public class Robot implements RobotConfigurator {
public void initializeMechanisms() {
SwerveConfig config = new SwerveConfig();
lights = new Lights();
drive = new Drive(config);
drive = new SwerveDrive(config);
climber = new Climber();
shoulder = new Shoulder();
intake = new Intake();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import com.team766.ViSIONbase.AprilTagGeneralCheckedException;
import com.team766.ViSIONbase.GrayScaleCamera;
import com.team766.robot.common.mechanisms.Drive;
import com.team766.robot.common.mechanisms.SwerveDrive;
import com.team766.robot.reva.Robot;
import com.team766.robot.reva.constants.VisionConstants;
import edu.wpi.first.math.geometry.Rotation2d;
Expand All @@ -17,12 +17,12 @@ public class VisionSpeakerHelper {
int tagId;
double angle;
GrayScaleCamera camera;
Drive drive;
SwerveDrive drive;
Translation2d absTargetPos;
Translation2d relativeTranslation2d;

// TODO: make this static
public VisionSpeakerHelper(Drive drive) {
public VisionSpeakerHelper(SwerveDrive drive) {
camera = Robot.forwardApriltagCamera.getCamera();
this.drive = drive;
}
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/com/team766/robot/swerveandshoot/Robot.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import com.team766.framework.Procedure;
import com.team766.hal.RobotConfigurator;
import com.team766.robot.common.SwerveConfig;
import com.team766.robot.common.mechanisms.Drive;
import com.team766.robot.common.mechanisms.SwerveDrive;
import com.team766.robot.swerveandshoot.constants.SwerveDriveConstants;
import com.team766.robot.swerveandshoot.mechanisms.*;

Expand All @@ -13,7 +13,7 @@ public class Robot implements RobotConfigurator {
public static TempPickerUpper tempPickerUpper;
public static TempShooter tempShooter;
public static Lights lights;
public static Drive drive;
public static SwerveDrive drive;
public static NoteCamera noteDetectorCamera;
public static ForwardApriltagCamera forwardApriltagCamera;

Expand All @@ -23,7 +23,7 @@ public void initializeMechanisms() {
tempPickerUpper = new TempPickerUpper();
tempShooter = new TempShooter();
lights = new Lights();
drive = new Drive(config);
drive = new SwerveDrive(config);
noteDetectorCamera = new NoteCamera();
forwardApriltagCamera = new ForwardApriltagCamera();
}
Expand Down

0 comments on commit f7e0feb

Please sign in to comment.