|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools | Rate Thread | Display Modes |
|
|
|
#1
|
|||||
|
|||||
|
Re: Need Help With Encoders
First off you need to read the documentation on Switches in Java and then take a look at your code.
https://docs.oracle.com/javase/tutor...ts/switch.html Now, on to the first code segment where I see issues. Code:
public void autonomousPeriodic() {
switch (autoSelected) {
case "doNothing":
break;
default:
case defaultAuto:
LowBarAuton();
//encoderAuto();
break;
// case "spybot":
// SpyBotAuton();
// break;
// case "rampWithStuff":
// RampAuton();
// break;
}
}
You do that correctly in your LowBarAuton() method. Your programmer has assumed that the case "defaultAuto" was set to the default case and I do not believe it has been. |
|
#2
|
|||
|
|||
|
Re: Need Help With Encoders
Please give us more information about what happens when you try to run your autonomous. Specifically:
Does the code compile? Does the code deploy & appear to run on the robot? Does the robot move at all when you try autonomous? How much of what you expect to happen happens when you run auto? Can you run other, simpler autonomous modes correctly? (eg. just move fwd 3 seconds) This will greatly help us as we try to help you. |
|
#3
|
||||
|
||||
|
Re: Need Help With Encoders
Going along with what JohnFogarty was saying, in your LowBarAuton, the default has to be at the end of the switch.
|
|
#4
|
|||
|
|||
|
Re: Need Help With Encoders
So after a brief review, I can tell you the code looks really messy.
But, nothing actually appears incorrect in the autonomous sequence. Which is why we need the reason why you think it's wrong. It's perfectly valid in Java to put default: before the case:es. You're doing it really messily in LowBarAuton, but it does work. Again. Please tell us exactly how you are trying to run autonomous and how it "fails". We can't help you solve something you haven't told us about. |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|