Widgets pour l’infrastructure logicielle orientée commande

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 sélection de commandes

Le widget Command Selector vous permet de démarrer et d’annuler une instance spécifique d’une commande (envoyée via NetworkTables) depuis Glass. Par exemple, vous pouvez créer une instance de MyCommand et l’envoyer à 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)
Widget Command Selector montrant que "MyCommand" est en cours d’exécution avec l'option d’annuler

Le widget a deux états. Lorsque la commande n’est pas en cours d’exécution, un bouton Run apparaît - en cliquant dessus, la commande sera programmée. Lorsque la commande est en cours d’exécution, un bouton Cancel, accompagné du texte Running … apparaît (comme indiqué ci-dessus). Cela annulera la commande.

Widget de sous-système

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.

Widget Subsystem affichant l’état de "DriveSubsystem".  Commande par défaut: "DefaultDrive". Commande actuelle: "DriveDistance"

Widget du planificateur de commandes

Le widget Command Scheduler vous permet de voir toutes les commandes actuellement programmées. De plus, n’importe laquelle de ces commandes peut être annulée à partir de l’interface graphique.

Widget Scheduler ou Planificateur. Les commandes planifiées sont "DriveDistance" et "MyCommand". Les deux sont pourvues de l'option d’annuler.

L’instance CommandScheduler est automatiquement envoyée à NetworkTables via LiveWindow. Pour afficher ce widget, regardez sous le nom de la table principale LiveWindow dans le menu NetworkTables.