Stage1a auto + additonal motors - #194
Conversation
|
🌐 Preview URL: https://pr-194.frcsoftware.pages.dev |
|
|
||
| Now that the kitbot can move in teleop mode, it is time to make it move during the auto mode. | ||
| To do this, another `OpMode` needs to be written that contains all the code needed to make the robot do what's wanted in auto. | ||
| Additionally the `@Autonomous` annotation is added above the class definition so it shows up in the driverstation under autonomous OpModes. |
There was a problem hiding this comment.
| Additionally the `@Autonomous` annotation is added above the class definition so it shows up in the driverstation under autonomous OpModes. | |
| When writing an `OpMode` for kitbot, there is an `@Autonomous` annotation that is added above the class definition so it shows up in the driverstation under autonomous OpModes. |
There was a problem hiding this comment.
I think that makes sense but basically tying it back to the code more to make a better connection that the autonomous annotation is something that is in the robot that the students will be writing. Before it just seemed like a cool fact and the connection to kitbot/robot code wasn't quite there
|
|
||
| # Autonomous OpMode | ||
|
|
||
| Now that the kitbot can move in teleop mode, it is time to make it move during the auto mode. |
There was a problem hiding this comment.
I think adding on why kitbot needs an auto would be really helpful. It can be as simple as explaining how auto points are typically doubled or whatever. Kind of helps answer the "why" in "why should students learn this"
I think since this is a timed based auto, it's probably good to note here that auto is typically 15 seconds or something like that. so students don't try writing 30 second autos and then get confused on why the full code doesn't work. also it's good to know (new students might not know there is a time limit in auto)
| This auto will be a timed based auto, meaning everything the robot does will be based on how long it has been since the start of autonomous. | ||
| To keep track of how long it has been since the start of auto an instance of `Timer` is created in the OpMode and reset when the robot is enabled. | ||
|
|
||
| The code for the auto should be added to the `MyAuto.java` file inside the opmode folder. |
There was a problem hiding this comment.
| The code for the auto should be added to the `MyAuto.java` file inside the opmode folder. | |
| The code for the auto will be added to the `MyAuto.java` file inside the opmode folder. |
| This can be accomplished by periodically checking if it has been four seconds since the start of auto using the `Timer` instance. | ||
| If it has been at least four seconds then command the drivetrain with zero speed. | ||
| Otherwise command the drivetrain to drive forward at half speed. | ||
| Writing that out in code will look like this |
There was a problem hiding this comment.
Maybe not but is there a way to make it less "copy and paste" and have the steps be broken down more? Could be something like
- Explaining how we want to check if the if it has been four seconds since the start of auto using the
Timerinstance. - If so, then we want the robot to drive forward
- If the 4 seconds are up, then we want the robot to stop driving
Because it's 1a, I think breaking it down more will be helpful in giving students that foundational understanding
| @@ -25,6 +25,7 @@ public void start() { | |||
| autoTimer.restart(); // Reset the timer to zero at the start of auto | |||
There was a problem hiding this comment.
It's autoTimer here but it's timer in the Rev solution. Should probably pick one and use it throughout
|
|
||
| If the code was to be simulated at this point, the motors could be controlled using keyboard inputs and the resulting motor speeds could be viewed with a graph inside of Advantage Scope. | ||
| While this is a functional solution, it can be made more interesting by taking advantage of Advantage Scope's 3d tab. | ||
| Advantage Scope's 3d tab displays robots and game pieces inside of a game field using poses published from the robot code. |
There was a problem hiding this comment.
| Advantage Scope's 3d tab displays robots and game pieces inside of a game field using poses published from the robot code. | |
| AdvantageScope's 3d tab displays robots and game pieces inside of a game field using poses published from the robot code. |
| Advantage Scope's 3d tab displays robots and game pieces inside of a game field using poses published from the robot code. | ||
| This allows fuel to be shown entering or exiting the robot while is intaking or launching. | ||
|
|
||
| The `FuelSim` class is provided which takes the current state of the IntakeLauncher and Feeder motors and publishes new poses for the fuel to be visualized at in Advantage Scope. |
There was a problem hiding this comment.
| The `FuelSim` class is provided which takes the current state of the IntakeLauncher and Feeder motors and publishes new poses for the fuel to be visualized at in Advantage Scope. | |
| The `FuelSim` class is provided which takes the current state of the IntakeLauncher and Feeder motors and publishes new poses for the fuel to be visualized at in AdvantageScope. |
|
|
||
| If the code was to be simulated at this point, the motors could be controlled using keyboard inputs and the resulting motor speeds could be viewed with a graph inside of Advantage Scope. | ||
| While this is a functional solution, it can be made more interesting by taking advantage of Advantage Scope's 3d tab. | ||
| Advantage Scope's 3d tab displays robots and game pieces inside of a game field using poses published from the robot code. |
There was a problem hiding this comment.
also might be helpful to quickly explain what a pose is
| <ContentFigure | ||
| width="650px" | ||
| alt="Using Line Graph" | ||
| src="/learning-course/stage1/stage1a/LineGraph.webm" |
| <ContentFigure | ||
| width="650px" | ||
| alt="Using 3D Field" | ||
| src="/learning-course/stage1/stage1a/3dField.webm" |

Description
Adds stage 1a curriculum for programing a simple auto as well as progiraming the IntakeLauncher and Feeder motors. Makes progress on #13 .
Todo:
periodic()overupdate()Meta
Merge checklist: