View Single Post
  #25   Spotlight this post!  
Unread 31-08-2015, 14:34
Cel Skeggs Cel Skeggs is offline
Robot Software Manager Alumnus
AKA: Previously known as Colby
FRC #1540 (The Flaming Chickens)
Team Role: Alumni
 
Join Date: Feb 2013
Rookie Year: 2009
Location: Portland, Oregon, USA
Posts: 107
Cel Skeggs is a glorious beacon of lightCel Skeggs is a glorious beacon of lightCel Skeggs is a glorious beacon of lightCel Skeggs is a glorious beacon of lightCel Skeggs is a glorious beacon of lightCel Skeggs is a glorious beacon of light
Re: The CCRE: A comprehensive award-winning robot code framework

I've been working on some prototypes for the 3.0.0 release. This release includes a lot of improvements to the Mixing system, namely by getting rid of the Mixing, FloatMixing, BooleanMixing, and EventMixing classes, and using Java 8's new default interfaces to implement the same functionality on the objects themselves.

As an example of how much this can help:

Code:
Mixing.select(calibrating, FloatMixing.multiplication.of(FloatMixing.multiplication.of(p, (FloatInput) dconstant), (FloatInput) period), FloatMixing.always(0));
becomes

Code:
calibrating.toFloat(p.multipliedBy(dconstant).multipliedBy(period), 0);
which is much easier to understand and has a lot less boilerplate!

Also, the Input/InputPoll distinction is going away, which means (for example) that code will no longer be scattered with FloatMixing.createDispatch and BooleanMixing.createDispatch everywhere!

To replace the previous easy of use of InputPolls that is now going away, code like:

Code:
BooleanMixing.createDispatch(new BooleanInputPoll() {
    public boolean get() {
        return /* some expression */;
    }
}, Igneous.globalPeriodic)
is now written as

Code:
new DerivedBooleanInput(/* dependent inputs */) {
    protected boolean apply() {
        return /* same expression as above */;
    }
}
This is slightly more complicated in that you have to specify when the value could update, but it ultimately will lead to better, easier-to-understand code and less overhead.
__________________
Software manager alumnus. Developer of the CCRE, a powerful robot code framework based on dataflow and composibility.
Refer to as she/her/hers. Years of FRC: 2012, 2013, 2014, 2015, 2016. FLL for a few years beforehand.
Team 1540: The Flaming Chickens | Portland, Oregon | Twitter | Facebook
Reply With Quote