![]() |
Autonomous won't do *anything* ?
I'm trying to do the most absolutely *basic* wpilib autonomous, and I can't get it to trigger. It isn't doing anything, and I'm following the wpilib pretty closely...
Code:
// RobotBuilder Version: 2.0Code:
package org.usfirst.frc5858.SteamworksBot.commands; |
Re: Autonomous won't do *anything* ?
Okay, ignoring the dumb typo in my math above (which didn't explain why I was never hitting to break point to evaluate it), the issue seems to be with having setDefaultCommand in a few subsystems - evidently having setDefaultCommand prevents queued commands from running at all..?
EDIT: Note, I cleaned my code up a little above and got rid of subsystems I didn't think mattered.. but I have a drivetrain subsystem and a computer vision networking subsystem, and if I setDefaultCommand in either one of them, my Autonomous command is never called.. this is very strange.. |
Re: Autonomous won't do *anything* ?
The first thing that immediately pops up to me is that you've got some funky stuff going on with your time calculations. Firstly, you're subtracting start_time from elapsed_time twice, once in execute() and once in isFinished(). You should drop it out of isFinished(), changing your return statement in isFinished() to just
Code:
return elapsed_time >= 2.0;Create the Timer as you would any other object, Code:
Timer timer = new Timer();Code:
timer.reset();Code:
return timer.get() > 2;And lastly, to keep things tidy, you can throw a timer.stop(); into your end() and interrupted() methods if you want. I'm not entirely sure why your current code isn't doing anything, but these are a couple of things that should be cleaned up to get the debugging started. |
Re: Autonomous won't do *anything* ?
Is your default command Interruptible? If the default command on the subsystem is not Interruptible, then any new commands including your Autonomous command will not execute until that default command ends.
Since what you have is a drivetrain, I'm guessing your default command does some kind of Teleop read of the joysticks to drive the bot around -- and probably will never terminate on its own. You may need to make sure this default command can be interrupted by using the setInterruptible(boolean interruptible) method. Without seeing the code of your default command, however, it's hard to tell whats going on in your case. |
Re: Autonomous won't do *anything* ?
Argh, yeah, I bet that's it. I had no idea you had to setInterruptable.
And yeah, the timing stuff I had just thrown together ultra quick, I found the dumb bugs in that pretty fast. |
| All times are GMT -5. The time now is 03:37. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi