Go to Post But seriously? White paper.. CD.. upload.. You get what I'm sayin'! :) - Elgin Clock [more]
Home
Go Back   Chief Delphi > Technical > Programming > C/C++
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Reply
 
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 01-02-2013, 20:45
Fifthparallel Fifthparallel is offline
Registered User
AKA: Sam Chen
FRC #1410
 
Join Date: Dec 2012
Rookie Year: 2011
Location: Denver, CO
Posts: 65
Fifthparallel is an unknown quantity at this point
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?
__________________
sudo chmod u+x helloworld.sh
gotta start somewhere.
Reply With Quote
  #2   Spotlight this post!  
Unread 03-02-2013, 21:14
William Kunkel William Kunkel is offline
Programming Lead
AKA: Kunkel
FRC #0422 (Mech Tech Dragons)
Team Role: Programmer
 
Join Date: Jan 2013
Rookie Year: 2011
Location: Richmond, VA
Posts: 94
William Kunkel is an unknown quantity at this point
Re: DefaultCommand won't restart?

Can you post some code? Also, are you sure the interrupting command ends when you think it does?
Reply With Quote
  #3   Spotlight this post!  
Unread 04-02-2013, 01:39
Fifthparallel Fifthparallel is offline
Registered User
AKA: Sam Chen
FRC #1410
 
Join Date: Dec 2012
Rookie Year: 2011
Location: Denver, CO
Posts: 65
Fifthparallel is an unknown quantity at this point
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.
__________________
sudo chmod u+x helloworld.sh
gotta start somewhere.
Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -5. The time now is 12:56.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi