@@ -33,7 +33,7 @@ public enum ARM_STATE { NONE, MOVE_HOME, MOVE_HIGH, MOVE_SAMPLE, MOVE_RUNG, ARM_
3333 private final double DRIVE_GEAR_REDUCTION = 26.9 ; // Gearing
3434 private final double WHEEL_DIAMETER_INCHES = (96 / 25.4 ); // 96 mm wheels converted to inches
3535
36- private final double encoderDegree = 31.11 ; //encoder cts per degree 42.22
36+ private final double encoderDegree = 27.9 ; //encoder cts per degree 42.22
3737 private final double encoderInch = -1129 / 7.311 ;
3838
3939 public double lengthLeft = 0 ;
@@ -345,8 +345,8 @@ public void enablelArmRight (boolean enable) {
345345
346346
347347 public void run () {
348- lengthLeft = (leftArm .getCurrentPosition ()/encoderInch + 10.5 ) * cos (Math .toRadians (( leftElbow .getCurrentPosition () / encoderDegree ) + 40 ));
349- lengthRight = (rightArm .getCurrentPosition ()/encoderInch + 10.5 ) * cos (Math .toRadians (( rightElbow .getCurrentPosition () / encoderDegree ) + 40 ));
348+ lengthLeft = (leftArm .getCurrentPosition ()/encoderInch + 10.5 ) * cos (Math .toRadians (- leftElbow .getCurrentPosition () / encoderDegree + 40 ));
349+ lengthRight = (rightArm .getCurrentPosition ()/encoderInch + 10.5 ) * cos (Math .toRadians (- rightElbow .getCurrentPosition () / encoderDegree + 40 ));
350350 opMode .telemetry .addData ("lengthLeft" , lengthLeft );
351351 opMode .telemetry .addData ("lengthRight" , lengthRight );
352352 //Logger.message("run");
@@ -696,11 +696,11 @@ public boolean control() {
696696 if (gamepad2 .left_stick_y == 0 && rightElbowState == armStates .MOVE ) {
697697 rightElbow .setPower (0 );
698698 }
699- lengthRight = (rightArm .getCurrentPosition ()/encoderInch + 10.5 ) * cos (Math .toRadians (( rightElbow .getCurrentPosition () / encoderDegree ) + 40 ));
699+ lengthRight = (rightArm .getCurrentPosition ()/encoderInch + 10.5 ) * cos (Math .toRadians (- rightElbow .getCurrentPosition () / encoderDegree + 40 ));
700700 if (lengthRight >= 30 ) {
701701 rightElbow .setPower (-ELBOW_SPEED );
702702 rightElbowState = armStates .BARRIER ;
703- lengthRight = (rightArm .getCurrentPosition () / encoderInch + 10.5 ) * cos (Math .toRadians (( rightElbow .getCurrentPosition () / encoderDegree ) + 40 ));
703+ lengthRight = (rightArm .getCurrentPosition () / encoderInch + 10.5 ) * cos (Math .toRadians (rightElbow .getCurrentPosition () / encoderDegree + 40 ));
704704 } else if (gamepad2 .left_stick_y == 0 || rightElbowState == armStates .BARRIER ) {
705705 rightElbow .setPower (0 );
706706 rightElbowState = armStates .OFF ;
@@ -721,11 +721,11 @@ public boolean control() {
721721 if (gamepad2 .left_stick_x == 0 && rightArmState == armStates .MOVE ) {
722722 rightArm .setPower (0 );
723723 }
724- lengthRight = (rightArm .getCurrentPosition ()/encoderInch + 10.5 ) * cos (Math .toRadians (( rightElbow .getCurrentPosition () / encoderDegree ) + 40 ));
724+ lengthRight = (rightArm .getCurrentPosition ()/encoderInch + 10.5 ) * cos (Math .toRadians (- rightElbow .getCurrentPosition () / encoderDegree + 40 ));
725725 if (lengthRight >= 30 ) {
726726 rightArm .setPower (ARM_SPEED );
727727 rightArmState = armStates .BARRIER ;
728- lengthRight = (rightArm .getCurrentPosition () / encoderInch + 10.5 ) * cos (Math .toRadians (( rightElbow .getCurrentPosition () / encoderDegree ) + 40 ));
728+ lengthRight = (rightArm .getCurrentPosition () / encoderInch + 10.5 ) * cos (Math .toRadians (- rightElbow .getCurrentPosition () / encoderDegree + 40 ));
729729 } else if (gamepad2 .left_stick_x == 0 || rightArmState == armStates .BARRIER ) {
730730 rightArm .setPower (0 );
731731 rightArmState = armStates .OFF ;
@@ -747,11 +747,11 @@ public boolean control() {
747747 if (gamepad2 .left_stick_y == 0 && leftElbowState == armStates .MOVE ) {
748748 leftElbow .setPower (0 );
749749 }
750- lengthLeft = (leftArm .getCurrentPosition ()/encoderInch + 10.5 ) * cos (Math .toRadians (( leftElbow .getCurrentPosition () / encoderDegree ) + 40 ));
750+ lengthLeft = (leftArm .getCurrentPosition ()/encoderInch + 10.5 ) * cos (Math .toRadians (- leftElbow .getCurrentPosition () / encoderDegree + 40 ));
751751 if (lengthLeft >= 30 ) {
752752 leftElbow .setPower (-ELBOW_SPEED );
753753 leftElbowState = armStates .BARRIER ;
754- lengthLeft = (leftArm .getCurrentPosition () / encoderInch + 10.5 ) * cos (Math .toRadians (( leftElbow .getCurrentPosition () / encoderDegree ) + 40 ));
754+ lengthLeft = (leftArm .getCurrentPosition () / encoderInch + 10.5 ) * cos (Math .toRadians (- leftElbow .getCurrentPosition () / encoderDegree + 40 ));
755755 } else if (gamepad2 .left_stick_y == 0 || leftElbowState == armStates .BARRIER ){
756756 leftElbow .setPower (0 );
757757 leftElbowState = armStates .OFF ;
@@ -772,11 +772,11 @@ public boolean control() {
772772 if (gamepad2 .left_stick_x == 0 && leftArmState == armStates .MOVE ) {
773773 leftArm .setPower (0 );
774774 }
775- lengthLeft = (leftArm .getCurrentPosition ()/encoderInch + 10.5 ) * cos (Math .toRadians (( leftElbow .getCurrentPosition () / encoderDegree ) + 40 ));
775+ lengthLeft = (leftArm .getCurrentPosition ()/encoderInch + 10.5 ) * cos (Math .toRadians (- leftElbow .getCurrentPosition () / encoderDegree + 40 ));
776776 if (lengthLeft >= 30 ) {
777777 leftArm .setPower (ARM_SPEED );
778778 leftArmState = armStates .BARRIER ;
779- lengthLeft = (leftArm .getCurrentPosition () / encoderInch + 10.5 ) * cos (Math .toRadians (( leftElbow .getCurrentPosition () / encoderDegree ) + 40 ));
779+ lengthLeft = (leftArm .getCurrentPosition () / encoderInch + 10.5 ) * cos (Math .toRadians (- leftElbow .getCurrentPosition () / encoderDegree + 40 ));
780780 } else if (gamepad2 .left_stick_x == 0 || leftArmState == armStates .BARRIER ) {
781781 leftArm .setPower (0 );
782782 leftArmState = armStates .OFF ;
@@ -870,11 +870,11 @@ public boolean controlLeft() {
870870 if (gamepad1 .left_stick_y == 0 && leftElbowState == armStates .MOVE ) {
871871 leftElbow .setPower (0 );
872872 }
873- lengthLeft = (leftArm .getCurrentPosition ()/encoderInch + 10.5 ) * cos (Math .toRadians (( leftElbow .getCurrentPosition () / encoderDegree ) + 40 ));
873+ lengthLeft = (leftArm .getCurrentPosition ()/encoderInch + 10.5 ) * cos (Math .toRadians (- leftElbow .getCurrentPosition () / encoderDegree + 40 ));
874874 if (lengthLeft >= 30 ) {
875875 leftElbow .setPower (-ELBOW_SPEED );
876876 leftElbowState = armStates .BARRIER ;
877- lengthLeft = (leftArm .getCurrentPosition () / encoderInch + 10.5 ) * cos (Math .toRadians (( leftElbow .getCurrentPosition () / encoderDegree ) + 40 ));
877+ lengthLeft = (leftArm .getCurrentPosition () / encoderInch + 10.5 ) * cos (Math .toRadians (- leftElbow .getCurrentPosition () / encoderDegree + 40 ));
878878 } else if (gamepad1 .left_stick_y == 0 || leftElbowState == armStates .BARRIER ){
879879 leftElbow .setPower (0 );
880880 leftElbowState = armStates .OFF ;
@@ -895,11 +895,11 @@ public boolean controlLeft() {
895895 if (gamepad1 .left_stick_x == 0 && leftArmState == armStates .MOVE ) {
896896 leftArm .setPower (0 );
897897 }
898- lengthLeft = (leftArm .getCurrentPosition ()/encoderInch + 10.5 ) * cos (Math .toRadians (( leftElbow .getCurrentPosition () / encoderDegree ) + 40 ));
898+ lengthLeft = (leftArm .getCurrentPosition ()/encoderInch + 10.5 ) * cos (Math .toRadians (- leftElbow .getCurrentPosition () / encoderDegree + 40 ));
899899 if (lengthLeft >= 30 ) {
900900 leftArm .setPower (ARM_SPEED );
901901 leftArmState = armStates .BARRIER ;
902- lengthLeft = (leftArm .getCurrentPosition () / encoderInch + 10.5 ) * cos (Math .toRadians (( leftElbow .getCurrentPosition () / encoderDegree ) + 40 ));
902+ lengthLeft = (leftArm .getCurrentPosition () / encoderInch + 10.5 ) * cos (Math .toRadians (- leftElbow .getCurrentPosition () / encoderDegree + 40 ));
903903 } else if (gamepad1 .left_stick_x == 0 || leftArmState == armStates .BARRIER ) {
904904 leftArm .setPower (0 );
905905 leftArmState = armStates .OFF ;
@@ -998,11 +998,11 @@ public boolean controlLeft2() {
998998 if (gamepad2 .left_stick_y == 0 && leftElbowState == armStates .MOVE ) {
999999 leftElbow .setPower (0 );
10001000 }
1001- lengthLeft = (leftArm .getCurrentPosition ()/encoderInch + 10.5 ) * cos (Math .toRadians (( leftElbow .getCurrentPosition () / encoderDegree ) + 40 ));
1001+ lengthLeft = (leftArm .getCurrentPosition ()/encoderInch + 10.5 ) * cos (Math .toRadians (- leftElbow .getCurrentPosition () / encoderDegree + 40 ));
10021002 if (lengthLeft >= 30 ) {
10031003 leftElbow .setPower (-ELBOW_SPEED );
10041004 leftElbowState = armStates .BARRIER ;
1005- lengthLeft = (leftArm .getCurrentPosition () / encoderInch + 10.5 ) * cos (Math .toRadians (( leftElbow .getCurrentPosition () / encoderDegree ) + 40 ));
1005+ lengthLeft = (leftArm .getCurrentPosition () / encoderInch + 10.5 ) * cos (Math .toRadians (- leftElbow .getCurrentPosition () / encoderDegree + 40 ));
10061006 } else if (gamepad2 .left_stick_y == 0 || leftElbowState == armStates .BARRIER ){
10071007 leftElbow .setPower (0 );
10081008 leftElbowState = armStates .OFF ;
@@ -1023,11 +1023,11 @@ public boolean controlLeft2() {
10231023 if (gamepad2 .left_stick_x == 0 && leftArmState == armStates .MOVE ) {
10241024 leftArm .setPower (0 );
10251025 }
1026- lengthLeft = (leftArm .getCurrentPosition ()/encoderInch + 10.5 ) * cos (Math .toRadians (( leftElbow .getCurrentPosition () / encoderDegree ) + 40 ));
1026+ lengthLeft = (leftArm .getCurrentPosition ()/encoderInch + 10.5 ) * cos (Math .toRadians (- leftElbow .getCurrentPosition () / encoderDegree + 40 ));
10271027 if (lengthLeft >= 30 ) {
10281028 leftArm .setPower (ARM_SPEED );
10291029 leftArmState = armStates .BARRIER ;
1030- lengthLeft = (leftArm .getCurrentPosition () / encoderInch + 10.5 ) * cos (Math .toRadians (( leftElbow .getCurrentPosition () / encoderDegree ) + 40 ));
1030+ lengthLeft = (leftArm .getCurrentPosition () / encoderInch + 10.5 ) * cos (Math .toRadians (- leftElbow .getCurrentPosition () / encoderDegree + 40 ));
10311031 } else if (gamepad2 .left_stick_x == 0 || leftArmState == armStates .BARRIER ) {
10321032 leftArm .setPower (0 );
10331033 leftArmState = armStates .OFF ;
@@ -1157,11 +1157,11 @@ public boolean controlRight() {
11571157 if (gamepad2 .left_stick_y == 0 && rightElbowState == armStates .MOVE ) {
11581158 rightElbow .setPower (0 );
11591159 }
1160- lengthRight = (rightArm .getCurrentPosition ()/encoderInch + 10.5 ) * cos (Math .toRadians (( rightElbow .getCurrentPosition () / encoderDegree ) + 40 ));
1160+ lengthRight = (rightArm .getCurrentPosition ()/encoderInch + 10.5 ) * cos (Math .toRadians (- rightElbow .getCurrentPosition () / encoderDegree + 40 ));
11611161 if (lengthRight >= 30 ) {
11621162 rightElbow .setPower (-ELBOW_SPEED );
11631163 rightElbowState = armStates .BARRIER ;
1164- lengthRight = (rightArm .getCurrentPosition () / encoderInch + 10.5 ) * cos (Math .toRadians (( rightElbow .getCurrentPosition () / encoderDegree ) + 40 ));
1164+ lengthRight = (rightArm .getCurrentPosition () / encoderInch + 10.5 ) * cos (Math .toRadians (- rightElbow .getCurrentPosition () / encoderDegree + 40 ));
11651165 } else if (gamepad2 .left_stick_y == 0 || rightElbowState == armStates .BARRIER ) {
11661166 rightElbow .setPower (0 );
11671167 rightElbowState = armStates .OFF ;
@@ -1182,11 +1182,11 @@ public boolean controlRight() {
11821182 if (gamepad2 .left_stick_x == 0 && rightArmState == armStates .MOVE ) {
11831183 rightArm .setPower (0 );
11841184 }
1185- lengthRight = (rightArm .getCurrentPosition ()/encoderInch + 10.5 ) * cos (Math .toRadians (( rightElbow .getCurrentPosition () / encoderDegree ) + 40 ));
1185+ lengthRight = (rightArm .getCurrentPosition ()/encoderInch + 10.5 ) * cos (Math .toRadians (- rightElbow .getCurrentPosition () / encoderDegree + 40 ));
11861186 if (lengthRight >= 30 ) {
11871187 rightArm .setPower (ARM_SPEED );
11881188 rightArmState = armStates .BARRIER ;
1189- lengthRight = (rightArm .getCurrentPosition () / encoderInch + 10.5 ) * cos (Math .toRadians (( rightElbow .getCurrentPosition () / encoderDegree ) + 40 ));
1189+ lengthRight = (rightArm .getCurrentPosition () / encoderInch + 10.5 ) * cos (Math .toRadians (- rightElbow .getCurrentPosition () / encoderDegree + 40 ));
11901190 } else if (gamepad2 .left_stick_x == 0 || rightArmState == armStates .BARRIER ) {
11911191 rightArm .setPower (0 );
11921192 rightArmState = armStates .OFF ;
0 commit comments