View Single Post
  #2   Spotlight this post!  
Unread 27-11-2016, 17:02
virtuald's Avatar
virtuald virtuald is offline
RobotPy Guy
AKA: Dustin Spicuzza
FRC #1418 (), FRC #1973, FRC #4796, FRC #6367 ()
Team Role: Mentor
 
Join Date: Dec 2008
Rookie Year: 2003
Location: Boston, MA
Posts: 1,086
virtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant future
Re: IterativeRobot, CommandRobot, or SampleRobot for brand new programmers?

Just because you can do something and it doesn't break does not mean one should do so.

A great example of why loops are dangerous are these two bits of code in your autonomous: https://github.com/CAPS-Robotics/201...anOWar.cpp#L89

Code:
while (!aligned) {
   ... do things
}
If your gyro breaks (maybe the wire gets messed up on accident), your robot will never enter teleoperated mode and that match is over for you.

Same thing here:

Code:
do {
... fire = someSensor > some_value
} while (!fire)
If your encoder breaks/gets disconnected, same business. You're done.

Maybe you have magic hardware that never breaks, but I wouldn't put my trust in that.
__________________
Maintainer of RobotPy - Python for FRC
Creator of pyfrc (Robot Simulator + utilities for Python) and pynetworktables/pynetworktables2js (NetworkTables for Python & Javascript)

2017 Season: Teams #1973, #4796, #6369
Team #1418 (remote mentor): Newton Quarterfinalists, 2016 Chesapeake District Champion, 2x Innovation in Control award, 2x district event winner
Team #1418: 2015 DC Regional Innovation In Control Award, #2 seed; 2014 VA Industrial Design Award; 2014 Finalists in DC & VA
Team #2423: 2012 & 2013 Boston Regional Innovation in Control Award


Resources: FIRSTWiki (relaunched!) | My Software Stuff
Reply With Quote