File tree Expand file tree Collapse file tree 1 file changed +27
-0
lines changed
src/main/java/org/usfirst/frc/team69/util Expand file tree Collapse file tree 1 file changed +27
-0
lines changed Original file line number Diff line number Diff line change @@ -351,4 +351,31 @@ protected void end() {
351351 }
352352 };
353353 }
354+
355+ /**
356+ * Create a command which releases control of a subsystem.
357+ *
358+ * The {@link Command} returned by this method will require the given
359+ * subsystem, and end instantly. This has the effect of stopping any
360+ * command using the given subsystem, and of starting the default
361+ * command, if one exists.
362+ *
363+ * @param subsystem The subsystem to release
364+ * @return A command which releases the subsystem
365+ */
366+ public static Command release (Subsystem subsystem ) {
367+ if (subsystem == null ) {
368+ throw new NullPointerException ("subsystem == null" );
369+ }
370+
371+ return new Command () {
372+ {
373+ requires (subsystem );
374+ }
375+ @ Override
376+ protected boolean isFinished () {
377+ return true ;
378+ }
379+ };
380+ }
354381}
You can’t perform that action at this time.
0 commit comments