-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2a5ab21
commit c79e4ff
Showing
3 changed files
with
41 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
TeamCode/src/main/java/org/firstinspires/ftc/teamcode/opmode/components/Component.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); | ||
} |
23 changes: 23 additions & 0 deletions
23
TeamCode/src/main/java/org/firstinspires/ftc/teamcode/opmode/components/SampleComponent.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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()); | ||
} | ||
} |