Skip to content

Flashboard

Tom Tzook edited this page Oct 9, 2017 · 15 revisions

Introduction

Flashboard is a customizable multi-purpose dashboard for robot operations. Robot softwares can use it to display a multitude of data in different ways, as well as receive user input through it. In addition, robots can use Flashboard to perform image processing using FlashLib's Dynamic Vision System, and receive post-vision analysis.

Flashboard Controls

To allow customization of data, Flashboard uses a dynamic control creation system. With it, users can define controls from the robot software and display them on Flashboard. Placement of the control on the flashboard depends on the control type.

There are 5 control types:

  1. Simple Display: Simple display controls use text to display values. Those controls are read-only.
  2. Graphic Display: Graphic display controls use different types of graphic controls to display data, for example: charts. Those controls are read-only.
  3. Input Controls: Input controls allow changes of values from the robot or by user input to the dashboard.
  4. Activation Controls: Activation controls can activate certain code parts in our robot once indicated by the dashboard.
  5. Special Controls: Special controls use independent windows for display and input instead of the main window.

Communications

Flashboard uses the FlashLib communications library for communication with the robot. There are 2 communication types:

  1. Standard: communication for flashboard controls data, using the Communication class.
  2. Camera: communication for camera images for the camera display/vision operations, using the CameraClient class.

Both flashboard communication parts are "clients" and look for a remote server which should run on the robot. Each communication part can communicate with one remote at a time, but it is possible to split the remotes.

Standard communications can use either a TCP or a UDP protocol for communications, depending on user configuration.

Vision

Flashboard uses FlashLib's vision library to perform image processing and then send the results to a connected robot. The vision itself is ran using a VisionRunner object, and is done in the following manner:

  1. Image data is read from the Flashboard camera server.
  2. The vision runner analyzes the image using the selected VisionProcessing object.
  3. The results are displayed on a post-processing frame mode.
  4. The results are sent to the connected robot.

So for the vision to work, both the camera server and the standard communications must be connected and a VisionProcessing object must be selected.

When flashboard starts, it loads all vision XML files from data/saves. So you can place your file there for auto loading. It is possible to also manually load a vision file from the software.

On shutdown, flashboard saves any changes to vision parameters into the data/saves folder. This also means that if a file was loaded and is not in the saves folder, it will be saved there now.

Flashboard Configuration

Flashboard has several parameters which can be configured by users and allow for customization in software operations. Those parameters are saved in data/dash.xml and can be edited from there or from the software itself.

The currently avaliable properties used by flashboard are:

  • vision.default: Name of a vision processing object to be set for use by default. must be in the saves folder data/saves.
  • host.robot: Hostname for the standard Flashboard communications to connect to. For example: roborio-3388-frc.local.
  • host.cam: Hostname for the Flashboard camera communications to connect to. For example: roborio-3388-frc.local.
  • comm.protocol: Communication protocol with the robot:
    • tcp: TCP protocol
    • udp: UDP protocol
  • comm.port.local: Local port for standard robot communications. Default is 5800.
  • comm.port.remote: Remote port for standard robot communications. Default is 5800.
  • cam.port.local: Local port for camera robot communications. Default is 5802.
  • cam.port.remote: Remote port for camera robot communications. Default is 5802.

If the configuration file is missing, it will be created with default settings. If values were changed in the file, but flashboard is currently running, those properties will not be updated and might be overriden when flashboard is closed.

Remote Control

Remote control of the Flashboard is done using the Flashboard class in edu.flash3388.flashlib.flashboard. This class allows users to add controls, control vision and send camera images.

Communications

The robot control communication hosts the communication servers for standard and camera communications using the Communications class and CameraServer class. It is possible to only use one of the two and not both if wanted. It is also possible to set local ports and addresses if wanted instead of using defaults, but this would require making sure the Flashboard software is configured accordingly.

Initialization

Before using flashboard control, it is necessary to initialize it. This can be data by calling the Flashboard.init() method. It has 2 overloads:

  • One receives a Flashboard.FlashboardInitData object which contains initialization data for flashboard
  • Another simply receives initialization variables as parameters.

There are 5 initialization parameters:

  • mode: mode indicates to the control class whether to initialize only standard communication, only camera communication or both.
  • ipAddress: the local ip address for the standard communications, or null to automatically detect. This is useful to insure that the currect local address is used in case of multiple network interfaces.
  • port: local port for the standard communications.
  • camport: local port for the camera communications.
  • tcp: indicates whether the standard communications should use a TCP protocol or a UDP protocol for communications.

Once initialization is complete, users can start adding controls to the flashboard. If using standard communications, it is necessary to call Flashboard.start() to actuall start the standard communications.

Controls

Each flashboard control is represented by a class which extends the Sendable class. Those can be attached to the Flashboard by calling Flashboard.attach(Sendable). To use controls, make sure flashboard control was initialized for standard communication.

Vision Control

Flashboard vision is controled using a RemoteVision object which can be accessed from Flashboard.getVision(). If flashboard standard communication was not initialized, this will return null.

The returned object is an implementation of FlashLib's Vision interface and allows starting, stopping, getting vision results, adding processing objects, etc.

Camera Server

The Flashboard camera server can send data from one camera at any given time. It uses a CameraServer object for data sending and a CameraView object to allow multiple cameras. At any given time only one camera can send data, but it is possible to switch cameras when necessary.

A camera must be an implementation of flashlib's Camera interface. To add the camera, it is needed to get the CameraView object and add the camera to it. It is then possible to set a CameraViewSelector object to the CameraView to control which camera sends images.

To get the CameraView object, call Flashboard.getCameraView(). If the camera server was not initialized, null is returned.

User Interface

Flashboard

  1. Camera View: View control of images from the camera server.
  2. Simple Display Controls: Area for simple controls which only display data. This includes: labels.
  3. Graphic Display Controls: Area for graphic controls which only display data. This includes: charts and value indicators.
  4. Input Controls: Area for controls which can receive input from users. This includes: input fields, sliders, combo boxes, check boxes.
  5. Activation Controls: Area for controls which can perform activation. This includes: buttons.
  6. Emergency Stop Control: Control for FlashLib's robot emergency stop mode.
  7. Simple Vision Control Area: Simple control of Flashboard's vision runner, including:
    1. Processing selection
    2. Color Filter control
    3. Run control
  8. Camera View Mode Sekectir: Vision view mode selector:
    1. Normal: Normal camera view
    2. Post Processing: Post vision analysis view. Shows analysis results.
    3. Threshold: Vision binary image.
  9. Communication Indicator: Indicator for the standard flashboard communication connection.
  10. Camera Server Indicator: Indicator for the flashboard camera server connection.
  11. Toolbar:
    1. Vision: Controlling vision.
      1. Load Parameters: Opens a loading window for vision parameters.
      2. Save Parameters: Opens a saving window for vision parameters.
      3. Show Vision Editor: Opens the Vision Editor Window.
    2. Monitoring: Tracking data from the robot.
      1. Show Logs: Opens the remote logs window.
      2. Show PDP: Opens the PDP data tracking window.
      3. Show Motor Tester: Opens the motor data tracking window.
      4. Show PID Tuner: Opens the PID tuner window.
    3. Tools: Robot control tools.
      1. Show HID Control: Opens the HID control window.
      2. Show Mode Selector: Opens the operation mode selector window.
    4. Help: Utilities.
      1. Show Properties: Opens a properties editor and creator windows.
      2. Restart Communication: Restart both standard and camera server communication.

Vision Control

The main window vision control allows for simple parameter control over the flashboard vision runner. Using it, users can stop/start the vision runner, select a processing object with which to perform image processing, and if the selected processing as a ColorFilter, it is possible to change its parameters.

Vision Editor Window

Vision Editor Window

The Vision Editor window allows editing filters of a vision processing object loaded by Flashboard. This includes adding/removing filters, changing filters locations and changing values of their parameters.

Log Window

Log Window

The log window contains data for each log-type sendable. Data is received from the moment of attaching the SendableLog object to the Flashboard. Each different log has a tab of its own. FlashLib adds the default log as a SendableLog to Flashboard by default.

Motor Tester Window

Motor Tester Window

The motor tester window can show data about motors, allowing operators to issure all motors operate as intended.

There are 4 data display columns:

  • Name: the name assigned to the motor for identification
  • BrakeMode: indicates whether the motor is in brake mode or coast mode. True for brake mode, false for coast mode.
  • Speed: indicates the current speed value of the motor. Usually the value is a Percent VBus data, that depends on what the "get" method of the FlashSpeedController returns.
  • Voltage: indicates the current voltage drop of the motor. Requires the existance of a voltage source.
  • Current: indicates the current consumption of the motor. Requires the existance of a current source.

PDP Window

PDP Window

The PDP window can show data from multiple Power Distribution Panels and is specific for FRC robots. It is necessary to select the PDP to show from the ComboBox. Once one is selected, data about it is shown. PDP data includes total current, voltage, tempature and current of each channel. Data is updated in real time. PDP 0 is loaded by default.

PID Tuner Window

PID Tuner Window

The PID Tuner window allows users to track real-time PID control data. It shows a graph of the current process variable and allows changing the PID setpoint, P constant, I constant, D constant and F constant while running. In addition, it provides an ability to tune the PID feeds according to a desired tunning type. It is possible to create several PID tuners on a robot and attach them to the Flashboard.

When using PID loops, it is recommanded to use the PID tuner provided to appropriatlly tune the loop for maximal performance.

HID Control Window

HID Window

The HID control window shows data about controllers and joysticks connected to the computer. The window can show up to 6 HIDs, each numbered from 0 to 5.

Mode Selector Window

Mode Selector Window

The mode selector window allows control over robot operation modes. Users can manually define operation modes and select them. By default, there is a disabled mode. To switch modes, simply select the mode and press the enable button. To switch to disabled mode, press the disable button.

Operation modes are loaded from a file on startup and saved into a file on shutdown. So defined modes remain between each run.

This window controls the Mode Selector Control.

Properties Window

Props Window

The properties viewer allows editing flashboard properties during run time.

There are two properties windows which allow to edit Flashboard properties:

  • Edit Properties: Allows to edit the values of the existing properties.
  • Create Properties: Allows to create new properties.

Those properties are saved under data/dash.xml.

Emergency Stop

The emergency stop function allows disabling of robot functions in a press of a button. The specifics of such disabling differ between platforms, but all result in the same thing. When initialized, FlashLib automatically allows the Flashboard to use the emergency stop function.

Controls

Flashboard has several different controls which can be added by robot code and then displayed on the window. Each control is a class under edu.flash3388.flashlib.flashboard which extends the Sendable class from the communication library. Each control should have a name, those names are displayed with the controls and are necessary for identifing them on the dashboard.

Labels

Labels are a type of simple data display and show a string of data with the control name. Labels can display booleans, strings or numbers:

StrProp

StrProp

DProp

Labels are represented by the FlashboardLabel control class. This class has 3 constructors:

  • One receives a BooleanSource object for boolean data display.
  • Another receives a StringSource object for string data display.
  • The last receives a DoubleSource object for number data display.

The displayed value is updated automatically and received by calling get from the given source object.

It is possible to add this control by calling Flashboard.putLabel(name, source) and pass it the name and value source object. It has 3 overloads, one for each data type. Those methods returns the FlashboardLabel object attached to the flashboard.

Direction Indicator

The direction indicator is a type of graphic display control which shows a value between 0 and 360.

direction indicator

The control class is FlashboardDirectionIndicator. It receives a name and a DoubleSource object. The displayed value is updated automatically and received by calling get from the given source object.

It is possible to add this control by calling Flashboard.putDirectionIndicator(name, source) and pass it the name and value source object. This method returns the FlashboardDirectionIndicator object attached to the flashboard.

Boolean Indicator

The boolean indicator is a type of graphic display control which shows a boolean value.

boolean indicator

The control class is FlashboardBooleanIndicator. It receives a name and a BooleanSource object. The displayed value is updated automatically and received by calling get from the given source object.

It is possible to add this control by calling Flashboard.putBooleanIndicator(name, source) and pass it the name and value source object. This method returns the FlashboardBooleanIndicator object attached to the flashboard.

XY Chart

The XY Chart control shows a graph with 2 variables: Y and X. There are 2 graph types:

  • Line: a standard graph
  • Area: marks the area between the graph line and the X axis.

line chart

area chart

The FlashboardXYChart control receives a name, a FlashboardXYChart.ChartType object, two DoubleSource objects (x, y) and minimum and maximum values for the X and Y axes.

FlashboardXYChart.ChartType is an enum which holds the types of graph which can be shown. The options are either Area or Line.

The axes data is updated automatically by calling the get method for the source objects given for the axes.

The minimum and maximum values for each axis dectate what range of values is shown at any given time. If an axis value passes one of the boundaries, the boundaries are moved but the range of data remains the same. For example if we set a boundary of 0.0 to 10.0 for the X axis, and a value of 11.0 is received by the value source, then the new boundaries are 10.0 to 20.0.

It is possible to add this control by calling Flashboard.putLineChart(name, sourceX, sourceY, minX, maxX, minY, maxY) for line char, or Flashboard.putAreaChart(name, sourceX, sourceY, minX, maxX, minY, maxY) for area chart, and pass them the name, value source objects and boundaries. Those methods returns the FlashboardXYChart object attached to the flashboard.

Bar Chart

Bar chart is a graphical display control which shows a graph for a single variable. A bar chart can show multiple graph series, each has a single variable and all are displayed next to each other.

bar chart

FlashboardBarChart receives the chart name and minimum and maximum values. To add a chart series, call addSeries and pass it the series name and a DoubleSource object which returns the values to display. The displayed value is updated automatically and received by calling get from the given source object.

The value boundaries are static, so if a series value is not in the given boundaries, the chart will either appear full or empty, depending on whether the value is bigger than the maximum or smaller than the minimum.

It is possible to add this control by calling Flashboard.putBarChart(name, minY, maxY) and pass it the name and value boundaries. This method returns the FlashboardBarChart object attached to the flashboard.

Button

A button is a type of activatable control which can be displayed on flashboard. It is possible to instruct the button to start several Action objects when pressed. When the button is pressed, it will remain disabled until all attached Action objects finish running.

Btn

The control class is FlashboardButton and it has a single constructor which receives the button name. This class has a whenPressed method which receives an Action objects and attaches it for activation when the button is pressed. It is possible to add multiple Action objects.

It is possible to add this control by calling Flashboard.putButton(name, actions) and pass it the name and actions to attach. This method returns the FlashboardButton object attached to the flashboard.

Combo Box

A combo box which is a type of input control. It is possible to add this control options from which to select and then users can select which action to use.

Chooser

This control can be used from the class FlashboardChooser<T> which is a generic class. Each option is a combination of a name and a value. The name is shown on the flashboard, the value can only be accessed from the robot. The generic type is the class type of the value.

Each option is represented by the FlashboardChooser.Option<T> class. Options can be added by calling addOption and its overloads. There can also be a default option which is selected immediately and set by addDefault.

To get the current selected object, call getSelected(). It is also an option to use the selectedValueProperty() and get a Property<T> object which can get the value. To set the current selected value, use select and pass an index to select.

It is possible to add this control by calling Flashboard.putChooser(name, options) and pass it the name and options to attach. This method returns the FlashboardChooser object attached to the flashboard.

Input Field

An input field for string, boolean or double values which is a type of input control. The field can receive inputs from users and send them to robot or receive inputs from the robot and send to the flashboard.

Input

FlashboardInput receives a name and one of three properties:

  • DoubleProperty for double values input.
  • BooleanProperty for boolean values input.
  • StringProperty for string values input.

The code also insures that the inputed value is valid. To set the value from the robot, call the set method of the given property object. To get the value, call get method of the property object. The displayed value is updated automatically and received by calling get from the given property object.

It is possible to add this control by calling Flashboard.putInput(name, prop) and pass it the name and value property object. It has 3 overloads, one for each data type. This method returns the FlashboardInput object attached to the flashboard.

Slider

An input slider for double values which is a type of input control. The value is limited between 2 given boundaries. The slider also has a "tick" count, which indicates the minimum wanted value change. The slider value can be changed from the robot or by a user from the flashboard.

Slider

FlashboardSlider receives a name, DoubleProperty, minimum and maximum value boundaries, and a tick count. Using the value boundaries and the given tick count, the minimum value change is calculated (max - min)/tick_count. So for boundaries of 0 to 1 and a tick count of 10, the minimum change value is 0.1.

To set the value from the robot, call the set method of the given property object. To get the value, call get method of the property object. The displayed value is updated automatically and received by calling get from the given property object.

It is possible to add this control by calling Flashboard.putSlider(name, prop, min, max, ticks) and pass it the name, value property object, value boundaries and tick count. This method returns the FlashboardSlider object attached to the flashboard.

Check Box

A check box is a type of input control for boolean values. The control value can be changed from the robot or from the flashboard by a user.

check box

The FlashboardCheckBox class receives a name and a BooleanProperty object. To set the value from the robot, call the set method of the given property object. To get the value, call get method of the property object. The displayed value is updated automatically and received by calling get from the given property object.

It is possible to add this control by calling Flashboard.putCheckBox(name, prop) and pass it the name and value property object. This method returns the FlashboardCheckBox object attached to the flashboard.

Emergency Stop

Control for the Emergency Stop function. Should not be created and attached manually, since it is automatically attached.

Estop

Remote Log

A control for the flashlib Log class which sends the log data to the flashboard. The sent data is shown in the log window.

The control class is FlashboardRemoteLog and receives a log object. To direct logging data, a LogListener object is added to the given log object which sends the data to flashboard.

To add this control, create an instance of the control class and pass it to Flashboard.attach(Sendable).

Motor Tester

The motor tester control is used for tracking motor data during operation. Each control can show data from a several motors. The data is displayed in the motor tester window.

The control class is FlashboardMotorTester which receives a name. A motor is represented by a FlashboardMotorTester.TesterMotor object and can be added by calling addMotor from a tester object.

Each FlashboardMotorTester.TesterMotor can show data about its current value. It is also possible to show motor voltage data or current data by adding DoubleSource objects to the tester motor object.

To add this control, create an instance of the control class and pass it to Flashboard.attach(Sendable).

PID Tuner

The PID tuner control is used to track and modify PID controller values during operation. Data is displayed in the PID Tuner window.

The FlashboardPIDTuner class receives a name, DoubleProperty objects for the PID constants (P, I, D, F), DoubleProperty object for the setpoint and a PIDSource object for the current system output value.

The PID setpoint or loop constants can be edited from the PID tuner window.

To add this control, create an instance of the control class and pass it to Flashboard.attach(Sendable).

Mode Selector

The mode selector control allows selection of operation mode for the robot. There should be a maximum of one control of this type and it can be viewed on the Mode Selector window. The mode selector is controlled by the window.

FlashboardModeSelectorControl class retreives data from the mode selector. This class is a singelton, and if the singleton is initialized when Flashboard.start() is called, it is added to flashboard automatically. To get the instance, call getInstance(), if an instance does not exits, it is created. Do not use this class directly, instead use the FlashboardModeSelector class in edu.flash3388.flashlib.robot which implements ModeSelector.

HID Control

The HID control reads controllers data and sends it to the robot. There should be a maximum of one control of this type and it can be viewed on the HID Control window.

FlashboardHIDControl class retreives data from the HID control. This class is a singelton, and if the singleton is initialized when Flashboard.start() is called, it is added to flashboard automatically. To get the instance, call getInstance(), if an instance does not exits, it is created. Do not use this class directly, instead use the FlashboardHIDInterface class in edu.flash3388.flashlib.robot which implements HIDInterface.

PDP

The PDP control shows data from an FRC Power Distribution Panel during operation. Data can be viewed in the PDP window.

The control class is PDP and is located under edu.flash3388.flashlib.robot.frc. This class uses the WPILib PowerDistributionPanel class to access the PDP data and send it.

If using an FRC robot initialization, PDP 0 is added by default to flashboard.

To add this control, create an instance of the control class and pass it to Flashboard.attach(Sendable).

Clone this wiki locally