Skip to content

Commit 9d8d7c6

Browse files
committed
fix: Address hardware mapping bugs and set up base Mecanum drive
1 parent f5e23a8 commit 9d8d7c6

3 files changed

Lines changed: 10 additions & 4 deletions

File tree

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,16 @@
11
package org.mrpsvt.capital_robotics.control;
22

3+
import com.qualcomm.robotcore.hardware.Gamepad;
4+
import com.qualcomm.robotcore.hardware.HardwareMap;
35
import com.seattlesolvers.solverslib.gamepad.GamepadEx;
46

57
public class ControlMap {
68

79
public GamepadEx driver1;
810
public GamepadEx driver2;
11+
12+
public ControlMap(Gamepad gamepad1, Gamepad gamepad2) {
13+
driver1 = new GamepadEx(gamepad1);
14+
driver2 = new GamepadEx(gamepad2);
15+
}
916
}

TeamCode/src/main/java/org/mrpsvt/capital_robotics/robot_core/DriveBase.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ public class DriveBase {
2222
public DriveBase(HardwareMap hardwareMap) {
2323
this.hardwareMap = hardwareMap;
2424
this.mecanum = initDriveBase();
25-
this.imu = initIMU();
2625
}
2726

2827
public MecanumDrive initDriveBase() {

TeamCode/src/main/java/org/mrpsvt/capital_robotics/teleop/DefaultOpmode.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ public class DefaultOpmode extends OpMode {
2222
@Override
2323
public void init() {
2424
DriveBase driveBase = new DriveBase(hardwareMap);
25-
controls = new ControlMap();
25+
controls = new ControlMap(gamepad1, gamepad2);
2626
drive = driveBase.mecanum;
2727
imu = driveBase.imu;
2828
driveConstants = new DriveConstants();
@@ -32,8 +32,8 @@ public void init() {
3232
public void loop() {
3333
if (Objects.equals(driveConstants.robotDriveMode, DriveConstants.ROBOT_CENTRIC)) {
3434
drive.driveRobotCentric(
35-
controls.driver1.getLeftY() * driveConstants.forwardSpeed,
36-
controls.driver1.getLeftX() * driveConstants.strafeSpeed,
35+
controls.driver1.getLeftX() * driveConstants.forwardSpeed,
36+
controls.driver1.getLeftY() * driveConstants.strafeSpeed,
3737
controls.driver1.getRightX() * driveConstants.turnSpeed
3838
);
3939
} else if (Objects.equals(driveConstants.robotDriveMode, DriveConstants.FIELD_CENTRIC)) {

0 commit comments

Comments
 (0)