
16-11-2015, 08:02
|
 |
 |
Flywheel Police
AKA: Matthew Lythgoe
 FRC #2363 (Triple Helix)
Team Role: Mentor
|
|
Join Date: Feb 2010
Rookie Year: 2009
Location: Newport News, VA
Posts: 1,722
|
|
|
Re: Java Conditional Command
Quote:
Originally Posted by GeeTwo
OK, my poorly exercised OO brain gets it, but my better exercised procedural brain sees spooky action at a getDistance().
That suggests to me that you would want to have polymorphic forms of the command, including one which allows both operands to be objects. This could then be used to do things like (for example) returning the original drive direction by driving faster with the left wheel than the right, then equalizing after a
Code:
waitUntil(leftAxle.getDistance(), GREATER_THAN_EQUAL, rightAxle.getDistance())
completes. If you do this, you should allow either operand or both to be objects. For sanity's sake, a constructor using two numeric values could be created, but it should throw an exception telling the user that [s]he is trying to wait forever, or not at all.
|
The command can definitely be expanded to accept different inputs. However I disagree with the constructor that throws an exception. Why give them enough rope to hang themselves when you can just not give them the rope at all?
|