Quote:
Originally Posted by Alan Anderson
If you're worried about writing commands to control individual cylinders, you're probably not at the appropriately high level of abstraction. I suggest that you should be controlling subsystems, not actuators. The subsystem implementation should take care of the details of motor and relay and solenoid control based on commands for speed and state.
|
That is exactly what we did last year. However, after writing the same code in a subsystem for the 6th solenoid and the 3rd on/off motor, it gets kind of old. For easy things like a solenoid or on/off motor, I'm not against giving up a little bit of self documenting code, if it makes writing the code easier and less error prone.
Quote:
Originally Posted by Kevin Sevcik
You can make commands generic-ish by passing parameters to a parameterized constructor, then having that command pass that parameter to a parameterized method of your subsystem. I'll type up a quick c++ example in a bit here and post it.
|
I'm now thinking about a generic "super" command that you can pass a solenoid to. Then make a bunch of commands that extends the "super" command. This commands would be named appropriately per the function and would pass the appropriate solenoid or motor in the constructor and any other parameters, and not need any more code.