IndexOutOfBound error in a Trajectory Sequence's markers
LyTrv-20 opened this issue · 1 comments
RR FTC Version
0.5.6
Observed Behavior
I'm trying to do autonomous with Trajectory Sequence, and I encountered an IndexOutOfBound error when run (not initialized) the opmode. At first, I thought it's other things but after multiple attempts, the error was fixed after I remove the UNSTABLE_addTemporalMarkerOffset() in the opmode.
Because this error occurred during a league meet, I didn't have time to ask about this error right away, and forgot to take a picture of the error screen. However, I do remember that besides the error lines founded in other files related to roadrunner project, the error also picked up a line from the opmode where the .build() at.
Below is the opmode, since we didn't do much code testing, the opmode below acts almost like a test for the full version later in the season. The error was called a bit after the the run button was pressed.
package org.firstinspires.ftc.teamcode.opmodes.auto.test;
import com.acmerobotics.roadrunner.geometry.Pose2d;
import com.acmerobotics.roadrunner.geometry.Vector2d;
import com.arcrobotics.ftclib.command.CommandScheduler;
import com.qualcomm.robotcore.eventloop.opmode.Autonomous;
import com.qualcomm.robotcore.eventloop.opmode.LinearOpMode;
import org.firstinspires.ftc.teamcode.command.command.drivetrain;
import org.firstinspires.ftc.teamcode.subsystems.Drivetrain;
import org.firstinspires.ftc.teamcode.subsystems.SampleMecanumDrive;
import org.firstinspires.ftc.teamcode.subsystems.claw;
import org.firstinspires.ftc.teamcode.subsystems.intake;
@autonomous //blue alliance, slot closer to backdrop, facing spike mark
public class blue1test extends LinearOpMode {
SampleMecanumDrive drivetrain;
claw C;
@OverRide
public void runOpMode() throws InterruptedException {
drivetrain = new SampleMecanumDrive(hardwareMap);
C = new claw(hardwareMap);
waitForStart();
if(isStopRequested())return;
while (opModeIsActive()) {
drivetrain.followTrajectorySequence(drivetrain.trajectorySequenceBuilder(new Pose2d(11.5, 61.25, Math.toRadians(270)))
.forward(50)
.turn(Math.toRadians(90))
.strafeLeft(20)
.waitSeconds(1) //in front of center spike
.UNSTABLE_addTemporalMarkerOffset(0,()->{
C.open();
})
.UNSTABLE_addTemporalMarkerOffset(1.5,()->{
C.close();
})
.waitSeconds(2)
.lineTo(new Vector2d(11.5, 50))
.splineToSplineHeading(new Pose2d(45,35, Math.toRadians(180)),Math.toRadians(-50))
.waitSeconds(1) // in front of backdrop
.forward(5)
.splineToConstantHeading(new Vector2d(55,60),Math.toRadians(0))
.build()
);
break;
}
}
}
Tuning Files
No response
Robot Logs
No response
Can you try upgrading to the latest version of the quickstart? There were some changes made recently to avoid marker indexing issues. I can't reproduce a crash when building the given trajectory sequence with the latest code, and all of the markers seem to be in the right spots.