Skip to content

Commit

Permalink
Added more gets, removed version # from print #73
Browse files Browse the repository at this point in the history
The version number in `ez_template_print` was redundant when version can be checked through pros cli.
  • Loading branch information
ssejrog committed Nov 24, 2023
1 parent 7de75fd commit f08fbb4
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 7 deletions.
5 changes: 5 additions & 0 deletions include/EZ-Template/drive/drive.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -412,6 +412,11 @@ class Drive {
*/
void drive_set(int left, int right);

/**
* Gets the chassis to voltage, -127 to 127. Returns {left, right}
*/
std::vector<int> drive_get();

/**
* Changes the way the drive behaves when it is not under active user control
*
Expand Down
10 changes: 8 additions & 2 deletions src/EZ-Template/drive/drive.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,12 @@ void Drive::drive_set(int left, int right) {
private_drive_set(left, right);
}

std::vector<int> Drive::drive_get() {
int left = left_motors[0].get_voltage() / (12000.0 / 127.0);
int right = right_motors[0].get_voltage() / (12000.0 / 127.0);
return {left, right};
}

void Drive::drive_current_limit_set(int mA) {
if (abs(mA) > 2500) {
mA = 2500;
Expand Down Expand Up @@ -340,5 +346,5 @@ void Drive::initialize() {
void Drive::pid_drive_toggle(bool toggle) { drive_toggle = toggle; }
void Drive::pid_print_toggle(bool toggle) { print_toggle = toggle; }

bool Drive::pid_drive_toggle_get() {return drive_toggle;}
bool Drive::pid_print_toggle_get() {return print_toggle;}
bool Drive::pid_drive_toggle_get() { return drive_toggle; }
bool Drive::pid_print_toggle_get() { return print_toggle; }
4 changes: 2 additions & 2 deletions src/EZ-Template/drive/exit_conditions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ void Drive::pid_wait() {
turn_exit = turn_exit != RUNNING ? turn_exit : turnPID.exit_condition({left_motors[0], right_motors[0]});
pros::delay(util::DELAY_TIME);
}
if (print_toggle) std::cout << " Turn: " << exit_to_string(turn_exit) << " Exit, error:" << turnPID.error << ".\n";
if (print_toggle) std::cout << " Turn: " << exit_to_string(turn_exit) << " Exit, error: " << turnPID.error << ".\n";

if (turn_exit == mA_EXIT || turn_exit == VELOCITY_EXIT) {
interfered = true;
Expand All @@ -88,7 +88,7 @@ void Drive::pid_wait() {
swing_exit = swing_exit != RUNNING ? swing_exit : swingPID.exit_condition(sensor);
pros::delay(util::DELAY_TIME);
}
if (print_toggle) std::cout << " Swing: " << exit_to_string(swing_exit) << " Exit, error:" << swingPID.error << ".\n";
if (print_toggle) std::cout << " Swing: " << exit_to_string(swing_exit) << " Exit, error: " << swingPID.error << ".\n";

if (swing_exit == mA_EXIT || swing_exit == VELOCITY_EXIT) {
interfered = true;
Expand Down
2 changes: 1 addition & 1 deletion src/EZ-Template/drive/user_input.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ double Drive::opcontrol_curve_left(double x) {
return x;
}

// Right curve fnuction
// Right curve function
double Drive::opcontrol_curve_right(double x) {
if (right_curve_scale != 0) {
// if (CURVE_TYPE)
Expand Down
2 changes: 0 additions & 2 deletions src/EZ-Template/util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@ void ez_template_print() {
| |
|_|
)" << '\n';

printf("Version: 2.2.0-RC2\n");
}
std::string get_last_word(std::string text) {
std::string word = "";
Expand Down

0 comments on commit f08fbb4

Please sign in to comment.