Go to Post Heat Gun(n.):Your build season replacement for a microwave. - jajabinx124 [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 06-02-2016, 15:38
tkdberger's Avatar
tkdberger tkdberger is offline
SPAAACE
AKA: Hugh Mungous
FRC #3494 (Quadrangles)
Team Role: Programmer
 
Join Date: Jan 2016
Rookie Year: 2016
Location: Bloomington, IN
Posts: 23
tkdberger is an unknown quantity at this point
Lightbulb Logical Auto?

Anyone know if you can safely do logic in Autonomous mode?

Something like
Code:
while(condition) {
    new SomeCommand;
}
(assuming you are doing a command based robot, not sure how it works for others)
Reply With Quote
  #2   Spotlight this post!  
Unread 06-02-2016, 15:41
rich2202 rich2202 is offline
Registered User
FRC #2202 (BEAST Robotics)
Team Role: Mentor
 
Join Date: Jan 2012
Rookie Year: 2012
Location: Wisconsin
Posts: 1,171
rich2202 has a reputation beyond reputerich2202 has a reputation beyond reputerich2202 has a reputation beyond reputerich2202 has a reputation beyond reputerich2202 has a reputation beyond reputerich2202 has a reputation beyond reputerich2202 has a reputation beyond reputerich2202 has a reputation beyond reputerich2202 has a reputation beyond reputerich2202 has a reputation beyond reputerich2202 has a reputation beyond repute
Re: Logical Auto?

Careful with the while command. Better to use autonomusperodic
Reply With Quote
  #3   Spotlight this post!  
Unread 06-02-2016, 15:43
tkdberger's Avatar
tkdberger tkdberger is offline
SPAAACE
AKA: Hugh Mungous
FRC #3494 (Quadrangles)
Team Role: Programmer
 
Join Date: Jan 2016
Rookie Year: 2016
Location: Bloomington, IN
Posts: 23
tkdberger is an unknown quantity at this point
Question Re: Logical Auto?

Quote:
Originally Posted by rich2202 View Post
Careful with the while command. Better to use autonomusperodic
Could you explain a bit more? This is my first time doing programming.
Reply With Quote
  #4   Spotlight this post!  
Unread 06-02-2016, 15:48
rich2202 rich2202 is offline
Registered User
FRC #2202 (BEAST Robotics)
Team Role: Mentor
 
Join Date: Jan 2012
Rookie Year: 2012
Location: Wisconsin
Posts: 1,171
rich2202 has a reputation beyond reputerich2202 has a reputation beyond reputerich2202 has a reputation beyond reputerich2202 has a reputation beyond reputerich2202 has a reputation beyond reputerich2202 has a reputation beyond reputerich2202 has a reputation beyond reputerich2202 has a reputation beyond reputerich2202 has a reputation beyond reputerich2202 has a reputation beyond reputerich2202 has a reputation beyond repute
Re: Logical Auto?

There is a concept of a "heartbeat". I believe it goes something like this: if your code does not return from periodic after a certain amount of time, the system presumes your code has crashed and disables all motors.

While loop can take too long to execute and trigger the fail safe.
Reply With Quote
  #5   Spotlight this post!  
Unread 06-02-2016, 15:51
tkdberger's Avatar
tkdberger tkdberger is offline
SPAAACE
AKA: Hugh Mungous
FRC #3494 (Quadrangles)
Team Role: Programmer
 
Join Date: Jan 2016
Rookie Year: 2016
Location: Bloomington, IN
Posts: 23
tkdberger is an unknown quantity at this point
Smile Re: Logical Auto?

Quote:
Originally Posted by rich2202 View Post
There is a concept of a "heartbeat". I believe it goes something like this: if your code does not return from periodic after a certain amount of time, the system presumes your code has crashed and disables all motors.

While loop can take too long to execute and trigger the fail safe.
Alright. Guess I'm researching AutonomousPeriodic then.
Reply With Quote
  #6   Spotlight this post!  
Unread 07-02-2016, 15:42
Ozuru's Avatar
Ozuru Ozuru is offline
It's always the programmer's fault.
no team
 
Join Date: May 2013
Rookie Year: 2010
Location: Earth
Posts: 268
Ozuru is a splendid one to beholdOzuru is a splendid one to beholdOzuru is a splendid one to beholdOzuru is a splendid one to beholdOzuru is a splendid one to beholdOzuru is a splendid one to beholdOzuru is a splendid one to behold
Re: Logical Auto?

Quote:
Originally Posted by tkdberger View Post
Alright. Guess I'm researching AutonomousPeriodic then.
Autonomous periodic just runs periodically (something like every 20 ms?) throughout autonomous. In Java, if you check out the code they literally just loop through the code in autonomous periodic. Autonomous init is just the first iteration of that loop. I'm not entirely sure but I'm willing to wager that C++ works using the same logic.
Reply With Quote
  #7   Spotlight this post!  
Unread 08-02-2016, 20:01
MaikeruKonare's Avatar
MaikeruKonare MaikeruKonare is offline
Programming Division Captain
AKA: Michael Conard
FRC #4237 (Team Lance-a-Bot)
Team Role: Programmer
 
Join Date: Feb 2016
Rookie Year: 2012
Location: Michigan
Posts: 15
MaikeruKonare is an unknown quantity at this point
Re: Logical Auto?

We don't use command based, but all while loops in any of our three main functions (Teleop, Autonomous, or Test) look like this:
Code:
while(IsOperatorControl() && IsEnabled()) {}
Code:
while(IsAutonomous() && IsEnabled()) {}
This prevents any loops going longer than they should, such as when the mode changes or the robot becoming disabled.

Hope that helps.

Last edited by MaikeruKonare : 08-02-2016 at 20:02. Reason: Curly Brackets
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:46.

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