Skip to content
This repository was archived by the owner on Jan 24, 2026. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
b75f198
Create MovingMotor.java
filip-dob Oct 3, 2025
e8f2457
Update MovingMotor.java
filip-dob Oct 3, 2025
6d26c33
Update MovingMotor.java
filip-dob Oct 3, 2025
8a472be
Update MovingMotor.java
filip-dob Oct 3, 2025
536ea03
Update MovingMotor.java
filip-dob Oct 3, 2025
11052db
Update MovingMotor.java
filip-dob Oct 9, 2025
fa711e6
Update MovingMotor.java
filip-dob Oct 9, 2025
f6f790f
Update MovingMotor.java
filip-dob Oct 9, 2025
596372e
Create Drive
filip-dob Oct 16, 2025
cd102e9
Create MoveMotor class extending Procedure
filip-dob Oct 18, 2025
addc85f
Add constructor to MoveMotor for motor initialization
filip-dob Oct 18, 2025
f6bdc76
implemented procedure
filip-dob Oct 18, 2025
5b5eecf
implemented procedure
filip-dob Oct 18, 2025
ef8943a
bug/clarity fixes
filip-dob Oct 18, 2025
404ed3e
bug/clarity fixes
filip-dob Oct 18, 2025
ab4bf5a
Rename Drive to Drive.java
filip-dob Oct 23, 2025
3e6b02d
commited oi and tank drive
rajitzg Oct 23, 2025
13b93c4
commited oi and tank drive
rajitzg Oct 23, 2025
57c43f6
commited oi and tank drive
rajitzg Oct 23, 2025
4a2e47c
w
filip-dob Oct 25, 2025
17fd2c2
,m
filip-dob Oct 25, 2025
3ff9560
as
filip-dob Oct 25, 2025
d420bd9
bkbk
rajitzg Nov 1, 2025
4edd2e5
sakaaaadf
rajitzg Nov 1, 2025
7cb9771
fj
rajitzg Nov 1, 2025
ad76258
Refactor OI class to OI_A with new joystick handling
filip-dob Nov 6, 2025
a1ab8f7
Implement OI_MAyhem for robot control
filip-dob Nov 6, 2025
9dab302
Refactor Shooter class and update motor handling
filip-dob Nov 6, 2025
6559401
Refactor FilipMovingMotor to MovingMotor class
filip-dob Nov 6, 2025
a519f89
Rename MovingMotor class to FilipMovingMotor
filip-dob Nov 6, 2025
f636b89
Update package declaration for Shooter class
filip-dob Nov 6, 2025
d01f659
Refactor Autonomous class for new mechanisms and procedures
filip-dob Nov 6, 2025
a80f9b9
Rename package from Kevan to filip
filip-dob Nov 6, 2025
ceff264
Add DriveProcedure for straight movement control
filip-dob Nov 6, 2025
dad4383
Add IntakeProcedure class for managing intake actions
filip-dob Nov 6, 2025
5544582
Implement ShootProcedure for shooter control
filip-dob Nov 6, 2025
a6cfa4a
Implement TurnProcedure for robot driving control
filip-dob Nov 6, 2025
dad434e
Implement Intake mechanism with motor control
filip-dob Nov 6, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 43 additions & 0 deletions src/main/java/com/team766/robot/filip/LightsCANdle.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
package com.team766.robot.filip;
import java.util.Set;
import static com.team766.framework.RulePersistence.*;

import com.team766.framework.RuleGroup;
import com.team766.hal.JoystickReader;
import com.team766.hal.RobotProvider;
import com.team766.robot.common.mechanisms.LEDString;
import com.team766.robot.common.constants.ColorConstants;
import com.ctre.phoenix.led.Animation;
import com.ctre.phoenix.led.RainbowAnimation;
import com.team766.robot.common.constants.InputConstants;

public class LightsCANdle extends RuleGroup{
private final LEDString lights = new LEDString("lights");
private final LEDString.Segment lightStrip = lights.makeSegment(0,7);

public LightsCANdle () {
final Animation rainbow = new RainbowAnimation();
final JoystickReader joystick = RobotProvider.instance.getJoystick(0);

addRule("Yellow for Cone",
joystick.whenButton(InputConstants.GAMEPAD_A_BUTTON),
ONCE,
Set.of(lights),
() -> {lightStrip.setColor(ColorConstants.YELLOW);}
);

addRule("Purple for Cube",
joystick.whenButton(InputConstants.GAMEPAD_B_BUTTON),
ONCE,
Set.of(lights),
() -> {lightStrip.setColor(ColorConstants.PURPLE);}
);

addRule("Rainbow for Defense",
joystick.whenButton(InputConstants.GAMEPAD_X_BUTTON),
ONCE,
Set.of(lights),
() -> {lightStrip.animate(rainbow);}
);
}
}
29 changes: 29 additions & 0 deletions src/main/java/com/team766/robot/filip/OI.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package com.team766.robot.filip;

import static com.team766.framework.RulePersistence.*;

import com.team766.framework.RuleGroup;
import com.team766.hal.JoystickReader;
import com.team766.hal.RobotProvider;
import com.team766.robot.Kevan.mechanisms.Drive;
import com.team766.robot.common.constants.InputConstants;
import java.util.Set;

public class OI_A extends RuleGroup {
public OI_A(Drive drive) {
final JoystickReader joystick1 = RobotProvider.instance.getJoystick(0);
addRule(
"handle_axis_moved",
joystick1.whenAnyAxisMoved(
InputConstants.AXIS_FORWARD_BACKWARD, InputConstants.AXIS_LEFT_RIGHT),
ONCE_AND_HOLD,
Set.of(drive),
() -> {
double forward_backward =
joystick1.getAxis(InputConstants.AXIS_FORWARD_BACKWARD);
double left_right = joystick1.getAxis(InputConstants.AXIS_LEFT_RIGHT);
drive.move_left(forward_backward + left_right);
drive.move_right(forward_backward - left_right);
});
}
}
66 changes: 66 additions & 0 deletions src/main/java/com/team766/robot/filip/OI_MAyhem
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
package com.team766.robot.filip;

import static com.team766.framework.RulePersistence.*;

import com.team766.framework.Context;
import com.team766.framework.RuleGroup;
import com.team766.hal.JoystickReader;
import com.team766.hal.RobotProvider;
import com.team766.robot.Kevan.mechanisms.Drive;
import com.team766.robot.Kevan.mechanisms.Intake;
import com.team766.robot.Kevan.mechanisms.Shooter;
import com.team766.robot.common.constants.InputConstants;
import java.util.Set;

// Tank Drive OI
public class OI_MAyhem extends RuleGroup {
public OI_MAYHEM(Drive drive, Shooter shooter, Intake intake, Context context) {
final JoystickReader gamePad1 = RobotProvider.instance.getJoystick(0);
addRule(
"RUN_LEFT_MOTOR",
gamePad1.whenAxisMoved(InputConstants.GAMEPAD_LEFT_STICK_YAXIS),
ONCE_AND_HOLD,
Set.of(drive),
() -> {
drive.move_right(gamePad1.getAxis(InputConstants.GAMEPAD_LEFT_STICK_YAXIS));
});

addRule(
"RUN_RIGHT_MOTOR",
gamePad1.whenAxisMoved(InputConstants.GAMEPAD_RIGHT_STICK_YAXIS),
ONCE_AND_HOLD,
Set.of(drive),
() -> {
drive.move_left(gamePad1.getAxis(InputConstants.GAMEPAD_RIGHT_STICK_YAXIS));
});
addRule(
"RUN_INTAKE",
gamePad1.whenButton(InputConstants.GAMEPAD_RIGHT_BUMPER_BUTTON),
ONCE_AND_HOLD,
Set.of(intake),
() -> {
intake.SetIntake(1);
})
.withFinishedTriggeringProcedure(
intake,
() -> {
intake.SetIntake(0);
});
addRule(
"SHOOT_SET_POWER",
gamePad1.whenAxisMoved(InputConstants.GAMEPAD_RIGHT_TRIGGER),
ONCE_AND_HOLD,
Set.of(shooter),
() -> {
shooter.SetShooterSpeed(
gamePad1.getAxis(InputConstants.GAMEPAD_RIGHT_TRIGGER));
context.waitForSeconds(0.25);
shooter.SetTransferSpeed(1);
})
.withFinishedTriggeringProcedure(
shooter,
() -> {
shooter.SetTransferSpeed(0);
});
}
}
28 changes: 28 additions & 0 deletions src/main/java/com/team766/robot/filip/Shooter.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package com.team766.robot.filip.mechanisms;

import com.team766.framework.MechanismWithStatus;
import com.team766.framework.Status;
import com.team766.hal.MotorController;
import com.team766.hal.RobotProvider;

public class Shooter extends MechanismWithStatus<Shooter.ShooterStatus> {

MotorController shooter_motor = RobotProvider.instance.getMotor("shooter_motor");
MotorController tranfer_motor = RobotProvider.instance.getMotor("transfer_motor");

public record ShooterStatus(double currentPosition) implements Status {}

public Shooter() {}

public void SetShooterSpeed(double motorPower) {
shooter_motor.set(motorPower);
}

public void SetTransferSpeed(double motorPower) {
tranfer_motor.set(motorPower);
}

protected ShooterStatus updateStatus() {
return new ShooterStatus(0);
}
}
27 changes: 27 additions & 0 deletions src/main/java/com/team766/robot/filip/mechanisms/Drive.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@

package com.team766.robot.filip.mechanisms;

import com.team766.framework.MechanismWithStatus;
import com.team766.framework.Status;
import com.team766.hal.MotorController;
import com.team766.hal.RobotProvider;

public class Drive extends MechanismWithStatus<Drive.DriveStatus> {
MotorController motor_left = RobotProvider.instance.getMotor("leftMotor");
MotorController motor_right = RobotProvider.instance.getMotor("rightMotor");
public record DriveStatus(double pos_motor_left, double pos_motor_right) implements Status {}

public Drive() {}

public void move_left(double speed) {
motor_left.set(speed);
}

public void move_right(double speed) {
motor_right.set(speed);
}

protected DriveStatus updateStatus() {
return new DriveStatus(motor_left.getSensorPosition(), motor_right.getSensorPosition());
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package com.team766.robot.filip.mechanisms;

import com.team766.framework.MechanismWithStatus;
import com.team766.framework.Status;
import com.team766.hal.MotorController;
import com.team766.hal.RobotProvider;

public class FilipMovingMotor extends MechanismWithStatus<MovingMotor.MovingMotorStatus> {

public FilipMovingMotor() {}

MotorController motor = RobotProvider.instance.getMotor("mainMotor");

public void move(double motorPower) {
motor.set(motorPower);
}

public record MovingMotorStatus(double currentPosition) implements Status {}

public void stop() {
motor.set(0);
}

protected MovingMotorStatus updateStatus() {
return new MovingMotorStatus(motor.getSensorPosition());
}
}
23 changes: 23 additions & 0 deletions src/main/java/com/team766/robot/filip/mechanisms/Intake.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package com.team766.robot.Kevan.mechanisms;

import com.team766.framework.MechanismWithStatus;
import com.team766.framework.Status;
import com.team766.hal.MotorController;
import com.team766.hal.RobotProvider;

public class Intake extends MechanismWithStatus<Intake.IntakeStatus> {

MotorController intake_motor = RobotProvider.instance.getMotor("intake_motor");

public record IntakeStatus(double currentPosition) implements Status {}

public Intake() {}

public void SetIntake(double motorPower) {
intake_motor.set(motorPower);
}

protected IntakeStatus updateStatus() {
return new IntakeStatus(0);
}
}
35 changes: 35 additions & 0 deletions src/main/java/com/team766/robot/filip/procedures/Autonomous.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
package com.team766.robot.filip.procedures;

import com.team766.framework.Context;
import com.team766.framework.Procedure;
import com.team766.robot.Kevan.mechanisms.Drive;
import com.team766.robot.Kevan.mechanisms.Intake;
import com.team766.robot.Kevan.mechanisms.Shooter;

public class Autonomous extends Procedure {
private Drive drive;
private Shooter shooter;
private Intake intake;

public Autonomous(Drive myDrive, Shooter myShooter, Intake myIntake) {
this.drive = reserve(myDrive);
this.shooter = reserve(myShooter);
this.intake = reserve(myIntake);
}

public void run(Context context) {
context.waitForSeconds(1);
context.runParallel(new DriveProcedure(drive, 1.25));
context.runParallel(new ShootProcedure(shooter, 0.8));
context.runParallel(new TurnProcedure(drive, 0.25, 0.5));
context.runParallel(new DriveProcedure(drive, 0.3125));
context.runParallel(new IntakeProcedure(intake));
context.runParallel(new DriveProcedure(drive, 0.3125));
context.runParallel(new IntakeProcedure(intake));
context.runParallel(new TurnProcedure(drive, 0.5, 0.5));
context.runParallel(new DriveProcedure(drive, 0.625));
context.runParallel(new TurnProcedure(drive, 0.25, 0.5));
context.runParallel(new ShootProcedure(shooter, 0.8));
context.runParallel(new ShootProcedure(shooter, 0.8));
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package com.team766.robot.Kevan.procedures;

import com.team766.framework.Context;
import com.team766.framework.Procedure;
import com.team766.robot.Kevan.mechanisms.Drive;

public class DriveProcedure extends Procedure {

private Drive drive;
private double seconds;

public DriveProcedure(Drive myDrive, double seconds) {
drive = reserve(myDrive);
this.seconds = seconds;
}

public void run(Context context) {
drive.move_straight(0.8);
context.waitForSeconds(seconds);
drive.move_straight(0);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package com.team766.robot.Kevan.procedures;

import com.team766.framework.Context;
import com.team766.framework.Procedure;
import com.team766.robot.Kevan.mechanisms.Intake;

public class IntakeProcedure extends Procedure {

private Intake intake;

public IntakeProcedure(Intake myIntake) {
intake = reserve(myIntake);
}

public void run(Context context) {
intake.SetIntake(1);
context.waitForSeconds(0.5);
intake.SetIntake(0);
}
}
17 changes: 17 additions & 0 deletions src/main/java/com/team766/robot/filip/procedures/MoveMotor.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package com.team766.robot.filip.procedures;
import com.team766.framework.Context;
import com.team766.framework.Procedure;
import com.team766.robot.filip.mechanisms.FilipMovingMotor;

public class MoveMotor extends Procedure {
private FilipMovingMotor motor;
public MoveMotor(FilipMovingMotor myMotor){
motor = reserve(myMotor);
}
@Override
public void run(Context context) {
motor.moveSpeed(1);
context.waitForSeconds(5);
motor.moveSpeed(0);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package com.team766.robot.filip.procedures;

import com.team766.framework.Context;
import com.team766.framework.Procedure;
import com.team766.robot.Kevan.mechanisms.Shooter;

public class ShootProcedure extends Procedure {

private Shooter shooter;
private double power;

public ShootProcedure(Shooter myShooter, double power) {
shooter = reserve(myShooter);
this.power = power;
}

public void run(Context context) {
shooter.SetShooterSpeed(power);
context.waitForSeconds(0.25);
shooter.SetTransferSpeed(1);
context.waitForSeconds(0.5);
shooter.SetTransferSpeed(0);
shooter.SetShooterSpeed(0);
}
}
Loading
Loading