Small changes.
This commit is contained in:
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) {
|
||||
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) {
|
||||
|
||||
Reference in new issue
Block a user