Widgets para el marco de trabajo basado en comandos

Glass also has several widgets that are specific to the command-based framework. These include widgets to schedule commands, view actively running commands on a specific subsystem, or view the state of the command scheduler.

Widget de selección de comandos

La Command Selector le permite iniciar y cancelar una instancia específica de un comando (enviado a través de NetworkTables) desde Glass. Por ejemplo, puede crear una instancia de MyCommand y enviarla a SmartDashboard:

MyCommand command = new MyCommand(...);
SmartDashboard.putData("My Command", command);
#include <frc/smartdashboard/SmartDashboard.h>
...
MyCommand command{...};
wpi::SmartDashboard::PutData("My Command", &command);
from wpilib import SmartDashboard
command = MyCommand(...)
SmartDashboard.put_data("My Command", command)
Command Selector widget showing that "MyCommand" is running with the option to cancel

El widget tiene dos estados. Cuando el comando no se está ejecutando, aparecerá el botón: guilabel: Ejecutar; al hacer clic en él, se programará el comando. Cuando el comando se está ejecutando, aparecerá un botón: guilabel: Cancelar, acompañado del texto: guilabel:` Ejecutando … `(como se muestra arriba). Esto cancelará el comando.

Widget de subsistema

The Subsystem widget can be used to see the default command and the currently scheduled command on a specific subsystem. If you are using the SubsystemBase base class, your subsystem will be automatically sent to NetworkTables over LiveWindow. To view this widget, look under the LiveWindow main table name in the NetworkTables menu.

Subsystem widget showing the state of "DriveSubsystem". Default Command: "DefaultDrive". Current Command: "DriveDistance"

Widget del programador de comandos

El widget Programador de comandos permite ver todos los comandos programados actualmente. Además, cualquiera de estos comandos puede ser cancelado desde la GUI.

Scheduler widget. Scheduled commands are "DriveDistance" and "MyCommand". Both have the option to cancel.

La instancia de CommandScheduler se envía automáticamente a NetworkTables a través de LiveWindow. Para ver este widget, busque debajo del nombre de la tabla principal LiveWindow en el menú NetworkTables.