View Single Post
  #5   Spotlight this post!  
Unread 27-11-2016, 15:38
PopeRyanI PopeRyanI is offline
Registered User
FRC #2410 (Metal Mustangs Robotics)
Team Role: Programmer
 
Join Date: Dec 2014
Rookie Year: 2012
Location: Kansas
Posts: 21
PopeRyanI is an unknown quantity at this point
Re: IterativeRobot, CommandRobot, or SampleRobot for brand new programmers?

Quote:
Originally Posted by trycatch View Post
Hello all

I'm a programming mentor for a team with a lot of students with very, very little programming experience at all. To me, it looks clear that SampleRobot is by far the most straight forward way to go - honestly, if I'm understanding right, SampleRobot is much more "write out what you want it to do in what order," as opposed to having to keep track of a state machine in Iterative.
I have mixed feelings about CommandBased - as a programmer (who's made a few robots), it seems VERY overly complex, especially for brand new programmers, to require entirely separate classes for every single thing you want the robot to do, especially when every command class is a single function. SampleRobot really seems like the most straightforward and traditional way.
Hello, my team uses SampleRobot and I definitely agree that I think it is a lot more intuitive than Iterative. Being able to control how frequently it looped rather than waiting for a packet was more logical for our programmers. We never really got involved with CommandBased because we did not like all of the boilerplate code and thought that it was rather confusing with so many different classes.

Quote:
But I do have a couple of quick questions - if using SampleRobot, do I have to check periodically if the robot has been disabled (IsAutonomous() && IsEnabled()), or will this be caught in Timer.Delay() pauses? I've mentored for FTC previously, and the autonomous thread would be killed if you disabled it when the main thread got control for a bit, i.e., when you delayed the Autonomous thread for a few milliseconds at least.
We have never had problems with our autonomous ever accidentally being disabled and, as a result, have not had to check during auto if the robot is enabled. This includes running Wait() to pause the robot (for C++, Timer.delay() for Java is comparable). In addition, we found that SampleRobot made more sense in this instance because running autonomous code every 20 ms or so did not seem to make sense.

Quote:
The WPILIB documentation makes it sound like the SampleRobot class is a lot harder to use, but I don't really understand why. What am I missing?
Honestly, the only part that might be a little confusing for new programmers is handling the looping within SampleRobot, but with some experience, I think it is more straight forward.

In case it helps out, here is my team's code for this past year's robot: https://github.com/CAPS-Robotics/201...ree/master/src

We did use C++ for this and it seems that you use Java, but the same basic idea is present (just ignore all of the pointer fun). We used SampleRobot for this code and you can see that the autonomous does not actually check if it is still enabled. We ran this code in competition and never had any problems with the autonomous disabling during a match.
Disclaimer: I wrote some of this code, so it is not necessarily very good, but I hope it at least helps with the basic ideas.
Reply With Quote