Widgets para el marco de trabajo basado en comandos

Glass también tiene varios widgets que son específicos para el command-based framework. Estos incluyen widgets para programar comandos, ver los comandos que se están ejecutando activamente en un subsistema específico, o ver el estado del 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{...};
frc::SmartDashboard::PutData("My Command", &command);
from wpilib import SmartDashboard

command = MyCommand(...)
SmartDashboard.putData("My Command", command)

Nota

The MyCommand instance can also be sent using a lower-level NetworkTables API or using the Shuffleboard API. In this case, the SmartDashboard API was used, meaning that the Command Selector widget will appear under the SmartDashboard table name.

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.