Skip to content

Commit

Permalink
add trajectory to move out of partner way
Browse files Browse the repository at this point in the history
  • Loading branch information
alanwong9664 committed Feb 24, 2024
1 parent 35a049b commit e555d27
Show file tree
Hide file tree
Showing 3 changed files with 72 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package org.firstinspires.ftc.teamcode.ftc16072.BehaviorTrees.Trajectories.BlueClose.LeftSpike;

import org.firstinspires.ftc.teamcode.ftc16072.BehaviorTrees.Node;
import org.firstinspires.ftc.teamcode.ftc16072.OpModes.QQOpMode;
import org.firstinspires.ftc.teamcode.ftc16072.Util.SpikePosition;
import org.firstinspires.ftc.teamcode.rr_trajectorysequence.TrajectorySequence;
import org.firstinspires.ftc.teamcode.rr_trajectorysequence.TrajectorySequenceBuilder;

public class BC6LeftSpikeTrajectory extends Node {
public static final int RIGHT_DISTANCE_INCHES=40;

@Override
public State tick(QQOpMode opMode) {
TrajectorySequenceBuilder builder = opMode.robot.nav.trajectorySequenceBuilder(opMode.robot.nav.getPoseEstimate());
TrajectorySequence sequence = builder.strafeRight(RIGHT_DISTANCE_INCHES).
build();
if (sequence == null){
return State.FAILURE;
}
opMode.board.add("TrajectorySequence", sequence);
opMode.board.add("SpikePosition", SpikePosition.LEFT);
return State.SUCCESS;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package org.firstinspires.ftc.teamcode.ftc16072.BehaviorTrees.Trajectories.BlueClose.MiddleSpike;

import org.firstinspires.ftc.teamcode.ftc16072.BehaviorTrees.Node;
import org.firstinspires.ftc.teamcode.ftc16072.OpModes.QQOpMode;
import org.firstinspires.ftc.teamcode.ftc16072.Util.SpikePosition;
import org.firstinspires.ftc.teamcode.rr_trajectorysequence.TrajectorySequence;
import org.firstinspires.ftc.teamcode.rr_trajectorysequence.TrajectorySequenceBuilder;

public class BC5MiddleSpikeTrajectory extends Node {
public static final int RIGHT_DISTANCE_INCHES=40;

@Override
public State tick(QQOpMode opMode) {
TrajectorySequenceBuilder builder = opMode.robot.nav.trajectorySequenceBuilder(opMode.robot.nav.getPoseEstimate());
TrajectorySequence sequence = builder.strafeRight(RIGHT_DISTANCE_INCHES).
build();
if (sequence == null){
return State.FAILURE;
}
opMode.board.add("TrajectorySequence", sequence);
opMode.board.add("SpikePosition", SpikePosition.RIGHT);
return State.SUCCESS;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package org.firstinspires.ftc.teamcode.ftc16072.BehaviorTrees.Trajectories.BlueClose.RightSpike;

import org.firstinspires.ftc.teamcode.ftc16072.BehaviorTrees.Node;
import org.firstinspires.ftc.teamcode.ftc16072.OpModes.QQOpMode;
import org.firstinspires.ftc.teamcode.ftc16072.Util.SpikePosition;
import org.firstinspires.ftc.teamcode.rr_trajectorysequence.TrajectorySequence;
import org.firstinspires.ftc.teamcode.rr_trajectorysequence.TrajectorySequenceBuilder;

public class BC6RightSpikeTrajectory extends Node {
public static final int RIGHT_DISTANCE_INCHES=40;

@Override
public State tick(QQOpMode opMode) {
TrajectorySequenceBuilder builder = opMode.robot.nav.trajectorySequenceBuilder(opMode.robot.nav.getPoseEstimate());
TrajectorySequence sequence = builder.strafeRight(RIGHT_DISTANCE_INCHES).
build();
if (sequence == null){
return State.FAILURE;
}
opMode.board.add("TrajectorySequence", sequence);
opMode.board.add("SpikePosition", SpikePosition.RIGHT);
return State.SUCCESS;
}
}

0 comments on commit e555d27

Please sign in to comment.