Skip to content
This repository has been archived by the owner on Oct 25, 2023. It is now read-only.

arduino_hmi

furmi edited this page Apr 2, 2018 · 2 revisions

Description

This page references the documentation for both the ROS package drivers_ard_hmi as well as the proper arduino code and electronics.

The HMI (Human-Machine Interface) is a fully-independent arduino responsible of letting the user configure the robot before and after each game. It can also be used for displaying status and debug information with attached LEDs or with on-board display written data.

The selection is done through a mini OLED display and 4 buttons, with a UI interface designed for configuring each initialization step.

How to use it

When booting the arduino, the OLED UI loads and puts itself in standby mode (the OLED shows a "WAITING..." screen), waiting for ROS to connect to the arduino.

The UI has the following screens and transition procedures :

  • Init screen
    • Enter : Automatically shown when the arduino is powered up.
    • On-screen : No interaction available. The UI is blocked until ROS is connected.
    • Exit : ROS connection detected (arduino received at least one game_status message). Will change the center text to "READY". Will automatically switch to the next screen when both the team and strategies names are received from ROS (from ai_scheduler). If you wish to continue without having both lists for team and strategy selection, click on OK to continue manually.
  • Team selection screen
    • Enter : Entered after the init screen. Is automatically entered if both strategy and team names are received.
    • On-screen : This is the selection screen where you will chose which team the robot is in for the incoming game. The strategy and team list is configured in the ai_scheduler definition files and automatically sent by this package when the HMI is connected to ROS. Simply select the team to use with the UP and DOWN arrows and continue with the OK button. You can also go back to the Init screen with the BACK button. If no list was received and the user enter manually, the team with ID "0" will be automatically selected and the user can only use the OK and BACK buttons.
    • Exit : The screen transitions to the Strategy selection screen when the user clicks on the OK button. The selected team is stored and reused in the Arming confirmation screen.
  • Strategy selection screen
    • The strategy selection screen works exactly like the previous one, only used for strategy selection (configured in ai_scheduler) instead of teams. Use the screen just like before. When hitting OK, the screen will transition to the Arming confirmation screen. Selected team and Strategy IDs are stored in global variables.
  • Arming confirmation
    • Enter : Entered after both the team and strategy have been selected by the user. The screen has access to the selected ID (as they are stored in global variables).
    • On-screen : This screen is simply used for confirming the team and strategy were correctly selected. The UI will display "READY?" and standby until the user clicks on OK.
    • Exit : If the user wishes to change the team or strategy, clicking on BACK will transition to the strategy selection screen. Otherwise, clicking on OK will send a ROS message on a topic listened by ai_scheduler and memory_map containing the selected team and strategy IDs. No UI transition will occur, the ROS system will launch and the UI will change when the Jack is asked.
  • Jack confirmafion
    • Enter : When the ROS system sends a ROSEvent message with event type "JACK", the arduino will automatically switch to this screen no matter where it is. This can happen anytime.
    • On-screen : The system has asked for the user to pull on the Jack. This means the robot is armed, calibrated and ready to start the game. Just pull on the Jack and the robot will start with the selected team and strategy configuration!
    • Exit : Pulling on the Jack will, just like the Arming screen, publish a ROSEvent message of type "JACK", listened by ai_scheduler. No UI transition will happen, the in-game screen will activate automatically.
  • In-Game screen
    • Enter : When game_status is detected to be set at IN_GAME, the arduino will automatically transition to this screen no matter what.
    • On-screen : No interaction available. The UI will display a timer progress bar and the current game score (received from ai_scheduler).
    • Exit : The user cannot cancel the game for now, but will soon be able to click on BACK to send a HALT status to game_status and go back to the Init screen.

Installation and electronics

The arduino setup is running over rosserial, you can simply compile and upload the sketch by following the normal rosserial procedure.

Electronics and connections

The arduino is only connected to a few components and is very easy to wire up :

  • The OLED display is nothing mode than an i2c device, just connect the module to the appropriate 3.3v, GND, SCL and SCK lines.
  • Please see on the arduino sketch which pins are connected to LEDs and wire then up based on these pins.
  • The buttons, bought as an AliExpress module, are internally configured as a matrix.

This is the schematic of the HMI :

And this is the HMI mounted on a breadbord, before robot integration :

Configuration

The initialization process is "hard-coded" (easy to change but made for a specific workflow). There is no configuration file or variables to change.

Communication

Servers

Clients

How it works