New Command Based Issues

I’m new to command based this year and learned over the summer. With the introduction of the new command based, the RobotContainer is completely stumping me if anyone has an example robot?

Have you gone through the documentation at

1 Like

Of course, once again. New to command based and was never taught it, I am just looking for a good example I so I can understand further


Gives links to some example projects.

1 Like

I found this set of pages helpful


Thanks! Ive gotten command based working in the past so I understand how it works but the new command system really confused me. I think I’ve got a good grip on it now, good luck!

1 Like

The Old Command base libraries are still there and could still be used. The new system will satisfy the high end groups that write software test for their code. This is something we should all be setting for a goal, but for now if your programming mentors are not at this level and your comfortable with the old model stick with that and translate your working code over latter to the new system. You can look at the installed GearsBot sample to see how the program should look in the end.

Thanks! I didn’t even look at the sample! Sadly I don’t have a programming mentor or team of programmers, it’s just me. So I would have to figure it out on my own using forums or documentation.

1 Like

I also had to figure out all by myself, but the programming lead before me taught me a little on Timed Robot so then I saw tutorials and the WPILib documentation and kind of got the thing, I am not an expert but I hope this helps you.

From what I understood from the new Command Base RobotContainer is that it is like a new OI interface, but instead of just putting the joysticks/XboxControllers and button commands, we are taking down some of the old command Base.

For example, in Robot we had to do the new instance of our subsystem, now we do that at Robot Container and we also have to do the same with Commands but that hasn’t worked for me yet.

Here is an example of my code at RobotContainer with an Xbox Controller Joystick. And something else I saw is that we now have the public Command getAutonomousCommand where we put our autonomous command, which then is being called at Robot in AutonomousInit() which I think was the same as the old command base.
What I am just doing at the code is creating the Xbox Controller control and getting the Y value of my Xbox Controller which may be one of the joysticks, I also have my Subsystem DriveTrain which I am recalling as driveTrain to use it at the “addRequirements()” thing at my Command constructor.

If you got any questions about this thing I wrote, feel free to ask.

public class RobotContainer {
  // The robot's subsystems and commands are defined here...
  // private final ExampleSubsystem exampleSubsystem = new ExampleSubsystem();
  public static DriveTrain driveTrain = new DriveTrain();
  // private final ExampleCommand autoCommand = new ExampleCommand(exampleSubsystem);

  public static XboxController control = new XboxController(Constants.ControlXbox);

   * The container for the robot. Contains subsystems, OI devices, and commands.
  public RobotContainer() {
// Configure the button bindings

  public static double getRawTrig(int axis)
return control.getY();

  private void configureButtonBindings()

// JoystickButton botonX = new JoystickButton(control, 3);

// botonX.whenPressed(new Tankdrive());


   * Use this to pass the autonomous command to the main {@link Robot} class.
   * @return the command to run in autonomous

  //  Here I take an Autonomous Command from my commands

  public Command getAutonomousCommand() {
// An ExampleCommand will run in autonomous
return autoCommand;
1 Like

Here is why my team programmed in regard to the new framework.

This is definitely worth a read--

It gives you clear cut explanations for what (and why) the new command-based framework does compared to what the previous one did.

1 Like

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.