Skip to content

Commit

Permalink
Robot go parabola go brrr
Browse files Browse the repository at this point in the history
  • Loading branch information
Driver Station Computer committed Oct 5, 2024
1 parent fa5d9bb commit 6d7898e
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ public class AutonomousModes {
// define one or more different autonomous modes with it like this:
// new AutonomousMode("DriveFast", () -> new DriveStraight(1.0)),
// new AutonomousMode("DriveSlow", () -> new DriveStraight(0.4)),
new AutonomousMode("DriveStraight", () -> new DriveStraight()),

new AutonomousMode("DoNothing", () -> new DoNothing()),
};
Expand Down
3 changes: 3 additions & 0 deletions src/main/java/com/team766/robot/rookie_bot/Robot.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,16 @@
import com.team766.framework.Procedure;
import com.team766.hal.RobotConfigurator;
import com.team766.robot.example.mechanisms.*;
import com.team766.robot.rookie_bot.mechanisms.Drive;

public class Robot implements RobotConfigurator {
// Declare mechanisms (as static fields) here
public static Drive drive;

@Override
public void initializeMechanisms() {
// Initialize mechanisms here
drive = new Drive();
}

@Override
Expand Down
24 changes: 24 additions & 0 deletions src/main/java/com/team766/robot/rookie_bot/mechanisms/Drive.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package com.team766.robot.rookie_bot.mechanisms;

import com.team766.hal.RobotProvider;

import com.team766.hal.MotorController;

import com.team766.framework.Mechanism;

import com.team766.framework.Mechanism;

public class Drive extends Mechanism{
private MotorController leftMotor;
private MotorController rightMotor;

public Drive() {
leftMotor = RobotProvider.instance.getMotor("drive.Left");
rightMotor = RobotProvider.instance.getMotor("drive.Right");
}

public void setMotorSpeed(double leftPower, double rightPower) {
leftMotor.set(leftPower);
rightMotor.set(rightPower);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package com.team766.robot.rookie_bot.procedures;

import com.team766.framework.Context;
import com.team766.framework.Procedure;
import com.team766.robot.rookie_bot.Robot;

public class DriveStraight extends Procedure{
public void run(Context context) {
Robot.drive.setMotorSpeed(0.1, 0.1);
context.waitForSeconds(7.5);
Robot.drive.setMotorSpeed(0, 0);
}

}

0 comments on commit 6d7898e

Please sign in to comment.