|
|
|
![]() |
|
|||||||
|
||||||||
|
|
Thread Tools | Rate Thread | Display Modes |
|
#15
|
||||
|
||||
|
Re: COmmand based software Interrupts
Your switches may be wired correctly... but that doesn't mean that your code is reading their states correctly. Hence my suggestion to check that it's doing what you expect. If you're confident that's not the problem, good. I can't make you check it. You're the one that's saying it's not working correctly, so It may be prudent to verify your assumptions.
Other things that could be wrong: Which commands in particular are you referring to as "new" command and "old" command? The reason I ask is in OI all the MoveElevatorXXX commands are started when you press a button. These are the command I thought you were talking about previously wrt your logs. They will only execute once unless you're repeatedly pressing the button in question. This is not consistent with the logs you've provided. On the other hand, if the one of the commands that's running happens to be the DropElevator() or LiftElevator() commands, then there's a different explanation for what may be going on. I have yet to come up with a case where WhileHeld() actually does what you want it to (if someone has a use case, please let me know). If I understand your code correctly, the way you're attempting to use this command is to have your Lift/DropElevator() commands run until you let go of the button. But what's actually going to happen is each loop iteration, you're going to start a new copy of the Lift/DropElevator() command. Since you have a call to stop the elevator as part of the command, you're going to be in this endless loop of driving the elevator, stopping it, driving it, stopping it, until you let go of the button. Here's why using the joy1button4->WhileHeld(new DropElevator()); as an example:
What you probably want to do is instead execute the command WhenPressed, then call a command that stops the elevator (ElevatorIdle) When the same button is released. Code:
joy1button3->WhileHeld(new LiftElevator()); joy1button4->WhileHeld(new DropElevator()); joy2button3->WhileHeld(new LiftElevator()); Code:
joy1button3->WhenPressed(new LiftElevator()); joy1button3->WhenReleased(new ElevatorIdle()); joy1button4->WhenPressed(new DropElevator()); joy1button4->WhenReleased(new ElevatorIdle()); joy2button3->WhenPressed(new LiftElevator()); joy2button3->WhenReleased(new ElevatorIdle()); |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|