-
Notifications
You must be signed in to change notification settings - Fork 6
Subsystems
Sometimes the basic elements of a robot don't exactly fulfill your design requirements. You might need the robot to function in a way that uses multiple elements in conjunction. Luckily, the Subsystem class fills that role.
Subsystems are groups of modules that perform functions that one module could not do by itself. They are elements of the robot with multiple components which act together.
###Ways to use Subsystems
-
You can simply construct a Subsystem using this form to enable and disable a group of modules
Subsystem mySubsystem = new Subsystem(new Module[] {mod1, mod2, mod3});
-
You can extend Subsystem and insert all of the elements in the super constructor. For example
public class MySubsystem extends Subsystem { private final MyModule mod1, mod2, mod3;
public MySubsystem(MyModule mod1, MyModule mod2, MyModule mod3) { super(new Module[] {mod1, mod2, mod3}); this.mod1 = mod1; this.mod2 = mod2; this.mod3 = mod3; } public void foo() { mod1.foo() mod2.foo() mod3.foo() }}
-
You can use a Subsystem Builder for uses of dynamic modules that have different configurations. Unfortunately due to the limitations of the design, this solution does not allow you to insert your own functions in the subsystem. (similar to option #1)