Documentation / v1.0 / Core / GUI

From emss Framework - iRobot Create C++ Framework

Jump to: navigation, search

You are here: Documentation / v1.0 / Core / GUI


Contents

[edit] GUI

The GUI packet consists of different widget classes which can be used in an emss application to control the robot, display information of the Core, set properties, et cetera. Most of these classes are quite generic and can be re-used in other projects.

[edit] Viewport

Files:

GUI/Viewport.h Licensed under GPLv3
GUI/Viewport.cpp Licensed under GPLv3

The Viewport class is a very important part of the emss user interface. A Viewport has the ability to display any emss Map as well as the Map Objects. In addition to displaying Maps, a Viewport can accept actions from the user and provides the necessary tools for navigating the Maps, such as scrolling. A Viewport allows multiple Maps to be layered on-top of each other, and automatically generates the proper GUI elements for hiding and showing specific Maps. Core Maps can have multiple viewports attached to it, allowing a user to create a set of specialized Viewports to his liking. Viewports also allow a set of actions to be added to its toolbar. When the user clicks an action, the Viewport forwards this information back to the connected application which can in turn act on the given action. Other features such as auto focus and auto refresh make the Viewport a very flexible widget. The drawing routines have been specifically designed to run in a separate thread space, interfering with the emss Core as little as possible.

  // Initialize viewport
  Viewport *viewport = new Viewport(100); // Refresh every 100ms
  viewport->setAntiAlias(false);
  // Register maps with viewport
  viewport->registerMap(core->gridMap);
  viewport->registerMap(core->physicalMap);
  viewport->registerMap(core->terrainMap);
  viewport->registerMap(core->heatMap);
  viewport->registerMap(core->objectMap);
  // Add toolbar actions
  viewport->addToolbarAction("Task","task");
  viewport->addToolbarAction("Nav Point","navpoint");
  viewport->addToolbarAction("Environment Info","environmentinfo");
  viewport->addToolbarAction("Find Robot","findrobot");
  // Show widget and focus on robot
  viewport->show();
  viewport->focusOnPoint(core->robotObject->x, core->robotObject->y);
  ...
  // Cleanup...
  delete viewport;


[edit] Joystick

Files:

GUI/Joystick.h Licensed under GPLv3
GUI/Joystick.cpp Licensed under GPLv3

The Joystick class can be used to control the various Controllers. It provides a widget which can be controlled by the mouse and provides all the appropriate slots and signals. The joystick has two yokes: x and y, which in turn can be used for control. Furthermore, it can be customized to force exclusive yokes – a mode where only one of the yokes can be moved at a time. In addition, the Joystick class also provides control over its acceleration and deceleration, a useful feature for gently controlling a robot.

[edit] Options Dialog

Files:

GUI/OptionsDialog.h Licensed under GPLv3
GUI/OptionsDialog.cpp Licensed under GPLv3

Often a user interface requires some sort of choice from the user. The Options Dialog class provides an easy to call, blocking static method choose(options,description,title) which creates a modal dialog of choices based on the options parameter. The choice in options must separated by the | character.

  QString controller = OptionsDialog::choose("Block Drive|Fluid|emss", "Please
  select a controller type:", "New Controller");

[edit] Settings Editor

Files:

GUI/SettingsEditor.h Licensed under GPLv3
GUI/SettingsEditor.cpp Licensed under GPLv3

Any emss application, including the Core itself, may have various settings. The Settings Editor class provides a simple text field where all settings are displayed and may be edited. The class accepts any standard QSettings data structure, making it plug-and-play with all Qt settings objects.

[edit] Task Editor

Files:

GUI/TaskEditor.h Licensed under GPLv3
GUI/TaskEditor.cpp Licensed under GPLv3

The Task Manager holds a list with all created Tasks. The Task Editor class allows an emss application to easily manage the Cores current Tasks. In addition to displaying Task Information, Running Tasks may be stopped.