First I changed the names for the mechanisms to match the current robot setup. I then made a new header file for the mechansims and a new cpp file for the mechanisms. The mechanisms now work the same way a piston works by allowing you to call the functions and input all the different variables inline. I also had to comment out all the old rotation code because of the changed names and not actually useing them, for now i'm just going to keep all the code where it is so I can look back on it for the future.

This commit is contained in:
Carter committed 2026-11-04 16:59:34 -05:00
1 parent 24ee947fd5
commit 94f88d09d6
11 files changed
+370 -84

No files matched your search

+49
View File
@@ -0,0 +1,49 @@
#pragma once
#include "api.h"
#include "pros/adi.hpp"
#include "pros/motors.hpp"
#include "pros/motor_group.hpp"
namespace ez {
enum class ControlPeriodM {
driver,
auton
};
enum class ControllerM {
master,
slave
};
enum class ButtonsM {
arrow_buttons,
Y_B_buttons,
left_shoulder_buttons,
right_shoulder_buttons
};
enum class MotorGroups {
lift_MG,
claw_M,
roller_M
};
class Mechanisms {
private:
public:
float fw_motor_speed = 0;
float rev_motor_speed = 0;
Mechanisms();
void motor_control(enum ControlPeriodM, enum ControllerM, enum ButtonsM, enum MotorGroups, float fw_motor_speed, float rev_motor_speed);
float get_motor_speed();
float set_motor_speed(float value);
};
};
+1 -1
View File
@@ -33,7 +33,7 @@ namespace ez {
* Enumeration to hold all the pistons avalable.
*/
enum class PistonsP {
claw_piston
PlaceHolderP
};
class Pneumatics{
@@ -60,6 +60,7 @@ namespace ez{
void arm_auton_control(int pickState);
void cycle_states();
void reset_state();
void hard_reset_arm(); // Once the arm hits a button the rotation sensor value is reset to 0
void arm_control(); // Computes the velocity for the arm to move at.
void set_arm_kp(float _armKP);