.. _WebGUI: WebGUI ======= You can interact with the platform using the web interface. You can access it using a web browser of your choice (Firefox and Chrome/Chromium are preferred though) by navigating to ``:8888``. Toolbar ------- Toolbar consists of three parts: App Menu Navigate through the app. Page title Display information about current page. Action buttons On every page you will see at least the login / logout button. Other buttons will be explained in the corresponding section. Map --- Changing Pilot Modes ^^^^^^^^^^^^^^^^^^^^ Navigation """""""""" To switch into navigation mode: .. image:: ../../share/icons/hicolor/48x48/actions/pilot-navigation-mode.png :alt: pilot-navigation-mode.png :width: 48 Navigation mode allows for autonomous operation. If needed initialize the localization first via the *Pose Estimate Tool*, see below. Mapping """"""" To create a new :ref:`GridMap` switch to the mapping mode: .. image:: ../../share/icons/hicolor/48x48/actions/pilot-mapping-mode.png :alt: pilot-mapping-mode.png :width: 48 Now you can move the platform around using the hardware joystick. The new :ref:`GridMap` will be created and updated while driving around. When the mapping process is finished you can upload the new map to the platform by clicking the *Save* button. .. note:: Requires permissions of *neo-installer* or *neo-admin* when connecting remotely. Map Update """""""""" To update the current :ref:`GridMap` switch to the map update mode: .. image:: ../../share/icons/hicolor/48x48/actions/pilot-map-update.png :alt: pilot-map-update.png :width: 48 The platform needs to be localized before entering this mode. .. note:: Requires permissions of *neo-installer* or *neo-admin* when connecting remotely. Set Goal Pose ^^^^^^^^^^^^^ .. image:: ../../share/icons/hicolor/48x48/actions/pilot-set-goal-pose.png :alt: pilot-set-goal-pose.png :width: 48 ``Left Click / Tap`` and move to define a new goal pose. Red dot on the icon will indicate this mode is enabled. Set Goal Station ^^^^^^^^^^^^^^^^ .. image:: ../../share/icons/hicolor/48x48/actions/pilot-set-goal-station.png :alt: pilot-set-goal-station.png :width: 48 ``Left Click / Tap`` on a map station to set a new goal station. Red dot on the icon will indicate this mode is enabled. Cancel Goal ^^^^^^^^^^^ .. image:: ../../share/icons/hicolor/48x48/actions/pilot-stop.png :alt: pilot-stop.png :width: 48 Will abort the current goal and stop immediately. Pose Estimate Tool ^^^^^^^^^^^^^^^^^^ .. image:: ../../share/icons/hicolor/48x48/actions/pilot-set-pose-estimate.png :alt: pilot-set-pose-estimate.png :width: 48 ``Left Click / Tap`` and move to define a pose estimate (initialize localization). Red dot on the icon will indicate this mode is enabled. Set Pose Tool ^^^^^^^^^^^^^ In simulation mode it is possible to "teleport" the platform via: .. image:: ../../share/icons/hicolor/48x48/actions/pilot-set-pose.png :alt: pilot-set-pose.png :width: 48 ``Left Click / Tap`` and move to define a pose. Red dot on the icon will indicate this mode is enabled. Data Recording ^^^^^^^^^^^^^^ To start a recording: .. image:: ../../share/icons/hicolor/48x48/actions/pilot-playback-record-start.png :alt: pilot-playback-record-start.png :width: 48 .. note:: The resulting file will be in ``user/data/``. To stop a recording: .. image:: ../../share/icons/hicolor/48x48/actions/pilot-playback-record-stop.png :alt: pilot-playback-record-stop.png :width: 48 .. note:: This button is only enabled when a recording is active. Adjust View ^^^^^^^^^^^ .. image:: ../../share/icons/hicolor/48x48/actions/pilot-move-and-rotate.png :alt: pilot-move-and-rotate.png :width: 48 This mode activates ovelayed controls for zooming and rotating the view. Also the view can be moved around by ``Left Click / Tap`` and move. Settings ^^^^^^^^ .. image:: ../../share/icons/hicolor/48x48/emblems/pilot-settings.png :alt: pilot-settings.png :width: 48 In this context menu you can toggle visibility of various map layers. .. note:: The same context menu can be accessed by ``Right Click / Tap & Hold``. .. tip:: Displaying Lidar Points and Local Cost Map is CPU intensive. Disable this layers to reduce CPU / GPU usage. Logs ---- On this page the last 100 PlatformPilot log messages can be viewed. It is also possible to stop / resume message polling and filter messages by log level using action buttons. .. _TaskEditor: TaskEditor ---------- .. cpp::namespace:: LUA_script Introduction ^^^^^^^^^^^^ The TaskEditor offers visual way to create and manage tasks for the PlatformPilots TaskHandler module. It allows users to generate Lua programs using graphical blocks by dragging and linking them. It also offers easy access to the PlatformPilots API. After a little training, the creation of programs is done intuitively. So that even complex sequences of task can be implemented very fast. The TaskEditor is build on top of the *Blockly* library. Further information: * https://developers.google.com/blockly * https://github.com/google/blockly/wiki * https://blockly-demo.appspot.com/static/demos/code/index.html * https://blockly.games/ * https://blockly-demo.appspot.com/static/tests/playground.html Toolbox ^^^^^^^ The toolbox is the side menu from whence the user may drag and drop blocks into the workspace. There are two types of blocks with and without return value. Blocks without return value can be used directly to build a program workflow. Blocks with a return value are used as input for other blocks (i.e. variables or parameters). PlatformPilot """"""""""""" The following blocks offer direct access to PlatformPilots API. See :ref:`LUA_script`. .. rubric:: Hardware +-------------------------------------------------------------+ | read_analog_input | +============================+===================+============+ | Parameters | channel | [number] | +----------------------------+-------------------+------------+ | Returns | [number] | +----------------------------+--------------------------------+ | Corresponding Lua function | :cpp:func:`read_analog_input` | +----------------------------+--------------------------------+ +-------------------------------------------------------------+ | read_digital_input | +============================+===================+============+ | Parameters | channel | [number] | +----------------------------+-------------------+------------+ | Returns | [boolean] | +----------------------------+--------------------------------+ | Corresponding Lua function | :cpp:func:`read_digital_input` | +----------------------------+--------------------------------+ +-------------------------------------------------------------+ | set_relay | +============================+===================+============+ | Parameters | channel | [number] | | +-------------------+------------+ | | state | [boolean] | +----------------------------+-------------------+------------+ | Returns | [void] | +----------------------------+--------------------------------+ | Corresponding Lua function | :cpp:func:`set_relay` | +----------------------------+--------------------------------+ +-------------------------------------------------------------+ | set_digital_output | +============================+===================+============+ | Parameters | channel | [number] | | +-------------------+------------+ | | state | [boolean] | +----------------------------+-------------------+------------+ | Returns | [void] | +----------------------------+--------------------------------+ | Corresponding Lua function | :cpp:func:`set_digital_output` | +----------------------------+--------------------------------+ +-------------------------------------------------------------+ | set_display_text | +============================+===================+============+ | Parameters | text | [string] | +----------------------------+-------------------+------------+ | Returns | [void] | +----------------------------+--------------------------------+ | Corresponding Lua function | :cpp:func:`set_display_text` | +----------------------------+--------------------------------+ +-------------------------------------------------------------+ | charge | +============================+===================+============+ | Returns | [void] | +----------------------------+--------------------------------+ | Corresponding Lua function | :cpp:func:`charge` | +----------------------------+--------------------------------+ +-------------------------------------------------------------+ | start_charging | +============================+===================+============+ | Returns | [void] | +----------------------------+--------------------------------+ | Corresponding Lua function | :cpp:func:`start_charging` | +----------------------------+--------------------------------+ +-------------------------------------------------------------+ | stop_charging | +============================+===================+============+ | Returns | [void] | +----------------------------+--------------------------------+ | Corresponding Lua function | :cpp:func:`stop_charging` | +----------------------------+--------------------------------+ +-------------------------------------------------------------+ | reset_motors | +============================+===================+============+ | Returns | [void] | +----------------------------+--------------------------------+ | Corresponding Lua function | :cpp:func:`reset_motors` | +----------------------------+--------------------------------+ .. rubric:: Information Requests +--------------------------------------------------------------------+ | get_time_sec | +============================+=====================+=================+ | Returns | [number] | +----------------------------+---------------------------------------+ | Corresponding Lua function | :cpp:func:`get_time_sec` | +----------------------------+---------------------------------------+ +--------------------------------------------------------------------+ | get_time_millis | +============================+=====================+=================+ | Returns | [number] | +----------------------------+---------------------------------------+ | Corresponding Lua function | :cpp:func:`get_time_millis` | +----------------------------+---------------------------------------+ +--------------------------------------------------------------------+ | get_time_macros | +============================+=====================+=================+ | Returns | [number] | +----------------------------+---------------------------------------+ | Corresponding Lua function | :cpp:func:`get_time_macros` | +----------------------------+---------------------------------------+ +--------------------------------------------------------------------+ | get_position | +============================+=====================+=================+ | Returns | [Pose2D] | +----------------------------+---------------------------------------+ | Corresponding Lua function | :cpp:func:`get_position` | +----------------------------+---------------------------------------+ +--------------------------------------------------------------------+ | find_closest_station [#require_neobotix]_ | +============================+=====================+=================+ | Parameters | max_distance | [number] | | +---------------------+-----------------+ | | position | [Pose2D] | +----------------------------+---------------------+-----------------+ | Returns | [string] | +----------------------------+---------------------------------------+ | Corresponding Lua function | :cpp:func:`find_closest_station_name` | +----------------------------+---------------------------------------+ .. note:: ``find_closest_station`` in Blockly returns the name of the station during in Lua it returns the ``MapStation`` object. +--------------------------------------------------------------------+ | get_battery_remaining | +============================+=====================+=================+ | Returns | [number] | +----------------------------+---------------------------------------+ | Corresponding Lua function | :cpp:func:`get_battery_remainig` | +----------------------------+---------------------------------------+ +--------------------------------------------------------------------+ | is_charging | +============================+=====================+=================+ | Returns | [boolean] | +----------------------------+---------------------------------------+ | Corresponding Lua function | :cpp:func:`is_charging` | +----------------------------+---------------------------------------+ .. rubric:: Log +-------------------------------------------------------------+ | log_info | +============================+===================+============+ | Parameters | message | [string] | +----------------------------+-------------------+------------+ | Returns | [void] | +----------------------------+--------------------------------+ | Corresponding Lua function | :cpp:func:`log_info` | +----------------------------+--------------------------------+ +-------------------------------------------------------------+ | log_warn | +============================+===================+============+ | Parameters | message | [string] | +----------------------------+-------------------+------------+ | Returns | [void] | +----------------------------+--------------------------------+ | Corresponding Lua function | :cpp:func:`log_warn` | +----------------------------+--------------------------------+ +-------------------------------------------------------------+ | log_error | +============================+===================+============+ | Parameters | message | [string] | +----------------------------+-------------------+------------+ | Returns | [void] | +----------------------------+--------------------------------+ | Corresponding Lua function | :cpp:func:`log_error` | +----------------------------+--------------------------------+ .. rubric:: Modules .. function:: require(module_name) :param String module_name: Load module defined by ``module_name``. ``module_name`` can be either a file name or a folder name. In the latter case all files in the folder will be included. :returns: void .. function:: call(function_name, {args}) :param string function_name: Call function named ``function_name``. :param Array args: ``args`` is an array of arguments passed to the function. Use the ``create list with`` block to wrap parameters or use a variable containing either a single parameter or a list of parameters. :returns: Return value depends on what the function to be called returns. .. rubric:: Movement +----------------------------------------------------------------------------------+ | move_to_station | +============================+=====================+===============================+ | Parameters | name | [string] | | +---------------------+-------------------------------+ | | options | [:ref:`pilot.goal_options_t`] | +----------------------------+---------------------+-------------------------------+ | Returns | [void] / [boolean] | +----------------------------+-----------------------------------------------------+ | Corresponding Lua function | :cpp:func:`move_to_station` | +----------------------------+-----------------------------------------------------+ +----------------------------------------------------------------------------------+ | move_to_position | +============================+=====================+===============================+ | Parameters | position | [Pose2D] | | +---------------------+-------------------------------+ | | options | [:ref:`pilot.goal_options_t`] | +----------------------------+---------------------+-------------------------------+ | Returns | [void] / [boolean] | +----------------------------+-----------------------------------------------------+ | Corresponding Lua function | :cpp:func:`move_to_position` | +----------------------------+-----------------------------------------------------+ +----------------------------------------------------------------------------------+ | move | +============================+=====================+===============================+ | Parameters | dx | [number] | | +---------------------+-------------------------------+ | | dy | [number] | | +---------------------+-------------------------------+ | | dr | [number] | | +---------------------+-------------------------------+ | | options | [:ref:`pilot.goal_options_t`] | +----------------------------+---------------------+-------------------------------+ | Returns | [void] / [boolean] | +----------------------------+-----------------------------------------------------+ | Corresponding Lua function | :cpp:func:`move` | +----------------------------+-----------------------------------------------------+ .. rubric:: OPC-UA +----------------------------------------------------------------------------------+ | opc_ua_call | +============================+=====================+===============================+ | Parameters | proxy | [string] | | +---------------------+-------------------------------+ | | object | {[number],[string]} | | +---------------------+-------------------------------+ | | method | [string] | | +---------------------+-------------------------------+ | | args | [array] | +----------------------------+---------------------+-------------------------------+ | Returns | [variant] | +----------------------------+-----------------------------------------------------+ | Corresponding Lua function | :cpp:func:`opc_ua_call` | +----------------------------+-----------------------------------------------------+ +----------------------------------------------------------------------------------+ | opc_ua_call_global | +============================+=====================+===============================+ | Parameters | proxy | [string] | | +---------------------+-------------------------------+ | | method | [string] | | +---------------------+-------------------------------+ | | args | [array] | +----------------------------+---------------------+-------------------------------+ | Returns | [variant] | +----------------------------+-----------------------------------------------------+ | Corresponding Lua function | :cpp:func:`opc_ua_call` | +----------------------------+-----------------------------------------------------+ .. note:: ``opc_ua_call_global`` internally calls ``opc_ua_call`` and passes ``nil`` as the ``object`` parameter. +----------------------------------------------------------------------------------+ | opc_ua_read | +============================+=====================+===============================+ | Parameters | proxy | [string] | | +---------------------+-------------------------------+ | | object | {[number],[string]} | | +---------------------+-------------------------------+ | | variable | [string] | +----------------------------+---------------------+-------------------------------+ | Returns | [variant] | +----------------------------+-----------------------------------------------------+ | Corresponding Lua function | :cpp:func:`opc_ua_read` | +----------------------------+-----------------------------------------------------+ +----------------------------------------------------------------------------------+ | opc_ua_read_global | +============================+=====================+===============================+ | Parameters | proxy | [string] | | +---------------------+-------------------------------+ | | variable | [string] | +----------------------------+---------------------+-------------------------------+ | Returns | [variant] | +----------------------------+-----------------------------------------------------+ | Corresponding Lua function | :cpp:func:`opc_ua_read_global` | +----------------------------+-----------------------------------------------------+ +----------------------------------------------------------------------------------+ | opc_ua_write | +============================+=====================+===============================+ | Parameters | proxy | [string] | | +---------------------+-------------------------------+ | | object | {[number],[string]} | | +---------------------+-------------------------------+ | | variable | [string] | | +---------------------+-------------------------------+ | | value | [variant] | +----------------------------+---------------------+-------------------------------+ | Returns | [boolean] | +----------------------------+-----------------------------------------------------+ | Corresponding Lua function | :cpp:func:`opc_ua_write` | +----------------------------+-----------------------------------------------------+ +----------------------------------------------------------------------------------+ | opc_ua_write_global | +============================+=====================+===============================+ | Parameters | proxy | [string] | | +---------------------+-------------------------------+ | | variable | [string] | | +---------------------+-------------------------------+ | | value | [variant] | +----------------------------+---------------------+-------------------------------+ | Returns | [variant] | +----------------------------+-----------------------------------------------------+ | Corresponding Lua function | :cpp:func:`opc_ua_write_global` | +----------------------------+-----------------------------------------------------+ +----------------------------------------------------------------------------------+ | node_id | +============================+=====================+===============================+ | Parameters | nsi | [number] | | +---------------------+-------------------------------+ | | id | [number] | +----------------------------+---------------------+-------------------------------+ | Returns | {[number],[number]} | +----------------------------+-----------------------------------------------------+ | Corresponding Lua function | | +----------------------------+-----------------------------------------------------+ +----------------------------------------------------------------------------------+ | node_id | +============================+=====================+===============================+ | Parameters | nsi | [number] | | +---------------------+-------------------------------+ | | name | [string] | +----------------------------+---------------------+-------------------------------+ | Returns | {[number],[string]} | +----------------------------+-----------------------------------------------------+ | Corresponding Lua function | | +----------------------------+-----------------------------------------------------+ .. rubric:: User Input +--------------------------------------------------------------------+ | wait_for_joystick | +============================+==========================+============+ | Returns | [number] | +----------------------------+---------------------------------------+ | Corresponding Lua function | :cpp:func:`wait_for_joystick` | +----------------------------+---------------------------------------+ +--------------------------------------------------------------------+ | wait_for_joystick_button | +============================+==========================+============+ | Parameters | button | [number] | +----------------------------+--------------------------+------------+ | Returns | [void] | +----------------------------+---------------------------------------+ | Corresponding Lua function | :cpp:func:`wait_for_joystick_botton` | +----------------------------+---------------------------------------+ +--------------------------------------------------------------------+ | wait_for_digital_input | +============================+==========================+============+ | Parameters | channel | [number] | | +--------------------------+------------+ | | state | [boolean] | +----------------------------+--------------------------+------------+ | Returns | [void] | +----------------------------+---------------------------------------+ | Corresponding Lua function | :cpp:func:`wait_for_digital_input` | +----------------------------+---------------------------------------+ +--------------------------------------------------------------------+ | wait_ms | +============================+==========================+============+ | Parameters | period | [number] | +----------------------------+--------------------------+------------+ | Returns | [void] | +----------------------------+---------------------------------------+ | Corresponding Lua function | :cpp:func:`wait_ms` | +----------------------------+---------------------------------------+ +--------------------------------------------------------------------+ | wait_sec | +============================+==========================+============+ | Parameters | period | [number] | +----------------------------+--------------------------+------------+ | Returns | [void] | +----------------------------+---------------------------------------+ | Corresponding Lua function | :cpp:func:`wait_sec` | +----------------------------+---------------------------------------+ +--------------------------------------------------------------------+ | wait_min | +============================+==========================+============+ | Parameters | period | [number] | +----------------------------+--------------------------+------------+ | Returns | [void] | +----------------------------+---------------------------------------+ | Corresponding Lua function | :cpp:func:`wait_min` | +----------------------------+---------------------------------------+ +--------------------------------------------------------------------+ | wait_hours | +============================+==========================+============+ | Parameters | period | [number] | +----------------------------+--------------------------+------------+ | Returns | [void] | +----------------------------+---------------------------------------+ | Corresponding Lua function | :cpp:func:`wait_hours` | +----------------------------+---------------------------------------+ .. rubric:: Footnotes .. [#require_neobotix] For this blocks to work, you have to insert ``require('neobotix')`` to your program. (See :func:`require`) Core """" The following blocks offer access to basic code concepts like variables, logical expressions and loops. If you are not familiar with programming concepts, please consult the official blockly documentation, which you can find at * https://developers.google.com/blockly * https://github.com/google/blockly/wiki However, in the following section you will find a description of some important blocks. .. rubric:: Add-ons .. note:: This section contains custom blocks provided by Neobotix GmbH. .. function:: return The ``return`` block ends current function and returns a value. .. function:: to_string The ``to_string`` block converts a value of any type to a string. .. rubric:: Variables Variables can be created in several different ways: * Some blocks such as count with and for each use a variable and defines its values. A traditional computer science term for these are loop variables. * User-defined functions (also known as "procedures") can define inputs, which creates variables that can be used only within the function. These are traditionally called "parameters" or "arguments". * Users may create variables at any time through the "set" block. These are traditionally called "global variables". Blockly does not support local variables. **Important blocks** set The set block assigns a value to a variable, creating the variable if it doesn't already exist. get The get block provides the value stored in a variable, without changing it. **Dropdown menu** Clicking on a variable's dropdown symbol (triangle) gives the following menu: .. image:: webgui_variables-dropdown.png :alt: Dropdown menu :width: 150 The menu provides the following options. * the names of all existing variables defined in the program. * ``Rename variable...`` changes the name of this variable wherever it appears in the program. Selecting this option opens a prompt for the new name. * ``Delete the ... variable`` deletes all blocks that reference this variable wherever it appears in the program.