diff --git a/src/EZ-Template/rotation_mechanisms/lift_rotation.cpp b/src/EZ-Template/rotation_mechanisms/lift_rotation.cpp index 9ebf4fd..d0b056d 100644 --- a/src/EZ-Template/rotation_mechanisms/lift_rotation.cpp +++ b/src/EZ-Template/rotation_mechanisms/lift_rotation.cpp @@ -21,79 +21,39 @@ LiftMech::LiftMech(std::initializer_list _liftStates, int _numLiftStates) { void LiftMech::lift_driver_control(ControllerR currController, ButtonsR buttonUsed) { 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: switch (buttonUsed) { case ButtonsR::arrow_buttons: - if (slave.get_digital(DIGITAL_RIGHT)) { + if (master.get_digital(DIGITAL_RIGHT)) { cycle_states(); } - else if (slave.get_digital(DIGITAL_DOWN)) { + else if (master.get_digital(DIGITAL_DOWN)) { reset_state(); } break; case ButtonsR::Y_B_buttons: - if (slave.get_digital(DIGITAL_Y)) { + if (master.get_digital(DIGITAL_Y)) { cycle_states(); } - else if (slave.get_digital(DIGITAL_B)) { + else if (master.get_digital(DIGITAL_B)) { reset_state(); } break; case ButtonsR::left_shoulder_buttons: - if (slave.get_digital(DIGITAL_L1)) { + if (master.get_digital(DIGITAL_L1)) { cycle_states(); } - else if (slave.get_digital(DIGITAL_L2)) { + else if (master.get_digital(DIGITAL_L2)) { reset_state(); } break; case ButtonsR::right_shoulder_buttons: - if (slave.get_digital(DIGITAL_R1)) { + if (master.get_digital(DIGITAL_R1)) { cycle_states(); } - else if (slave.get_digital(DIGITAL_R2)) { + else if (master.get_digital(DIGITAL_R2)) { reset_state(); } break; @@ -127,7 +87,7 @@ void LiftMech::reset_state() { void LiftMech::lift_control() { liftError = liftTarget - liftRotation.get_position(); liftVelocity = get_lift_kp() * liftError; - lift.move(liftVelocity); + lift.move(-liftVelocity); } void LiftMech::set_lift_kp(float _liftKp) { diff --git a/src/main.cpp b/src/main.cpp index cc9313d..3319b10 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -41,7 +41,7 @@ namespace ez { // Lift constructor LiftMech liftObj( - {0, }, 4); + {0, -19714, -13017, -27993, -17491, -48393, -37459, -69706, -58957, -89693, -79453, -106664, -99115}, 13); // Wrist constructor /*WristMech wristObj( @@ -77,12 +77,12 @@ void initialize() { liftRotation.reset_position(); //wristRotation.reset_position(); - /*pros::Task liftControlTasck([&]{ + pros::Task liftControlTasck([&]{ while (true) { liftObj.lift_control(); 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 // - 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 pistonControl.control_piston(PistonsP::PlaceHolderP, ControlPeriodP::driver, ControllerP::master, ButtonsP::arrow_buttons); - motorControl.motor_control(ControlPeriodM::driver, ControllerM::master, ButtonsM::right_shoulder_buttons, - MotorGroups::lift_MG, 127, -127); + /*motorControl.motor_control(ControlPeriodM::driver, ControllerM::master, ButtonsM::right_shoulder_buttons, + MotorGroups::lift_MG, 127, -127);*/ motorControl.motor_control(ControlPeriodM::driver, ControllerM::master, ButtonsM::left_shoulder_buttons, MotorGroups::claw_M, -127, 127); motorControl.motor_control(ControlPeriodM::driver, ControllerM::master, ButtonsM::Y_B_buttons, @@ -354,7 +354,7 @@ void opcontrol() { wrist.brake(); }*/ //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); //liftObj.lift_driver_control(ControllerR::slave, ButtonsR::right_shoulder_buttons);