Compare commits
2
Commits
4be5e2958f
...
ecebf87643
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ecebf87643 | ||
|
|
d9db3ee688 |
No files matched your search
@@ -66,6 +66,27 @@ 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::cycle_states() {
|
void LiftMech::cycle_states() {
|
||||||
currLiftState ++;
|
currLiftState ++;
|
||||||
|
|
||||||
@@ -162,39 +183,39 @@ void LiftMech::lift_driver_control(ControllerR currController, ButtonsR buttonUs
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case ControllerR::slave:
|
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;
|
||||||
|
|||||||
+6
-34
@@ -25,7 +25,7 @@ Mechanisms motorControl;
|
|||||||
//ArmMech armObj;
|
//ArmMech armObj;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This is creating and initializing and instance of the Optical sensors structure
|
* Creates and initializes and instance of the Optical sensors structure
|
||||||
*
|
*
|
||||||
* Finds the memory location of the two color sensors, which then the "mySensors" container
|
* Finds the memory location of the two color sensors, which then the "mySensors" container
|
||||||
* gives to the pointers. So now the pointers have somewhere to point to in memory.
|
* gives to the pointers. So now the pointers have somewhere to point to in memory.
|
||||||
@@ -41,7 +41,11 @@ namespace ez {
|
|||||||
// Lift constructor
|
// Lift constructor
|
||||||
LiftMech liftObj(
|
LiftMech liftObj(
|
||||||
|
|
||||||
|
<<<<<<< HEAD
|
||||||
|
{0, 0, 0, 0}, 4);
|
||||||
|
=======
|
||||||
{0, -19714, -13017, -27993, -17491, -48393, -37459, -69706, -58957, -89693, -79453, -106664, -99115}, 13);
|
{0, -19714, -13017, -27993, -17491, -48393, -37459, -69706, -58957, -89693, -79453, -106664, -99115}, 13);
|
||||||
|
>>>>>>> 4be5e2958fb4be3d35cbe58b8933bfde5ce90ed3
|
||||||
|
|
||||||
// Wrist constructor
|
// Wrist constructor
|
||||||
/*WristMech wristObj(
|
/*WristMech wristObj(
|
||||||
@@ -321,38 +325,6 @@ void opcontrol() {
|
|||||||
MotorGroups::roller_M, 127, 0);
|
MotorGroups::roller_M, 127, 0);
|
||||||
|
|
||||||
// Basic control scheme
|
// Basic control scheme
|
||||||
/*arm.set_brake_mode(MOTOR_BRAKE_HOLD);
|
|
||||||
if (master.get_digital(DIGITAL_L1)) {
|
|
||||||
arm.move(90);
|
|
||||||
}
|
|
||||||
else if (master.get_digital(DIGITAL_L2)) {
|
|
||||||
arm.move(-90);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
arm.brake();
|
|
||||||
}
|
|
||||||
|
|
||||||
lift.set_brake_mode(MOTOR_BRAKE_HOLD);
|
|
||||||
if (master.get_digital(DIGITAL_R1)) {
|
|
||||||
lift.move(127);
|
|
||||||
}
|
|
||||||
else if (master.get_digital(DIGITAL_R2)) {
|
|
||||||
lift.move(-127);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
lift.brake();
|
|
||||||
}
|
|
||||||
|
|
||||||
wrist.set_brake_mode(MOTOR_BRAKE_HOLD);
|
|
||||||
if (master.get_digital(DIGITAL_A)) {
|
|
||||||
wrist.move(20);
|
|
||||||
}
|
|
||||||
else if (master.get_digital(DIGITAL_B)) {
|
|
||||||
wrist.move(-20);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
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);
|
||||||
|
|
||||||
@@ -373,7 +345,7 @@ void opcontrol() {
|
|||||||
//std::cout << "Wrist rotation sensor value: " << "\033[33m" << wristRotation.get_position() << " cdg" << "mm\033[0m" << std::endl;
|
//std::cout << "Wrist rotation sensor value: " << "\033[33m" << wristRotation.get_position() << " cdg" << "mm\033[0m" << std::endl;
|
||||||
//std::cout << "Arm limit switch value: " << "\033[34m" << armReset.get_value() << "mm\033[0m" << std::endl;*/
|
//std::cout << "Arm limit switch value: " << "\033[34m" << armReset.get_value() << "mm\033[0m" << std::endl;*/
|
||||||
|
|
||||||
///pros::delay(250);
|
//pros::delay(250);
|
||||||
pros::delay(ez::util::DELAY_TIME); // This is used for timer calculations! Keep this ez::util::DELAY_TIME
|
pros::delay(ez::util::DELAY_TIME); // This is used for timer calculations! Keep this ez::util::DELAY_TIME
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user