|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools | Rate Thread | Display Modes |
|
|
|
#1
|
|||
|
|||
|
DefaultCommand won't restart?
Hey, I run SetDefaultCommand(new [insert default command]()); but whenever I run a command that interrupts it (cancels default command), the default command will not restart. I have tried calling InitDefaultCommand inside of End() of the interrupting command, but this will not start the default command.
Can anybody tell me how to restart the default command after another command interrupts it? |
|
#2
|
|||
|
|||
|
Re: DefaultCommand won't restart?
Can you post some code? Also, are you sure the interrupting command ends when you think it does?
|
|
#3
|
|||
|
|||
|
Re: DefaultCommand won't restart?
Sorry for not posting the solution I found!
Long story short, I needed to call SetExpiration(double X.Y) and SetSafetyEnabled(false) for the RobotDrive object. The example I was trying to play with/test was basic ArcadeDrive, and a command that would drive the motors forward for 5 seconds. SetSafetyEnabled(true) with no SetExpiration(double X.Y) was called for the RobotDrive object initialization for the subsystem. The command would set the RobotDrive object (which I'll just call *drive) to drive->Drive(0.7) and SetTimeout(5) in the Initialize method of the command. Then, IsFinished would return IsTimedOut(). At runtime, whenever the button that spawned this command was called, the diagnostics tab would spit out errors about motors exceeding a timeout at line 117 of MotorSafetyHelper.cpp. And so on. Essentially, this was a problem I could have solved by looking at the Simple Robot Template, a beginner's mistake. |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|