Skip to content

Stage 1A Solution CTRE#34

Open
Spaceman113138 wants to merge 9 commits into
frcsoftware:mainfrom
Spaceman113138:Stage1A-CTRE
Open

Stage 1A Solution CTRE#34
Spaceman113138 wants to merge 9 commits into
frcsoftware:mainfrom
Spaceman113138:Stage1A-CTRE

Conversation

@Spaceman113138

Copy link
Copy Markdown

For #29

Solution for Stage 1A - Mostly a copy of #24 but with formating added and replacing any rev motors with ctre.

@Autonomous(name = "My Auto", group = "Group 1")
public class MyAuto extends PeriodicOpMode {
private final Robot robot;
private double startTime;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I left the same comment on the rev one, but it's simpler to let the timer keep track of the timing and just use hasElapsed

Comment thread stage1/ctre/solution/src/main/java/first/robot/Robot.java Outdated
@Spaceman113138

Copy link
Copy Markdown
Author

@ArchdukeTim is this what you were looking for as far as using timer?

*/
@Override
public void periodic() {
if (!autoTimer.hasElapsed(4.0)) { // Drive for 4 seconds after the start of auto

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah this is better. It might read better if you invert the if statement:

if (hasElapsed(4) {
  stop the drivetrain
} else {
  drive forward
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants