Skip to content

Commit

Permalink
Add Component stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
JJTech0130 committed Jan 6, 2024
1 parent 2a5ab21 commit c79e4ff
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ public static double getMotorVelocityF(double ticksPerSecond) {
public static double kV = 0.014129716300132542;
public static double kA = 0.0032;
public static double kStatic = 0;
protected RoboticaBot(HardwareMap hardwareMap) {

public RoboticaBot(HardwareMap hardwareMap) {
super(hardwareMap);
// TODO: Reverse Motors, encoders & such
drive = new TrajectoryDrive(
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package org.firstinspires.ftc.teamcode.opmode.components;

import org.firstinspires.ftc.teamcode.drive.Robot;

public abstract class Component {
private final Robot robot;
protected Component(Robot robot) {
this.robot = robot;
}

protected Robot getRobot() {
return robot;
}

public abstract void drive();
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package org.firstinspires.ftc.teamcode.opmode.components;

import com.acmerobotics.roadrunner.geometry.Pose2d;
import com.acmerobotics.roadrunner.geometry.Vector2d;

import org.firstinspires.ftc.teamcode.drive.Robot;
import org.firstinspires.ftc.teamcode.trajectorysequence.TrajectorySequence;

public class SampleComponent extends Component {
public SampleComponent(Robot robot) {
super(robot);
}

private TrajectorySequence buildSequence() {
return getRobot().getDrive().trajectorySequenceBuilder(new Pose2d())
.lineTo(new Vector2d(10, 10))
.build();
}
@Override
public void drive() {
getRobot().getDrive().followTrajectorySequence(buildSequence());
}
}

0 comments on commit c79e4ff

Please sign in to comment.