Command based vs non-command based code

I am confused as to the differences between command based and non-command based code. Also, which is better(I know better is subjective but still) and why did you pick it?

Command based frc robots allow for advanced users to do more. The other types tend to be less complex, but allow for less advanced functionality.

I might be a little bit biased so I’ll just to steal a paragraph from the documentation:

What is “Command-Based” Programming?

“Command-based” programming is an example of what is known as a design pattern. It is a general way of organizing one’s robot code that is well-suited to a particular problem-space. It is not the only way to write a robot program, but it is a very effective one; command-based robot code tends to be clean, extensible, and (with some tricks) easy to re-use from year to year.

2 Likes

I think that it’s a clean interface to the robot. I think that subdividing the robot into relevant parts (Subsystems) and having a set of functionality (Commands) that only apply to those relevant parts is actually quite nice. Helps our students understand the discrete parts of the robot, and it also helps the software side understand how things in different subsystems can be done in parallel in a fairly simple way.

Once they start to see those things, implementing triggers like button presses and the like for command scheduling sort of becomes intuitive and second nature for the kids.

^^ What was said above. The real kicker in terms of FRC is that if you decide to build a new manipulator at the last minute (or borrow one), it is far easier and quicker to integrate the new function into a command-based robot than the other Java/C++ paradigms.

2 Likes