Go to Post however, if i tried it i would probably end up setting my hair on fire - Henry_Mareck [more]
Home
Go Back   Chief Delphi > Technical > Programming > Java
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 12-01-2015, 00:14
stepan's Avatar
stepan stepan is offline
Programming Captain
AKA: Stepan Subbotin
FRC #4536 (MinuteBots)
Team Role: Programmer
 
Join Date: Dec 2014
Rookie Year: 2012
Location: St. Paul, MN
Posts: 13
stepan is an unknown quantity at this point
Which Base Class Are You Using?

I'm curious about what Java base class other teams are using. During the fall, while re-programming the robot in Java, we used the SimpleRobot base class (now called SampleRobot). I've seen some people post code that uses the IterativeClass.

The main difference is that the IterativeClass automatically loops the autonomous and teleop methods. In the the SampleRobot class the autonomous and teleop methods are only called once, so you have to loop them yourself using a while loop and the timer class.

SampleRobot base class:

Code:
public void autonomous() {    
        while (isAutonomous() && isEnable()) {
            //Put code here
            Timer.delay(0.05);
        }
}
IterativeRobot base class:

Code:
public void autonomousPeriodic() {
        //Put code here
}
I believe a lot teams also use command-based programming.

Anyways, what do you use and why do you use it?
Reply With Quote
  #2   Spotlight this post!  
Unread 12-01-2015, 01:06
fsilberberg fsilberberg is offline
WPILib Developer
AKA: Fred Silberberg
FRC #0190
Team Role: Alumni
 
Join Date: Jan 2010
Rookie Year: 2010
Location: Redmond
Posts: 146
fsilberberg has a spectacular aura aboutfsilberberg has a spectacular aura aboutfsilberberg has a spectacular aura about
Re: Which Base Class Are You Using?

Regarding SampleRobot, we specifically renamed SimpleRobot to SampleRobot and put disclaimers in about it because many teams saw the word "Simple" and went with that template. However, there's a lot more to embedded programming than just running in a tight loop as most people do with SimpleRobot, and the number of issues CSAs saw at competitions because of this was very high.

I personally am a fan of the CommandBased model. It takes care of synchronization between commands, sequencing of commands, cancelling commands based on the requires() blocks, and such. There are certainly use cases for Iterative, but for the vast majority of teams, CommandBased should help eliminate a lot of issues that we see both as library maintainers and CSAs.
Reply With Quote
  #3   Spotlight this post!  
Unread 12-01-2015, 02:08
GeeTwo's Avatar
GeeTwo GeeTwo is offline
Technical Director
AKA: Gus Michel II
FRC #3946 (Tiger Robotics)
Team Role: Mentor
 
Join Date: Jan 2014
Rookie Year: 2013
Location: Slidell, LA
Posts: 3,574
GeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond repute
Re: Which Base Class Are You Using?

We use command-based, in java. If all we had were Sample, we'd probably try to write an event based model ourselves in the off-season, because it makes classes more easily separable and handles coordination among the subsystems. On the other hand, it is the most flexible of the really event-based models.
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 10:37.

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