![]() |
Autonomous not stopping. Constantly running... during enabling
Hey Guys,
I decided to get autonomous to work this year and ran into the problem of an unlimited run time despite a set stopping point. Can someone check this out and find the problem? I honestly don't know what the problem is. I may be overlooking something simple, but I am clearly not seeing it. Code:
|
Re: Autonomous not stopping. Constantly running... during enabling
In your else block, you don't seem to be stopping the motors. Try changing all those calls to set 0.
Also, I noticed that you're using the command based framework (based on the code you left commented out). Why not make an autonomous command and use the internal timer of each command to run your autonomous? Something like this: Code:
class AutoCommand extends Command {Code:
Command autoCommand = new AutoCommand(); |
Re: Autonomous not stopping. Constantly running... during enabling
Your else block is not turning the motors off. In addition, you should make your timer a member variable of the class.
Declare it outside of (usually above) your functions: Code:
Timer myTimer;Code:
myTimer = new Timer();This way the timer will give you the time since auto mode started which is what you're looking for. |
Re: Autonomous not stopping. Constantly running... during enabling
Either of the two posts above should put you down the path of solving the issue.
The code you have now (in addition to not actually stopping the motors in the else) is creating a new timer every time autonomousPeriodic is called. This timer is never started so it will return 0. You can either create the timer once as 'heuristics' has suggested or scrap this and use a command with setTimout() and isTimedOut() as 'euhlmann' has suggested. |
| All times are GMT -5. The time now is 07:27 AM. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi