Small changes.

This commit is contained in:
Carter committed 2026-11-22 17:12:03 -05:00
1 parent 7bf206c454
commit 4be5e2958f
2 files changed
+15 -55

No files matched your search

@@ -21,79 +21,39 @@ LiftMech::LiftMech(std::initializer_list<int> _liftStates, int _numLiftStates) {
void LiftMech::lift_driver_control(ControllerR currController, ButtonsR buttonUsed) { void LiftMech::lift_driver_control(ControllerR currController, ButtonsR buttonUsed) {
switch (currController) switch (currController)
{ {
case ControllerR::slave:
switch (buttonUsed)
{
case ButtonsR::arrow_buttons:
if (master.get_digital(DIGITAL_RIGHT)) {
lift.move(127);
}
else if (master.get_digital(DIGITAL_DOWN)) {
lift.move(-127);
}
break;
case ButtonsR::Y_B_buttons:
if (master.get_digital(DIGITAL_Y)) {
lift.move(127);
}
else if (master.get_digital(DIGITAL_B)) {
lift.move(-127);
}
break;
case ButtonsR::left_shoulder_buttons:
if (master.get_digital(DIGITAL_L1)) {
lift.move(127);
}
else if (master.get_digital(DIGITAL_L2)) {
lift.move(-127);
}
break;
case ButtonsR::right_shoulder_buttons:
if (master.get_digital(DIGITAL_R1)) {
lift.move(127);
}
else if (master.get_digital(DIGITAL_R2)) {
lift.move(-127);
}
break;
default:
break;
}
break;
case ControllerR::master: case ControllerR::master:
switch (buttonUsed) switch (buttonUsed)
{ {
case ButtonsR::arrow_buttons: case ButtonsR::arrow_buttons:
if (slave.get_digital(DIGITAL_RIGHT)) { if (master.get_digital(DIGITAL_RIGHT)) {
cycle_states(); cycle_states();
} }
else if (slave.get_digital(DIGITAL_DOWN)) { else if (master.get_digital(DIGITAL_DOWN)) {
reset_state(); reset_state();
} }
break; break;
case ButtonsR::Y_B_buttons: case ButtonsR::Y_B_buttons:
if (slave.get_digital(DIGITAL_Y)) { if (master.get_digital(DIGITAL_Y)) {
cycle_states(); cycle_states();
} }
else if (slave.get_digital(DIGITAL_B)) { else if (master.get_digital(DIGITAL_B)) {
reset_state(); reset_state();
} }
break; break;
case ButtonsR::left_shoulder_buttons: case ButtonsR::left_shoulder_buttons:
if (slave.get_digital(DIGITAL_L1)) { if (master.get_digital(DIGITAL_L1)) {
cycle_states(); cycle_states();
} }
else if (slave.get_digital(DIGITAL_L2)) { else if (master.get_digital(DIGITAL_L2)) {
reset_state(); reset_state();
} }
break; break;
case ButtonsR::right_shoulder_buttons: case ButtonsR::right_shoulder_buttons:
if (slave.get_digital(DIGITAL_R1)) { if (master.get_digital(DIGITAL_R1)) {
cycle_states(); cycle_states();
} }
else if (slave.get_digital(DIGITAL_R2)) { else if (master.get_digital(DIGITAL_R2)) {
reset_state(); reset_state();
} }
break; break;
@@ -127,7 +87,7 @@ void LiftMech::reset_state() {
void LiftMech::lift_control() { void LiftMech::lift_control() {
liftError = liftTarget - liftRotation.get_position(); liftError = liftTarget - liftRotation.get_position();
liftVelocity = get_lift_kp() * liftError; liftVelocity = get_lift_kp() * liftError;
lift.move(liftVelocity); lift.move(-liftVelocity);
} }
void LiftMech::set_lift_kp(float _liftKp) { void LiftMech::set_lift_kp(float _liftKp) {
+6 -6
View File
@@ -41,7 +41,7 @@ namespace ez {
// Lift constructor // Lift constructor
LiftMech liftObj( LiftMech liftObj(
{0, }, 4); {0, -19714, -13017, -27993, -17491, -48393, -37459, -69706, -58957, -89693, -79453, -106664, -99115}, 13);
// Wrist constructor // Wrist constructor
/*WristMech wristObj( /*WristMech wristObj(
@@ -77,12 +77,12 @@ void initialize() {
liftRotation.reset_position(); liftRotation.reset_position();
//wristRotation.reset_position(); //wristRotation.reset_position();
/*pros::Task liftControlTasck([&]{ pros::Task liftControlTasck([&]{
while (true) { while (true) {
liftObj.lift_control(); liftObj.lift_control();
pros::delay(10); pros::delay(10);
} }
});*/ });
// Look at your horizontal tracking wheel and decide if it's in front of the midline of your robot or behind it // Look at your horizontal tracking wheel and decide if it's in front of the midline of your robot or behind it
// - change `back` to `front` if the tracking wheel is in front of the midline // - change `back` to `front` if the tracking wheel is in front of the midline
@@ -313,8 +313,8 @@ void opcontrol() {
// Call custom drive functions here // Call custom drive functions here
pistonControl.control_piston(PistonsP::PlaceHolderP, ControlPeriodP::driver, pistonControl.control_piston(PistonsP::PlaceHolderP, ControlPeriodP::driver,
ControllerP::master, ButtonsP::arrow_buttons); ControllerP::master, ButtonsP::arrow_buttons);
motorControl.motor_control(ControlPeriodM::driver, ControllerM::master, ButtonsM::right_shoulder_buttons, /*motorControl.motor_control(ControlPeriodM::driver, ControllerM::master, ButtonsM::right_shoulder_buttons,
MotorGroups::lift_MG, 127, -127); MotorGroups::lift_MG, 127, -127);*/
motorControl.motor_control(ControlPeriodM::driver, ControllerM::master, ButtonsM::left_shoulder_buttons, motorControl.motor_control(ControlPeriodM::driver, ControllerM::master, ButtonsM::left_shoulder_buttons,
MotorGroups::claw_M, -127, 127); MotorGroups::claw_M, -127, 127);
motorControl.motor_control(ControlPeriodM::driver, ControllerM::master, ButtonsM::Y_B_buttons, motorControl.motor_control(ControlPeriodM::driver, ControllerM::master, ButtonsM::Y_B_buttons,
@@ -354,7 +354,7 @@ void opcontrol() {
wrist.brake(); wrist.brake();
}*/ }*/
//armObj.arm_driver_control(ControllerR::master, ButtonsR::left_shoulder_buttons); //armObj.arm_driver_control(ControllerR::master, ButtonsR::left_shoulder_buttons);
//liftObj.lift_driver_control(ControllerR::master, ButtonsR::right_shoulder_buttons); liftObj.lift_driver_control(ControllerR::master, ButtonsR::right_shoulder_buttons);
//armObj.arm_driver_control(ControllerR::slave, ButtonsR::left_shoulder_buttons); //armObj.arm_driver_control(ControllerR::slave, ButtonsR::left_shoulder_buttons);
//liftObj.lift_driver_control(ControllerR::slave, ButtonsR::right_shoulder_buttons); //liftObj.lift_driver_control(ControllerR::slave, ButtonsR::right_shoulder_buttons);