Skip to content

Commit

Permalink
Final 3.1.0 push. Template and example project finalized
Browse files Browse the repository at this point in the history
  • Loading branch information
ssejrog committed Jun 10, 2024
1 parent 64dd7c1 commit e83d834
Show file tree
Hide file tree
Showing 11 changed files with 49 additions and 37 deletions.
Binary file not shown.
4 changes: 4 additions & 0 deletions EZ-Template-Example-Project/.clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
BasedOnStyle: Google
ColumnLimit: 0
TabWidth: 2
IndentWidth: 2
Binary file not shown.
Binary file modified EZ-Template-Example-Project/firmware/EZ-Template.a
Binary file not shown.
14 changes: 7 additions & 7 deletions EZ-Template-Example-Project/project.pros
Original file line number Diff line number Diff line change
Expand Up @@ -5,28 +5,28 @@
"target": "v5",
"templates": {
"EZ-Template": {
"location": "C:\\Users\\union\\AppData\\Roaming\\PROS\\templates\\[email protected]-RC3",
"location": "C:\\Users\\union\\AppData\\Roaming\\PROS\\templates\\[email protected]",
"metadata": {
"origin": "local"
},
"name": "EZ-Template",
"py/object": "pros.conductor.templates.local_template.LocalTemplate",
"supported_kernels": "^4.1.0",
"system_files": [
"include\\EZ-Template\\drive\\drive.hpp",
"include\\EZ-Template\\sdcard.hpp",
"include\\EZ-Template\\auton_selector.hpp",
"include\\EZ-Template\\api.hpp",
"include\\EZ-Template\\util.hpp",
"include\\EZ-Template\\slew.hpp",
"include\\EZ-Template\\piston.hpp",
"include\\EZ-Template\\PID.hpp",
"include\\EZ-Template\\sdcard.hpp",
"include\\EZ-Template\\auton.hpp",
"include\\EZ-Template\\piston.hpp",
"include\\EZ-Template\\slew.hpp",
"firmware\\EZ-Template.a",
"include\\EZ-Template\\drive\\drive.hpp"
"include\\EZ-Template\\util.hpp"
],
"target": "v5",
"user_files": [],
"version": "3.1.0-RC3"
"version": "3.1.0"
},
"kernel": {
"location": "C:\\Users\\union\\AppData\\Roaming\\PROS\\templates\\[email protected]",
Expand Down
24 changes: 12 additions & 12 deletions EZ-Template-Example-Project/src/autons.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ 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
// for slew, only enable it when the drive distance is greater than the slew distance + a few inches

chassis.pid_drive_set(24_in, DRIVE_SPEED, true);
chassis.pid_wait();
Expand All @@ -53,7 +53,7 @@ void drive_example() {
// Turn Example
///
void turn_example() {
// The first parameter is target degrees
// The first parameter is the target in degrees
// The second parameter is max speed the robot will drive at

chassis.pid_turn_set(90_deg, TURN_SPEED);
Expand Down Expand Up @@ -92,7 +92,7 @@ void drive_and_turn() {
void wait_until_change_speed() {
// pid_wait_until will wait until the robot gets to a desired position

// When the robot gets to 6 inches, the robot will travel the remaining distance at a max speed of 30
// When the robot gets to 6 inches slowly, the robot will travel the remaining distance at full speed
chassis.pid_drive_set(24_in, 30, true);
chassis.pid_wait_until(6_in);
chassis.pid_speed_max_set(DRIVE_SPEED); // After driving 6 inches at 30 speed, the robot will go the remaining distance at DRIVE_SPEED
Expand All @@ -107,7 +107,7 @@ void wait_until_change_speed() {
chassis.pid_turn_set(0_deg, TURN_SPEED);
chassis.pid_wait();

// When the robot gets to -6 inches, the robot will travel the remaining distance at a max speed of 30
// When the robot gets to -6 inches slowly, the robot will travel the remaining distance at full speed
chassis.pid_drive_set(-24_in, 30, true);
chassis.pid_wait_until(-6_in);
chassis.pid_speed_max_set(DRIVE_SPEED); // After driving 6 inches at 30 speed, the robot will go the remaining distance at DRIVE_SPEED
Expand All @@ -119,8 +119,8 @@ void wait_until_change_speed() {
///
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
// The second parameter is the target in degrees
// The third parameter is the speed of the moving side of the drive
// The fourth parameter is the speed of the still side of the drive, this allows for wider arcs

chassis.pid_swing_set(ez::LEFT_SWING, 45_deg, SWING_SPEED, 45);
Expand Down Expand Up @@ -165,13 +165,13 @@ void motion_chaining() {
///
void combining_movements() {
chassis.pid_drive_set(24_in, DRIVE_SPEED, true);
chassis.pid_wait_quick_chain();
chassis.pid_wait();

chassis.pid_turn_set(45_deg, TURN_SPEED);
chassis.pid_wait();

chassis.pid_swing_set(ez::RIGHT_SWING, -45_deg, SWING_SPEED, 45);
chassis.pid_wait_quick_chain();
chassis.pid_wait();

chassis.pid_turn_set(0_deg, TURN_SPEED);
chassis.pid_wait();
Expand All @@ -185,7 +185,7 @@ void combining_movements() {
///
void tug(int attempts) {
for (int i = 0; i < attempts - 1; i++) {
// Attempt to drive backwards
// Attempt to drive backward
printf("i - %i", i);
chassis.pid_drive_set(-12_in, 127);
chassis.pid_wait();
Expand All @@ -196,15 +196,15 @@ void tug(int attempts) {
chassis.pid_drive_set(-2_in, 20);
pros::delay(1000);
}
// If robot successfully drove back, return
// If the robot successfully 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.
// If there is no interference, the robot will drive forward and turn 90 degrees.
// If interfered, the robot will drive forward and then attempt to drive backward.
void interfered_example() {
chassis.pid_drive_set(24_in, DRIVE_SPEED, true);
chassis.pid_wait();
Expand Down
Binary file renamed [email protected][email protected]
Binary file not shown.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ EXCLUDE_COLD_LIBRARIES:=
IS_LIBRARY:=1
# TODO: CHANGE THIS!
LIBNAME:=EZ-Template
VERSION:=3.1.0-RC3
VERSION:=3.1.0
# EXCLUDE_SRC_FROM_LIB= $(SRCDIR)/unpublishedfile.c
# this line excludes opcontrol.c and similar files
EXCLUDE_SRC_FROM_LIB+=$(foreach file, $(SRCDIR)/autons $(SRCDIR)/main,$(foreach cext,$(CEXTS),$(file).$(cext)) $(foreach cxxext,$(CXXEXTS),$(file).$(cxxext)))
Expand Down
16 changes: 12 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@

## Features
- Simple to setup
- PID for driving, turning, and swing turns
- PID for driving, turning, swing turns, and arcs
- Easy to use PID tuner
- Speed ramp-up for driving
- Asynchronous PID with blocking functions until settled and until a specific position has come
- Joystick input curves
Expand All @@ -20,12 +21,19 @@
- 3 wire encoder and rotation sensor support
- Add / remove motors from the drive dynamically to allow for PTO use
- Exposed PID class for use with your other subsystems
- Exposed slew class for gradual speed ramp-up for your other subsystems

## [Installation and Upgrading](https://ez-robotics.github.io/EZ-Template/tutorials/installation)
Installation and Upgrading tutorials can be foud [here](https://ez-robotics.github.io/EZ-Template/tutorials/installation).
## [Discord Server](https://discord.gg/EHjXBcK2Gy)
Need extra assistance using EZ-Template? Feel free to join our [Discord Server](https://discord.gg/EHjXBcK2Gy)!

## [Installation](https://ez-robotics.github.io/EZ-Template/tutorials/installation)
Installation tutorials can be found [here](https://ez-robotics.github.io/EZ-Template/tutorials/installation).

## [Upgrading](https://ez-robotics.github.io/EZ-Template/tutorials/installation)
Upgrading tutorials can be found [here](https://ez-robotics.github.io/EZ-Template/tutorials/upgrading).

## [Tutorials](https://ez-robotics.github.io/EZ-Template/category/tutorials)
Tutorials on how to use and install EZ-Template can be found [here](https://ez-robotics.github.io/EZ-Template/category/tutorials).
Tutorials on how to use and install EZ-Template can be found [here](https://ez-robotics.github.io/EZ-Template/category/tutorials).

## [Docs](https://ez-robotics.github.io/EZ-Template/category/docs)
Documentation on how to use EZ-Template functions can be found [here](https://ez-robotics.github.io/EZ-Template/category/docs).
Expand Down
24 changes: 12 additions & 12 deletions src/autons.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ 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
// for slew, only enable it when the drive distance is greater than the slew distance + a few inches

chassis.pid_drive_set(24_in, DRIVE_SPEED, true);
chassis.pid_wait();
Expand All @@ -53,7 +53,7 @@ void drive_example() {
// Turn Example
///
void turn_example() {
// The first parameter is target degrees
// The first parameter is the target in degrees
// The second parameter is max speed the robot will drive at

chassis.pid_turn_set(90_deg, TURN_SPEED);
Expand Down Expand Up @@ -92,7 +92,7 @@ void drive_and_turn() {
void wait_until_change_speed() {
// pid_wait_until will wait until the robot gets to a desired position

// When the robot gets to 6 inches, the robot will travel the remaining distance at a max speed of 30
// When the robot gets to 6 inches slowly, the robot will travel the remaining distance at full speed
chassis.pid_drive_set(24_in, 30, true);
chassis.pid_wait_until(6_in);
chassis.pid_speed_max_set(DRIVE_SPEED); // After driving 6 inches at 30 speed, the robot will go the remaining distance at DRIVE_SPEED
Expand All @@ -107,7 +107,7 @@ void wait_until_change_speed() {
chassis.pid_turn_set(0_deg, TURN_SPEED);
chassis.pid_wait();

// When the robot gets to -6 inches, the robot will travel the remaining distance at a max speed of 30
// When the robot gets to -6 inches slowly, the robot will travel the remaining distance at full speed
chassis.pid_drive_set(-24_in, 30, true);
chassis.pid_wait_until(-6_in);
chassis.pid_speed_max_set(DRIVE_SPEED); // After driving 6 inches at 30 speed, the robot will go the remaining distance at DRIVE_SPEED
Expand All @@ -119,8 +119,8 @@ void wait_until_change_speed() {
///
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
// The second parameter is the target in degrees
// The third parameter is the speed of the moving side of the drive
// The fourth parameter is the speed of the still side of the drive, this allows for wider arcs

chassis.pid_swing_set(ez::LEFT_SWING, 45_deg, SWING_SPEED, 45);
Expand Down Expand Up @@ -165,13 +165,13 @@ void motion_chaining() {
///
void combining_movements() {
chassis.pid_drive_set(24_in, DRIVE_SPEED, true);
chassis.pid_wait_quick_chain();
chassis.pid_wait();

chassis.pid_turn_set(45_deg, TURN_SPEED);
chassis.pid_wait();

chassis.pid_swing_set(ez::RIGHT_SWING, -45_deg, SWING_SPEED, 45);
chassis.pid_wait_quick_chain();
chassis.pid_wait();

chassis.pid_turn_set(0_deg, TURN_SPEED);
chassis.pid_wait();
Expand All @@ -185,7 +185,7 @@ void combining_movements() {
///
void tug(int attempts) {
for (int i = 0; i < attempts - 1; i++) {
// Attempt to drive backwards
// Attempt to drive backward
printf("i - %i", i);
chassis.pid_drive_set(-12_in, 127);
chassis.pid_wait();
Expand All @@ -196,15 +196,15 @@ void tug(int attempts) {
chassis.pid_drive_set(-2_in, 20);
pros::delay(1000);
}
// If robot successfully drove back, return
// If the robot successfully 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.
// If there is no interference, the robot will drive forward and turn 90 degrees.
// If interfered, the robot will drive forward and then attempt to drive backward.
void interfered_example() {
chassis.pid_drive_set(24_in, DRIVE_SPEED, true);
chassis.pid_wait();
Expand Down
2 changes: 1 addition & 1 deletion version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.1.0-RC3
3.1.0

0 comments on commit e83d834

Please sign in to comment.