View Single Post
  #12   Spotlight this post!  
Unread 03-11-2015, 10:17 AM
Sparkyshires Sparkyshires is offline
Registered User
AKA: Michael Shires
FRC #0384 (Sparky)
Team Role: Programmer
 
Join Date: Jan 2012
Rookie Year: 2006
Location: Virginia
Posts: 226
Sparkyshires is an unknown quantity at this point
Re: COmmand based software Interrupts

Oh crap, my apologies! The repository is private. My school blocks github :/ so I can't make it public until this afternoon at about 430 EST. I will as soon as I get to our shop.

Yes, they require the same subsystem.

There are two checks in the is finished command, one is if they hit either the upper or lower limit, in which case return true and end the command immediately so you don't break anything, and the other is just to check if you've hit the encoder count you want, in which case return true and end the command. I would like to note that these parts of the command work exemplary and exactly as I want them, and have never given me any issues, except for this "parallel" problem.

The default command is called ElevatorIdle which turns the motors off in the Initialize function, then repeatedly prints out diagnostics in the execute, doesn't have anything in the isFinished except for return false, and turns off the elevator motor in the End and IsInterrupted functions.

The code in the OI is just:
Code:
joy1button2->WhenPressed(new MoveElevatorCarry());
joy1button3->WhenPressed(new MoveElevatorOneTote());
(Carry and OneTote are names for positions on the elevator)

In Interrupted is a printf which is only seen once when the new command is begun, and a function call to turn off the elevator motor.

As I said above, I'm just calling the commands in the OI file. Is there another place where we need to write some code so it knows what to expect? I have the line:
Code:
Requires(CommandBase::Elevator);
in both the commands, is that wrong?

P.S. also all of the above is from memory, as I said my school blocks github so I can't access the code :/ so if anything small in the syntax looks like it might be the issue, there's a high probability it's just me remembering it slightly wrong. As I said, the code works beautifully, I'm in love with commandBased as it's my first year using it, but I think I'm just missing some small nuance that has to happen with it.

P.P.S. Thank you guys so much for your help!!! We're a week four, so we have just about a week until competition, so I'm getting really nervous with this. You guys are lifesavers!!!!
__________________
"Measure with a micrometer, mark with chalk, cut with an axe."

Last edited by Sparkyshires : 03-11-2015 at 10:19 AM. Reason: Added thank you
Reply With Quote