-
Notifications
You must be signed in to change notification settings - Fork 0
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
1 parent
23f7688
commit fd7a242
Showing
334 changed files
with
20,260 additions
and
46,669 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 |
---|---|---|
@@ -0,0 +1,13 @@ | ||
name: Build | ||
|
||
# Controls when the workflow will run | ||
on: [push, pull_request, workflow_dispatch] | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Check out repository code | ||
uses: actions/checkout@v2 | ||
- name: Builds Code | ||
uses: fishsticks89/pros-build@v1 |
Binary file not shown.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
[![Build](https://github.com/KSUOwlBots/OPTIMUS-15-MAIN/actions/workflows/main.yml/badge.svg)](https://github.com/KSUOwlBots/OPTIMUS-15-MAIN/actions/workflows/main.yml) |
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
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
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,205 @@ | ||
/* | ||
This Source Code Form is subject to the terms of the Mozilla Public | ||
License, v. 2.0. If a copy of the MPL was not distributed with this | ||
file, You can obtain one at http://mozilla.org/MPL/2.0/. | ||
*/ | ||
|
||
#pragma once | ||
|
||
#include "EZ-Template/util.hpp" | ||
#include "api.h" | ||
|
||
namespace ez { | ||
class PID { | ||
public: | ||
/** | ||
* Default constructor. | ||
*/ | ||
PID(); | ||
|
||
/** | ||
* Constructor with constants. | ||
* | ||
* \param p | ||
* kP | ||
* \param i | ||
* ki | ||
* \param d | ||
* kD | ||
* \param p_start_i | ||
* error value that i starts within | ||
* \param name | ||
* std::string of name that prints | ||
*/ | ||
PID(double p, double i = 0, double d = 0, double start_i = 0, std::string name = ""); | ||
|
||
/** | ||
* Set constants for PID. | ||
* | ||
* \param p | ||
* kP | ||
* \param i | ||
* ki | ||
* \param d | ||
* kD | ||
* \param p_start_i | ||
* error value that i starts within | ||
*/ | ||
void constants_set(double p, double i = 0, double d = 0, double p_start_i = 0); | ||
|
||
/** | ||
* Struct for constants. | ||
*/ | ||
struct Constants { | ||
double kp; | ||
double ki; | ||
double kd; | ||
double start_i; | ||
}; | ||
|
||
/** | ||
* Struct for exit condition. | ||
*/ | ||
struct exit_condition_ { | ||
int small_exit_time = 0; | ||
double small_error = 0; | ||
int big_exit_time = 0; | ||
double big_error = 0; | ||
int velocity_exit_time = 0; | ||
int mA_timeout = 0; | ||
}; | ||
|
||
/** | ||
* Set's constants for exit conditions. | ||
* | ||
* \param p_small_exit_time | ||
* Sets small_exit_time. Timer for to exit within smalL_error. | ||
* \param p_small_error | ||
* Sets smalL_error. Timer will start when error is within this. | ||
* \param p_big_exit_time | ||
* Sets big_exit_time. Timer for to exit within big_error. | ||
* \param p_big_error | ||
* Sets big_error. Timer will start when error is within this. | ||
* \param p_velocity_exit_time | ||
* Sets velocity_exit_time. Timer will start when velocity is 0. | ||
*/ | ||
void exit_condition_set(int p_small_exit_time, double p_small_error, int p_big_exit_time = 0, double p_big_error = 0, int p_velocity_exit_time = 0, int p_mA_timeout = 0); | ||
|
||
/** | ||
* Sets target. | ||
* | ||
* \param target | ||
* Target for PID. | ||
*/ | ||
void target_set(double input); | ||
|
||
/** | ||
* Computes PID. | ||
* | ||
* \param current | ||
* Current sensor library. | ||
*/ | ||
double compute(double current); | ||
|
||
/** | ||
* Returns target value. | ||
*/ | ||
double target_get(); | ||
|
||
/** | ||
* Returns constants. | ||
*/ | ||
Constants constants_get(); | ||
|
||
/** | ||
* Resets all variables to 0. This does not reset constants. | ||
*/ | ||
void variables_reset(); | ||
|
||
/** | ||
* Constants | ||
*/ | ||
Constants constants; | ||
|
||
/** | ||
* Exit | ||
*/ | ||
exit_condition_ exit; | ||
|
||
/** | ||
* Iterative exit condition for PID. | ||
* | ||
* \param print = false | ||
* if true, prints when complete. | ||
*/ | ||
ez::exit_output exit_condition(bool print = false); | ||
|
||
/** | ||
* Iterative exit condition for PID. | ||
* | ||
* \param sensor | ||
* A pros motor on your mechanism. | ||
* \param print = false | ||
* if true, prints when complete. | ||
*/ | ||
ez::exit_output exit_condition(pros::Motor sensor, bool print = false); | ||
|
||
/** | ||
* Iterative exit condition for PID. | ||
* | ||
* \param sensor | ||
* Pros motors on your mechanism. | ||
* \param print = false | ||
* if true, prints when complete. | ||
*/ | ||
ez::exit_output exit_condition(std::vector<pros::Motor> sensor, bool print = false); | ||
|
||
/** | ||
* Sets the name of the PID that prints during exit conditions. | ||
* | ||
* \param name | ||
* a string that is the name you want to print | ||
*/ | ||
void name_set(std::string name); | ||
|
||
/** | ||
* Returns the name of the PID that prints during exit conditions. | ||
*/ | ||
std::string name_get(); | ||
|
||
/** | ||
* Enables / disables i resetting when sgn of error changes. True resets, false doesn't. | ||
* | ||
* \param toggle | ||
* true resets, false doesn't | ||
*/ | ||
void i_reset_toggle(bool toggle); | ||
|
||
/** | ||
* Returns if i will reset when sgn of error changes. True resets, false doesn't. | ||
*/ | ||
bool i_reset_get(); | ||
|
||
/** | ||
* PID variables. | ||
*/ | ||
double output; | ||
double cur; | ||
double error; | ||
double target; | ||
double prev_error; | ||
double integral; | ||
double derivative; | ||
long time; | ||
long prev_time; | ||
|
||
private: | ||
int i = 0, j = 0, k = 0, l = 0; | ||
bool is_mA = false; | ||
void timers_reset(); | ||
std::string name; | ||
bool name_active = false; | ||
void exit_condition_print(ez::exit_output exit_type); | ||
bool reset_i_sgn = true; | ||
}; | ||
}; // namespace ez |
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,16 @@ | ||
/* | ||
This Source Code Form is subject to the terms of the Mozilla Public | ||
License, v. 2.0. If a copy of the MPL was not distributed with this | ||
file, You can obtain one at http://mozilla.org/MPL/2.0/. | ||
*/ | ||
|
||
#pragma once | ||
|
||
#include "EZ-Template/PID.hpp" | ||
#include "EZ-Template/auton.hpp" | ||
#include "EZ-Template/auton_selector.hpp" | ||
#include "EZ-Template/drive/drive.hpp" | ||
#include "EZ-Template/piston.hpp" | ||
#include "EZ-Template/sdcard.hpp" | ||
#include "EZ-Template/slew.hpp" | ||
#include "EZ-Template/util.hpp" |
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,21 @@ | ||
/* | ||
This Source Code Form is subject to the terms of the Mozilla Public | ||
License, v. 2.0. If a copy of the MPL was not distributed with this | ||
file, You can obtain one at http://mozilla.org/MPL/2.0/. | ||
*/ | ||
|
||
#pragma once | ||
#include <functional> | ||
#include <iostream> | ||
|
||
namespace ez { | ||
class Auton { | ||
public: | ||
Auton(); | ||
Auton(std::string, std::function<void()>); | ||
std::string Name; | ||
std::function<void()> auton_call; | ||
|
||
private: | ||
}; | ||
} // namespace ez |
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,26 @@ | ||
/* | ||
This Source Code Form is subject to the terms of the Mozilla Public | ||
License, v. 2.0. If a copy of the MPL was not distributed with this | ||
file, You can obtain one at http://mozilla.org/MPL/2.0/. | ||
*/ | ||
|
||
#pragma once | ||
#include <tuple> | ||
|
||
#include "EZ-Template/auton.hpp" | ||
|
||
using namespace std; | ||
|
||
namespace ez { | ||
class AutonSelector { | ||
public: | ||
std::vector<Auton> Autons; | ||
int auton_page_current; | ||
int auton_count; | ||
AutonSelector(); | ||
AutonSelector(std::vector<Auton> autons); | ||
void selected_auton_call(); | ||
void selected_auton_print(); | ||
void autons_add(std::vector<Auton> autons); | ||
}; | ||
} // namespace ez |
Oops, something went wrong.