From 0e8b70cf399b6153a2c4717c13e9668594986a47 Mon Sep 17 00:00:00 2001 From: Carter Date: Thu, 3 Sep 2026 08:50:46 -0400 Subject: [PATCH] Fixed a bug with how the controllers where being setup and added include paths to the pid_tuner and pid_input files, also fixed a bug where I forgot to setup the default constructor for all the new classes I made. --- include/setup/initialize.hpp | 6 +++--- src/EZ-Template/drive/pid_tuner.cpp | 1 + src/EZ-Template/drive/user_input.cpp | 1 + src/EZ-Template/pneumatics.cpp | 10 ++++++---- src/EZ-Template/rotation_mechanisms/arm_rotation.cpp | 1 + src/EZ-Template/rotation_mechanisms/lift_rotation.cpp | 1 + src/EZ-Template/rotation_mechanisms/wrist_rotation.cpp | 1 + src/main.cpp | 6 +++--- 8 files changed, 17 insertions(+), 10 deletions(-) diff --git a/include/setup/initialize.hpp b/include/setup/initialize.hpp index 724cbdd..67c87ff 100644 --- a/include/setup/initialize.hpp +++ b/include/setup/initialize.hpp @@ -10,8 +10,8 @@ /** * */ -inline pros::Controller master; -inline pros::Controller slave; +inline pros::Controller master(pros::E_CONTROLLER_MASTER); +inline pros::Controller slave(pros::E_CONTROLLER_PARTNER); /** * Declare mechinism motors @@ -23,7 +23,7 @@ inline pros::Motor arm({12}); /** * Declare pistons here */ -inline ez::Piston claw({'A',true}); +inline ez::Piston claw({'G',true}); /** * Declare sensors here diff --git a/src/EZ-Template/drive/pid_tuner.cpp b/src/EZ-Template/drive/pid_tuner.cpp index 5b80881..d9a76d2 100644 --- a/src/EZ-Template/drive/pid_tuner.cpp +++ b/src/EZ-Template/drive/pid_tuner.cpp @@ -4,6 +4,7 @@ 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/. */ +#include "setup/initialize.hpp" #include "EZ-Template/drive/drive.hpp" #include "EZ-Template/sdcard.hpp" #include "EZ-Template/util.hpp" diff --git a/src/EZ-Template/drive/user_input.cpp b/src/EZ-Template/drive/user_input.cpp index bd4e9e6..36d8720 100644 --- a/src/EZ-Template/drive/user_input.cpp +++ b/src/EZ-Template/drive/user_input.cpp @@ -4,6 +4,7 @@ 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/. */ +#include "setup/initialize.hpp" #include "EZ-Template/PID.hpp" #include "EZ-Template/drive/drive.hpp" #include "pros/misc.h" diff --git a/src/EZ-Template/pneumatics.cpp b/src/EZ-Template/pneumatics.cpp index 259e7d8..7e6896e 100644 --- a/src/EZ-Template/pneumatics.cpp +++ b/src/EZ-Template/pneumatics.cpp @@ -3,6 +3,8 @@ using namespace ez; +Pneumatics::Pneumatics(){} + void Pneumatics::control_piston(Pistons activePiston, ControlPeriod currPeriod, Controller currController, Buttons buttonUsed) { if (currPeriod == ControlPeriod::driver) { @@ -19,10 +21,10 @@ void Pneumatics::control_piston(Pistons activePiston, ControlPeriod currPeriod, switch (buttonUsed) { case Buttons::arrow_buttons: - if (master.get_digital(DIGITAL_LEFT)) { + if (master.get_digital(DIGITAL_RIGHT)) { claw.set(true); } - else if (master.get_digital(DIGITAL_RIGHT)) { + else if (master.get_digital(DIGITAL_DOWN)) { claw.set(false); } break; @@ -59,10 +61,10 @@ void Pneumatics::control_piston(Pistons activePiston, ControlPeriod currPeriod, switch (buttonUsed) { case Buttons::arrow_buttons: - if (slave.get_digital(DIGITAL_LEFT)) { + if (slave.get_digital(DIGITAL_RIGHT)) { claw.set(true); } - else if (slave.get_digital(DIGITAL_RIGHT)) { + else if (slave.get_digital(DIGITAL_DOWN)) { claw.set(false); } break; diff --git a/src/EZ-Template/rotation_mechanisms/arm_rotation.cpp b/src/EZ-Template/rotation_mechanisms/arm_rotation.cpp index 325a9de..b3df61c 100644 --- a/src/EZ-Template/rotation_mechanisms/arm_rotation.cpp +++ b/src/EZ-Template/rotation_mechanisms/arm_rotation.cpp @@ -3,6 +3,7 @@ using namespace ez; +ArmMech::ArmMech() {} ArmMech::ArmMech(std::initializer_list _armStates, int _numArmStates) { armStates = _armStates; numArmStates = _numArmStates; diff --git a/src/EZ-Template/rotation_mechanisms/lift_rotation.cpp b/src/EZ-Template/rotation_mechanisms/lift_rotation.cpp index b30f1e5..0196997 100644 --- a/src/EZ-Template/rotation_mechanisms/lift_rotation.cpp +++ b/src/EZ-Template/rotation_mechanisms/lift_rotation.cpp @@ -3,6 +3,7 @@ using namespace ez; +LiftMech::LiftMech() {} LiftMech::LiftMech(std::initializer_list _liftStates, int _numLiftStates) { liftStates = _liftStates; numLiftStates = _numLiftStates; diff --git a/src/EZ-Template/rotation_mechanisms/wrist_rotation.cpp b/src/EZ-Template/rotation_mechanisms/wrist_rotation.cpp index 2d23e06..d52bfc6 100644 --- a/src/EZ-Template/rotation_mechanisms/wrist_rotation.cpp +++ b/src/EZ-Template/rotation_mechanisms/wrist_rotation.cpp @@ -3,6 +3,7 @@ using namespace ez; +WristMech::WristMech(){} WristMech::WristMech(std::initializer_list _wristStates, int _numWristStates) { wristStates = _wristStates; numWristStates = _numWristStates; diff --git a/src/main.cpp b/src/main.cpp index d301b0d..47ee5b6 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -9,8 +9,8 @@ WristMech wristObj; // Chassis constructor ez::Drive chassis( // These are your drive motors, the first motor is used for sensing! - {-1, -2}, // Left Chassis Ports (negative port will reverse it!) - {3, 4}, // Right Chassis Ports (negative port will reverse it!) + {12, 14}, // Left Chassis Ports (negative port will reverse it!) + {-11, -13}, // Right Chassis Ports (negative port will reverse it!) 21, // IMU Port 3.25, // Wheel Diameter (Remember, 4" wheels without screw holes are actually 4.125!) @@ -284,7 +284,7 @@ void opcontrol() { // Call custom drive functions here pistonControl.control_piston(Pistons::claw_piston, ControlPeriod::driver, - Controller::master, Buttons::arrow_buttons); + Controller::slave, Buttons::arrow_buttons); // chassis.opcontrol_tank(); // Tank control chassis.opcontrol_arcade_standard(ez::SPLIT); // Standard split arcade