-
Notifications
You must be signed in to change notification settings - Fork 38
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
Showing
7 changed files
with
243 additions
and
38 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,13 @@ | ||
--- | ||
layout: default | ||
title: 404 | ||
nav_exclude: true | ||
title: EZ-Template | ||
nav_order: 1 | ||
permalink: / | ||
--- | ||
|
||
# EZ-Template | ||
[![License: MPL 2.0](https://img.shields.io/badge/License-MPL%202.0-brightgreen.svg)](https://opensource.org/licenses/MPL-2.0) | ||
|
||
[![License: MPL 2.0](https://img.shields.io/badge/License-MPL%202.0-brightgreen.svg)](https://opensource.org/licenses/MPL-2.0) | ||
# EZ-Template | ||
Simple plug-and-play PROS template that handles drive base functions for VEX robots. | ||
|
||
|
||
|
@@ -15,22 +16,17 @@ Simple plug-and-play PROS template that handles drive base functions for VEX rob | |
|
||
[Autonomous routines that used EZ-Template](https://photos.app.goo.gl/yRwuvmq7hDoM4f6EA) | ||
|
||
## Downloading | ||
|
||
Download the latest example project [here](https://github.com/EZ-Robotics/EZ-Template-Example/releases/latest) and open it as a new project in PROS. | ||
|
||
|
||
## Setup | ||
1) Download the latest example project [here](https://github.com/EZ-Robotics/EZ-Template-Example/releases/latest). Extract it, and open it in PROS. | ||
## Download and Installation | ||
1) Download the latest example project [here](https://github.com/EZ-Robotics/EZ-Template-Example/releases/latest). Extract the zip, and open it in PROS. | ||
2) In `src/main.cpp`, configure drive and IMU ports to what they are on your robot. Be sure to read the comments! | ||
3) Configure your wheel size and cartrige. Remember that 4" omni wheels are actually 4.125! | ||
4) In `src/main.cpp`, at the bottom in `void opcontrol()`, decide how you'd like to control your robot! Any flavor of arcade or tank! | ||
5) Turn the robot on and use it in driver control. Make sure the ports are correct and reversed correctly! | ||
6) To test the test autonomous modes, plug into a competition switch and select the autonomous mode on the brain screen by pressing the left and right buttons! The current page will be the autonomous that runs. For making new autonomous routines, check `src/autons.cpp` for examples on how to use the drive functions. | ||
|
||
## Upgrading | ||
Note* this only works for 2.0.0 and beyond. You cannot upgrade from 1.X.X to 2.X.X. | ||
1) Download the most recent [EZ-Template here](https://github.com/EZ-Robotics/EZ-Template/releases/latest). | ||
*Note: this only works for 2.0.0 and beyond. You cannot upgrade from 1.X.X to 2.X.X.* | ||
1) Download the most recent EZ-Template [here](https://github.com/EZ-Robotics/EZ-Template/releases/latest). | ||
2) In your terminal, `cd` into the directory you downloaded the file. | ||
3) Run this command from terminal `prosv5 c fetch [email protected]`. | ||
4) `cd` into your pros project directory in your terminal. | ||
|
@@ -45,7 +41,7 @@ Note* this only works for 2.0.0 and beyond. You cannot upgrade from 1.X.X to 2. | |
|
||
|
||
## Additing Autonomous Routines | ||
[Check out the tutorial on adding new autonomous routines here!](/docs/autons.md) | ||
[Check out the tutorial on adding new autonomous routines here!]([/docs](https://ez-robotics.github.io/EZ-Template/docs/Tutorials/autons.html) | ||
|
||
|
||
## License | ||
|
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 |
---|---|---|
|
@@ -2,7 +2,7 @@ | |
layout: default | ||
title: Active Brake | ||
parent: Tutorials | ||
nav_order: 3 | ||
nav_order: 4 | ||
--- | ||
|
||
|
||
|
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,223 @@ | ||
--- | ||
layout: default | ||
title: Example Autonomous Routines | ||
parent: Tutorials | ||
nav_order: 2 | ||
--- | ||
|
||
|
||
# **Adding Autonomous Routines** | ||
{: .no_toc } | ||
|
||
## Table of contents | ||
{: .no_toc .text-delta } | ||
|
||
1. TOC | ||
{:toc} | ||
|
||
|
||
--- | ||
|
||
|
||
|
||
## Assumed Constants | ||
```cpp | ||
const int DRIVE_SPEED = 110; | ||
const int TURN_SPEED = 90; | ||
const int SWING_SPEED = 90; | ||
``` | ||
|
||
|
||
--- | ||
|
||
|
||
## Drive | ||
```cpp | ||
void drive_example() { | ||
// The first parameter is target inches | ||
// The second parameter is max speed the robot will drive at | ||
// The third parameter is a boolean (true or false) for enabling/disabling a slew at the start of drive motions | ||
// for slew, only enable it when the drive distance is greater then the slew distance + a few inches | ||
|
||
|
||
chassis.set_drive_pid(24, DRIVE_SPEED, true); | ||
chassis.wait_drive(); | ||
|
||
chassis.set_drive_pid(-12, DRIVE_SPEED); | ||
chassis.wait_drive(); | ||
|
||
chassis.set_drive_pid(-12, DRIVE_SPEED); | ||
chassis.wait_drive(); | ||
} | ||
``` | ||
|
||
|
||
--- | ||
|
||
|
||
## Turn | ||
```cpp | ||
void turn_example() { | ||
// The first parameter is target degrees | ||
// The second parameter is max speed the robot will drive at | ||
|
||
|
||
chassis.set_turn_pid(90, TURN_SPEED); | ||
chassis.wait_drive(); | ||
|
||
chassis.set_turn_pid(45, TURN_SPEED); | ||
chassis.wait_drive(); | ||
|
||
chassis.set_turn_pid(0, TURN_SPEED); | ||
chassis.wait_drive(); | ||
} | ||
``` | ||
|
||
|
||
--- | ||
|
||
|
||
## Drive and Turn | ||
```cpp | ||
void drive_and_turn() { | ||
chassis.set_drive_pid(24, DRIVE_SPEED, true); | ||
chassis.wait_drive(); | ||
|
||
chassis.set_turn_pid(45, TURN_SPEED); | ||
chassis.wait_drive(); | ||
|
||
chassis.set_turn_pid(-45, TURN_SPEED); | ||
chassis.wait_drive(); | ||
|
||
chassis.set_turn_pid(0, TURN_SPEED); | ||
chassis.wait_drive(); | ||
|
||
chassis.set_drive_pid(-24, DRIVE_SPEED, true); | ||
chassis.wait_drive(); | ||
} | ||
``` | ||
|
||
|
||
--- | ||
|
||
|
||
## Wait Until and Changing Speed | ||
```cpp | ||
void wait_until_change_speed() { | ||
// wait_until will wait until the robot gets to a desired position | ||
|
||
|
||
// When the robot gets to 12 inches, the robot will travel the remaining distance at a max speed of 40 | ||
chassis.set_drive_pid(24, DRIVE_SPEED, true); | ||
chassis.wait_until(6); | ||
chassis.set_max_speed(40); // After driving 12 inches at DRIVE_SPEED, the robot will go the remaining distance at 40 speed | ||
chassis.wait_drive(); | ||
|
||
chassis.set_turn_pid(45, TURN_SPEED); | ||
chassis.wait_drive(); | ||
|
||
chassis.set_turn_pid(-45, TURN_SPEED); | ||
chassis.wait_drive(); | ||
|
||
chassis.set_turn_pid(0, TURN_SPEED); | ||
chassis.wait_drive(); | ||
|
||
// When the robot gets to -12 inches, the robot will travel the remaining distance at a max speed of 40 | ||
chassis.set_drive_pid(-24, DRIVE_SPEED, true); | ||
chassis.wait_until(-6); | ||
chassis.set_max_speed(40); // After driving 12 inches at DRIVE_SPEED, the robot will go the remaining distance at 40 speed | ||
chassis.wait_drive(); | ||
} | ||
``` | ||
|
||
|
||
--- | ||
|
||
|
||
## Swing Turns | ||
```cpp | ||
void swing_example() { | ||
// The first parameter is ez::LEFT_SWING or ez::RIGHT_SWING | ||
// The second parameter is target degrees | ||
// The third parameter is speed of the moving side of the drive | ||
|
||
|
||
chassis.set_swing_pid(ez::LEFT_SWING, 45, SWING_SPEED); | ||
chassis.wait_drive(); | ||
|
||
chassis.set_drive_pid(24, DRIVE_SPEED, true); | ||
chassis.wait_until(12); | ||
|
||
chassis.set_swing_pid(ez::RIGHT_SWING, 0, SWING_SPEED); | ||
chassis.wait_drive(); | ||
} | ||
``` | ||
|
||
|
||
--- | ||
|
||
|
||
## Combining All Movements | ||
```cpp | ||
void combining_movements() { | ||
chassis.set_drive_pid(24, DRIVE_SPEED, true); | ||
chassis.wait_drive(); | ||
|
||
chassis.set_turn_pid(45, TURN_SPEED); | ||
chassis.wait_drive(); | ||
|
||
chassis.set_drive_pid(ez::RIGHT_SWING, -45, TURN_SPEED); | ||
chassis.wait_drive(); | ||
|
||
chassis.set_turn_pid(0, TURN_SPEED); | ||
chassis.wait_drive(); | ||
|
||
chassis.set_drive_pid(-24, DRIVE_SPEED, true); | ||
chassis.wait_drive(); | ||
} | ||
``` | ||
|
||
|
||
--- | ||
|
||
|
||
## Interference | ||
```cpp | ||
void tug (int attempts) { | ||
for (int i=0; i<attempts-1; i++) { | ||
// Attempt to drive backwards | ||
printf("i - %i", i); | ||
chassis.set_drive_pid(-12, 127); | ||
chassis.wait_drive(); | ||
|
||
// If failsafed... | ||
if (chassis.interfered) { | ||
chassis.reset_drive_sensor(); | ||
chassis.set_drive_pid(-2, 20); | ||
pros::delay(1000); | ||
} | ||
// If robot succesfully drove back, return | ||
else { | ||
return; | ||
} | ||
} | ||
} | ||
|
||
// If there is no interference, robot will drive forward and turn 90 degrees. | ||
// If interfered, robot will drive forward and then attempt to drive backwards. | ||
void interfered_example() { | ||
chassis.set_drive_pid(24, DRIVE_SPEED, true); | ||
chassis.wait_drive(); | ||
|
||
if (chassis.interfered) { | ||
tug(3); | ||
return; | ||
} | ||
|
||
chassis.set_turn_pid(90, TURN_SPEED); | ||
chassis.wait_drive(); | ||
} | ||
``` | ||
--- |
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 |
---|---|---|
|
@@ -2,7 +2,7 @@ | |
layout: default | ||
title: Joystick Curve | ||
parent: Tutorials | ||
nav_order: 2 | ||
nav_order: 3 | ||
--- | ||
|
||
|
||
|
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 |
---|---|---|
@@ -1,8 +1,7 @@ | ||
--- | ||
layout: default | ||
title: EZ-Template | ||
nav_order: 1 | ||
permalink: / | ||
title: 404 | ||
nav_exclude: true | ||
--- | ||
|
||
# EZ-Template | ||
|
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
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