Changed a few variable nemes in the lift rotation file.

I also changed the lift reset function and the auton lift control to instead of looking at the array they will just set the lift target to the specified value.
This commit is contained in:
Carter Essen committed 2026-11-22 20:31:41 -05:00
1 parent ecebf87643
commit 83ac6ad184
3 files changed
+12 -48

No files matched your search

@@ -4,11 +4,10 @@
using namespace ez;
LiftMech::LiftMech() {
liftHeight = 0;
liftError = 0;
liftVelocity = 0;
liftStates = {0, 0, 0, 0};
liftStates = {0, 0};
}
LiftMech::LiftMech(std::initializer_list<int> _liftStates, int _numLiftStates) {
liftStates = _liftStates;
@@ -17,6 +16,11 @@ LiftMech::LiftMech(std::initializer_list<int> _liftStates, int _numLiftStates) {
liftTarget = 0;
set_lift_kp(0.0173f);
}
void LiftMech::lift_control() {
liftError = liftTarget - liftRotation.get_position();
liftVelocity = get_lift_kp() * liftError;
lift.move(-liftVelocity);
}
void LiftMech::lift_driver_control(ControllerR currController, ButtonsR buttonUsed) {
switch (currController)
@@ -66,25 +70,8 @@ void LiftMech::lift_driver_control(ControllerR currController, ButtonsR buttonUs
}
}
void LiftMech::lift_auton_control(int pickState) {
switch (pickState)
{
case 1:
liftTarget = liftStates[0];
break;
case 2:
liftTarget = liftStates[1];
break;
case 3:
liftTarget = liftStates[2];
break;
case 4:
liftTarget = liftStates[3];
break;
default:
liftTarget = liftStates[0];
break;
}
void LiftMech::lift_auton_control(long pickedHeight) {
liftTarget = pickedHeight;
}
void LiftMech::cycle_states() {
@@ -97,28 +84,11 @@ void LiftMech::cycle_states() {
liftTarget = liftStates[currLiftState];
}
}
void LiftMech::reset_state() {
currLiftState = 0;
void LiftMech::reset_state() {liftTarget = 0;}
if (!liftStates.empty()) {
liftTarget = liftStates[currLiftState];
}
}
void LiftMech::set_lift_kp(float _liftKp) {liftKP = _liftKp;}
void LiftMech::lift_control() {
liftError = liftTarget - liftRotation.get_position();
liftVelocity = get_lift_kp() * liftError;
lift.move(-liftVelocity);
}
void LiftMech::set_lift_kp(float _liftKp) {
liftKP = _liftKp;
}
int LiftMech::get_lift_state() {
if (!liftStates.empty()) {
return liftStates[currLiftState];
}
}
int LiftMech::get_lift_state() {return liftStates[currLiftState];}
int LiftMech::get_num_lift_states() {return numLiftStates;}
float LiftMech::get_lift_kp() {return liftKP;}
-5
View File
@@ -40,12 +40,7 @@ namespace ez {
}
// Lift constructor
LiftMech liftObj(
<<<<<<< HEAD
{0, 0, 0, 0}, 4);
=======
{0, -19714, -13017, -27993, -17491, -48393, -37459, -69706, -58957, -89693, -79453, -106664, -99115}, 13);
>>>>>>> 4be5e2958fb4be3d35cbe58b8933bfde5ce90ed3
// Wrist constructor
/*WristMech wristObj(