APP4MC-Rover Documentation

Introduction

../roverstatic/images/rover_logo.png

What is rover or APP4MC-rover?

Rover (APP4MC-rover) is an open-source mobile robot that is designed to demonstrate the outcomes of APP4MC and APPSTACLE projects. Rover features applications and tooling required to address complex research fields such as cloud communication, open-source tooling, multi-core and cluster computing. Rover is equipped with powerful sensors, motors, and display units to interact with the physical world. Furthermore, Rover uses Eclipse PolarSys project for its chassis and mechanics.

../roverstatic/images/rover11_2017.png ../roverstatic/images/rover2.jpg

Rover software, called roverapp features a multi-threaded (POSIX threads or Pthreads) C/C++ implementation that runs on Linux-based embedded single board computers (such as Raspberry Pi). Rover features countless threads dedicated to communication infrastructure, sensor driving, display unit (such as OLED displays) utilization, bluetooth communication, image processing, and behavior modes (such as Parking, Adaptive Cruise Control, Manual Driving, and Booth Modes). It also features drivers for sensors such as magnetometers, accelerometers, various ultrasonic sensors, and camera modules. Furthermore, OLED display, buttons, a buzzer are utilized.

../roverstatic/images/roverwebdisplay.png

It also features a web user interface, called roverweb, that is used for many purposes such as sensor data visualization, camera streaming, displaying core utilization, and web-based robot control. Roverweb is equipped with a powerful embedded back-end that is called node.js and a main infrastructure library called socket.io. It makes use of the created javascript programs in order to create reactive web servers that communicate with websockets.

rover Motivations and Research

Rover is used as a demonstrator for two main subjects:

../roverstatic/images/APP4MCLogo.png
  • Model-based multi-core software development evaluation and tool support (with APP4MC tool)
    • For this purpose, threads are designed run in a schedulable and traceable fashion (with the help of timing library)
    • System traces are taken in Common Trace Format using Linux’ perf profiler and customly created scripts.
    • APP4MC is used for modeling and deployment outcomes
../roverstatic/images/APPSTACLE.png ../roverstatic/images/KUKSA.png
  • Cloud-based communication, data infrastructure testing (for APPSTACLE and Eclipse KUKSA projects)
    • For this purpose, a cloud instance with Eclipse Hono infrastructure is connected to using popular communication techniques such as MQTT, and REST API.
    • Eclipse Hono dashboard (using Grafana and InfluxDB) is configured.

    Our current testing ecosystem is given below:

    ../roverstatic/images/rover_infra2_exp.png

rover Infrastructure

A small yet crucial portion of Rover’s infrastructure (especially addressing network infrastructure) is given below. Rover uses javascript object notation (JSON) format for the information that is sent and received between processes. However, it makes use of the shared memory in order to communicate between threads.

../roverstatic/images/complete_infra.png

Roverapp is a C/C++ application with a single executable that makes use of its shared memory for data communication and that involves many drivers, custom libraries, external libraries, and many threads (with task functions).

Roverweb uses javascript (node.js) for its backend and javascript, jQuery, CSS, and HTML for its front-end. Roverapp to roverweb inter-process communication is handled using NET sockets and using TCP protocol, whereas roverweb front-end and back-end is connected using websockets (with HTTP and using Socket.IO events).

Rover Hardware

Complete Rover Hardware Requirements

An illustration of how components look and how they’re located in rover is given below:

../roverstatic/images/rovercomponents.png

Note

The complete list of materials to construct a rover is given in APP4MC Rover Wiki.

About Motor Driver Layer

In order to drive the motors of the DFRobot rover chassis, Pololu MC33926 Motor Driver for Raspberry Pi is used as a shield on top of Raspberry Pi 3.

For convenience in applications, following resources might be helpful (taken from Pololu):

../roverstatic/images/motorshield.jpg

About RoverSenseLayer Revision 2

../roverstatic/images/roversenselayer.png

RoverSenseLayer Features

RoverSenseLayer Revision 2 is a customly made circuit board that is designed as a shield on top of Pololu MC33926 Motor Driver. RoverSenseLayer Revision 2 provides interfaces for OLED display, sensors, buttons, analog to digital converter, voltage converters, and more.

Complete list of interfaces are given below:

  • 2x Push button
  • 1x Buzzer
  • 4x Sharp GP2Y0A41SK0F Analog Distance Sensor
  • 1x Pololu Dual MC33926 Motor Driver Connector
  • 1x A/D Converter MCP3208 DIP16
  • 2x I2C-tolerant Logic Level Converters
  • 1x HMC5883L Magnetometer
  • 1x GY-521Y Accelerometer
  • 1x OLED Display 0.96” I2C 4-pin
  • 1x DHT22 Temperature and Humidity Sensor
  • 2x HCSR-04 or Grove Ultrasonic Sensor
  • 4x Extra I2C lines for various sensors

RoverSenseLayer Revision 2 design properties are as follows for production:

  • Two-sided 82x67mm
  • Minimum hole size 0.3mm
  • Minimum track/spacing 6/6mil
  • Cutouts required
  • Plating required
  • Montage drill holes M2.5
  • (Preferrably) Red solder Mask
  • (Preferrably) White silkscreen

RoverSenseLayer Schematics

Note

Schematics can be found in the following git repository:

https://github.com/app4mc-rover/rover-sense-layer-rev2

RoverSenseLayer Source Files

Note

KiCad design files can be found in the following git repository:

https://github.com/app4mc-rover/rover-sense-layer-rev2

Hardware Setup Guide

The following image depicts the corresponding software to hardware mapping of proximity sensors and how they should be connected to RoverSenseLayer.

../roverstatic/images/roverconn.png

The following shows the pins used by the current roverapp software (the reference image from https://de.pinout.xyz/pinout/):

../roverstatic/images/rover_used_pins.png

Rover Software: roverapp

../roverstatic/images/roverapp_logo.png

What is roverapp?

Roverapp is an open-source C/C++ project for single board Linux computers (Raspberry Pi), especially designed for rover. It features multi-threaded schedulable and traceable software under GNU/Linux environment. For multi-threading, POSIX threads (Pthreads) and its synchronization implementations such as mutexes are widely used.

Roverapp complete feature list is given below:

  • Multi-threaded, schedulable and traceable embedded software.
  • Cloud communication to Hono 0.5-M9 infrastructure using REST API, using customly created hono_interaction library.
  • Utilized drivers for Linux modules such as bluetooth (bluetooth-dev).
  • I2C drivers and applications (threads) for OLED display, SRF02 ultrasonic sensor, HMC5883L magnetometer, GY-521Y accelerometer, etc.
  • Temperature and humidity measurement using DHT22 sensor.
  • Reactive implementations for TCP socket server and TCP socket client, with proper JSON formatted data for communication.
  • OLED display application that is able to display bluetooth, Hono cloud, ethernet, wireless interface, and internet with the help of status_library library.
  • OpenCV 2.4.9 utilization and image processing application (currently Traffic cone detection).
  • SHARP Analog Proximity measurement sensor interfacing and implementations.
  • SRF-02, HCSR-04, and Grove Ultrasonic sensor interfacing and implementations.
  • Motor driving implementations.
  • Timing measurement implementations with the help of timing library.
  • CPU core utilization measurement implementation.
  • Adaptive Cruise Control behavior implementation.
  • Parking behavior implementation.
  • Booth mode implementations.
  • Implementations for bluetooth-based driving from Android phones.

roverapp Infrastructure

../roverstatic/images/roverapp_infra.png

Downloading roverapp

Note

Rover-app source code is maintained under the following repository:

https://github.com/app4mc-rover/rover-app

Getting started with roverapp

Installation

Note

In order to see how roverapp is installed and compiled, please see roverapp Installation section.

Running roverapp

After installation, roverapp can be run by the following command from project root:

1
sudo ./roverapp

roverapp Complete Reference

Drivers

OLED Libraries

Created Libraries

status_library
hono_interaction

The current release covers communication with Eclipse Hono version 0.5-M9.

Registering a Device
Arguments

In order to register a device to the Eclipse Hono instance, registerDeviceToHonoInstance should be used. This function is defined as follows:

1
int registerDeviceToHonoInstance (char * host_name, int port, char * tenant_name, char * device_id)

The function takes the following arguments:

  • Host name to connect (char *)
  • Port to connect (int)
  • Tenant name (char *)
  • Device ID (char *)
Operation

This function constructs a curl call on the system by constructing a string such as the following:

1
curl -X POST -i -H 'Content-Type: application/json' -d '{"device-id": "4711"}' http://idial.institute:28080/registration/DEFAULT_TENANT

Afterwards, returning pipe content is read and parsed to decide whether the call is accepted or what kind of error has occurred.

Sending Telemetry Data to Eclipse Hono Instance
Arguments

In order to send telemetry data to the Eclipse Hono instance, sendTelemetryDataToHonoInstance should be used. This function is defined as follows:

1
int sendTelemetryDataToHonoInstance (char * host_name, int port, char * tenant_name, char * device_id, char * user, char * password, char * field, double value)

The function takes the following arguments:

  • Host name to connect (char *)
  • Port to connect (int)
  • Tenant name (char *)
  • Device ID (char *)
  • Username (char *)
  • Password (char *)
  • Field name (char *)
  • Value (double)
Operation

This function constructs a curl call on the system by constructing a string such as the following:

1
curl -X POST -i -u sensor1@DEFAULT_TENANT:hono-secret -H 'Content-Type: application/json' --data-binary '{"temp": 5}' http://idial.institute:8080/telemetry

Afterwards, returning pipe content is read and parsed to decide whether the call is accepted or what kind of error has occurred.

Sending Event Data to Eclipse Hono Instance
Arguments

In order to send event data to the Eclipse Hono instance, sendEventDataToHonoInstance should be used. This function is defined as follows:

1
int sendEventDataToHonoInstance (char * host_name, int port, char * tenant_name, char * device_id, char * user, char * password, char * field, double value)

The function takes the following arguments:

  • Host name to connect (char *)
  • Port to connect (int)
  • Tenant name (char *)
  • Device ID (char *)
  • Username (char *)
  • Password (char *)
  • Field name (char *)
  • Value (double)
Operation

This function constructs a curl call on the system by constructing a string such as the following:

1
curl -X POST -i -u sensor1@DEFAULT_TENANT:hono-secret -H 'Content-Type: application/json' --data-binary '{"temp": 5}' http://idial.institute:8080/event

Afterwards, returning pipe content is read and parsed to decide whether the call is accepted or what kind of error has occurred.

Handling REST API /HTTP Responses and Status Codes

In order to handle the response codes of HTTP requests, handleCode function is developed:

1
     int handleCode(int code)

The commonly occuring HTTP responses are parsed and displayed in this library within handleCode function.

Error Code Meaning Status Explanation in Hono Terminology
200 OK 1 Device registration is successful
201 Created 1 Device registration is successful
202 Accepted 1 Telemetry data is accepted at Hono instance
200..209   1  
400 Bad Request 0  
403 Forbidden 0  
409 Conflict 0 Device is already registered
400..409   0  
503 Service Unavailable 0 There is no consumer running. Please create a consumer

In the library, the meanings of commonlu occurring error codes are considered and status codes are generated. Status or exit code is what the functions in this library returns as an integer.

The following (non-UNIX) convention is adapted:

  • 1 → Successful exit
  • 0 → Non-successful exit

The status value can be used to check if functions succeed. Please see Example Usage section.

Debugging

The header file of the library contains two compiler directives for easy debugging of console output.

1
2
#define DEBUG_HTTP_RESPONSE 1
#define DEBUG_DEVICE_REGISTRATION 1

One can either define or comment/undefine these compiler directives. The first compiler directive is used for displaying the strings on console such as:

  • Constructed curl command
  • Parsed HTTP response code
  • The entire pipe that is returned

The second compiler directive is used for displaying the same information, but only in the device registration function. Ideally, since device is registered only once but the data is send constantly, it is advised to see this information at the device registration function, but not for the other functions, to prevent the console overhead. Due to the aforementioned reason, it is advised to keep this part as follows:

1
2
//#define DEBUG_HTTP_RESPONSE 1
#define DEBUG_DEVICE_REGISTRATION 1

But uncomment the first line only when it is suspected that something regarding cloud connection is failing.

When there is no internet connection with DEBUG_HTTP_RESPONSE defined, a message such as the following is displayed: Code: 0.

Example Usage
#include <stdio.h>
#include <stdlib.h>
#include "hono_interaction.h"
int main ()
{
          int status;
          double bearing_val;
          status = registerDeviceToHonoInstance("idial.institute",28080,"DEFAULT_TENANT", "roverBearing");
          if (status == 0)  // If DEBUG_HTTP_RESPONSE is commented, you can manually handle errors by using the status/exit code
          {
                        fprintf (stderr, "Device is not registered");
          }

          while (1)
          {
                        bearing_val = 0.5001;
                        status = sendTelemetryDataToHonoInstance("idial.institute",8080,"DEFAULT_TENANT", "4711","roverBearing", bearing_shared);
                        if (status == 0)  // If DEBUG_HTTP_RESPONSE is commented, you can manually handle errors by using the status/exit code
                        {
                                  fprintf (stderr, "Data is not sent");
                        }
          }
}
Resources

The material provided for hono_interaction uses Hono API, which is provided here: Hono API.

pthread_monitoring
pthread_distribution_lib
timing

Tasks and Threads

Rover API Documentation

../roverstatic/images/roverapi_logo.png

Note

Rover API (roverapi) is built with roverapp software.

Note

Rover API Documentation is provided in https://app4mc-rover.github.io/rover-app.

Rover Web UI: roverweb

../roverstatic/images/roverweb_logo.png

What is roverweb?

roverweb is a Web-based user interface that includes not only powerful back-end communication infrastructure with roverapp, but also provides functionalities such as driving the rover, camera streaming, visualizing core utilization, displaying sensor information, and sensor calibration.

Roverweb is equipped with a powerful embedded back-end that is called node.js and a main infrastructure library called socket.io. It makes use of the created javascript programs in order to create reactive web servers that communicate with websockets.

roverweb Infrastructure

Roverweb’s communication infrastructure is given below:

../roverstatic/images/roverweb_infra.png

roverweb Features

Downloading roverweb

Note

Rover-web source code is maintained under the following repositories:

https://github.com/app4mc-rover/rover-web

Getting started with roverweb

Installation

Note

In order to see how roverapp is installed and compiled, please see roverweb Installation section.

Running the Application

Before running the application, make sure that installation steps are successfully completed. In order to run the server after installation, the following command must be executed from roverweb root:

1
2
cd <your/roverweb/root/path>/scripts/nodejs/
sudo node start_roverweb.js

Warning

Be sure to change the folder to cd <your/roverweb/root/path>/scripts/nodejs/ before executing the script, since it’ll use default directory for hosting.

After reading from the console that HTTP server is running, the web interface could be accessed using http://192.168.168.1:5500/roverweb.html. Before the web interface can be opened, it is important for one to connect to the network (using SSID/PSK) of the rover.

For roverweb’s operation, it is not necessary for roverapp to be running. However, full functions of roverweb could be benefited when roverapp is also running.

Starting the Camera Stream

After mjpg_streamer is installed, one can start the camera stream in roverweb using the following command:

1
2
cd <your/roverweb/root/path>/
sudo bash scripts/bash/camera_stream/start_camera_stream.sh

Warning

Be sure that the start_camera_stream.sh is given execution permissions. This is achieved by sudo chmod +x scripts/bash/camera_stream/start_camera_stream.sh.

roverweb Complete Reference

Some Words on Infrastructure

Roverweb consists of the following elements:

  • roverweb_http_server.js: HTTP server realizes web interface contents in a proper fashion. Thus, the information can be displayed using web browsers.
  • roverweb_tcp_client.js: Reactive TCP client that connects to the TCP client end port and sends information to roverapp. TCP client implementation uses NET sockets and is implemented in a manner that constantly tries to reconnect if a connection fails.
  • roverweb_tcp_server.js: Reactive TCP server that connects to the TCP server end port and receives information from roverapp. TCP server implementation uses NET sockets and is implemented in a manner that constantly tries to reconnect if a connection fails.
  • roverweb_socketio_server.js: SocketIO server is a core implementation that handles Websocket communication between roverweb_socketio_server.js and roverweb_tcp_server.js and roverweb_tcp_client.js using HTTP protocol. It is able to pass data to/from HTTP server.
  • js-interfaces: Interface files are responsible for variable globalisation between roverweb_socketio_server.js and roverweb_tcp_server.js and roverweb_tcp_client.js.

Once the application is run using start_roverweb.js each of these components are initiated, and the web interface is available at http://192.168.168.1:5500/roverweb.html.

Ports

roverweb uses several ports in the network stack in order to keep communication running. The allocated ports are given below:

  • HTTP server: 5500
  • Socket.IO server: 5500 (same port as the HTTP)
  • Roverweb TCP server end: 8502
  • Roverweb TCP client end: 8501

Data Formats

Four types of data is currently passed between roverapp and roverweb’s reactive socket processes. Those data are all JSON formatted, concatenated with end of file (EOF) string \r\n.

  • Sensor Data (from roverapp to roverweb), denoted by sensor
  • Core Utilization Data (from roverapp to roverweb), denoted by util
  • Rover Control Data (from roverweb to roverapp), denoted by control
  • Rover Speed Data (from roverweb to roverapp), denoted by speed

Example data are shown below for each of the given data format types:

  • Sensor Data

    Data is periodically sent from roverapp to roverweb.

     1
     2
     3
     4
     5
     6
     7
     8
     9
    10
    11
    12
    13
    14
    15
         {
                 "rover_dtype"   : "sensor",
                 "data" :
                 {
                         "infrared0"   : 100.0,
                         "infrared1"   : 100.0,
                         "infrared2"   : 100.0,
                         "infrared3"   : 100.0,
                         "front"       : 20,
                         "rear"        : 15,
                         "temperature" : 22.0,
                         "humidity"    : 67.0,
                         "bearing"     : 47.0
                 }
         }\r\n
    
  • Utilization Data

    Data is periodically sent from roverapp to roverweb.

     1
     2
     3
     4
     5
     6
     7
     8
     9
    10
         {
                 "rover_dtype"   : "util",
                 "data" :
                 {
                         "core0"   : 100.0,
                         "core1"   : 100.0,
                         "core2"   : 100.0,
                         "core3"   : 100.0,
                 }
         }\r\n
    
  • Control Data

    Data is asynchronously (upon user events) sent from roverweb to roverapp.

    1
    2
    3
    4
    5
    6
    7
         {
                 "rover_dtype"   : "control",
                 "data" :
                 {
                         "command"   : "F",
                 }
         }\r\n
    

    command entry can indicate many integrated functions, such as the ones listed below:

    • P → Parking Mode Left
    • O → Parking Mode Right
    • U → Compass Calibration
    • M → Adaptive Cruise Control Mode
    • X → Manual Drive Mode
    • L → Booth Mode - Demo1
    • N → Booth Mode - Demo2
    • R → Shutdown Hook
    • U → Compass Calibration
    • F → Stop Movement
    • Q → Go Forward-Left
    • W → Go Forward
    • E → Go Forward-Right
    • A → Go Backward-Left
    • S → Go Backward
    • D → Go Backward-Right
    • J → Turn Left On Spot
    • K → Turn Right On Spot
  • Speed Data

    Data is asynchronously (upon user events) sent from roverweb to roverapp.

    1
    2
    3
    4
    5
    6
    7
         {
                 "rover_dtype"   : "speed",
                 "data" :
                 {
                         "speed"   : 360,
                 }
         }\r\n
    

Rover Telemetry UI: MQTT Client UI for Rover

../roverstatic/images/rovertelemetry_logo.png

Description

Rover Telemetry UI (rover-telemetry-ui) is designed to communicate with multi-agent rovers using MQTT protocol over cloud. It is built with node.js as a web application and it is used for reactive MQTT communication. Rover Telemery UI is shown below:

../roverstatic/images/rovertelemetryui_screen.png

Operation

Upon connection, rover-telemetry-ui subscribes to topic rover/<roverID>/telemetry, which is redirected from telemetry topic on the Eclipse Hono side.

../roverstatic/images/cloudinfra1.png

telemetry topic retrieves sensor and core usage information in following format:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
     {
             "gy521":{
                     "accel":{
                             "x":-1,
                             "y":-1,
                             "z":-1
                     },
                     "angle":{
                             "x":-35.264389038085938,
                             "y":-35.264389038085938,
                             "z":-54.735610961914062
                     },
                     "gyro":{
                             "x":-1,
                             "y":-1,
                             "z":-1
                     }
             },
             "hmc5883l":{
                     "bearing":47.366317749023438
             },
             "infrared":{
                     "frontleft":100.0,
                     "frontright":100.0,
                     "rearleft":100.0,
                     "rearright":100.0
             },
             "ultrasonic":{
                     "front":0.0,
                     "rear":0.0
             },
             "cores":{
                     "core0":55.099998474121094,
                     "core1":100.0,
                     "core2":100.0,
                     "core3":18.899999618530273
             }
     }

If connected, driving buttons can be used to send telemetry data to rover. This message is published to rover/<roverID>/RoverDriving/control topic in the following format:

1
2
3
4
5
{
             "mode":<int mode>,
             "command":<char command>,
             "speed":<int speed>
}

"speed" entry is an integer value between 360 (lowest speed) and 480 (highest speed) for the rover.

"command" entry indicates many integrated functions, such as the ones listed below:

  • F → Stop Movement
  • Q → Go Forward-Left
  • W → Go Forward
  • E → Go Forward-Right
  • A → Go Backward-Left
  • S → Go Backward
  • D → Go Backward-Right
  • J → Turn Left On Spot
  • K → Turn Right On Spot
  • R → Shutdown Rover

In rover-telemetry-ui only "mode":0 is supported, which indicated manual driving.

Using rover-telemetry-ui

Note

Project is hosted in the repository: https://github.com/app4mc-rover/rover-telemetry-ui.git.

To download:

1
git clone https://github.com/app4mc-rover/rover-telemetry-ui.git

To download dependencies (If you don’t have node.js installed, first install node.js):

1
2
cd rover-telemetry-ui
sudo npm install net connect serve-static http socket.io express path mqtt

To run the server:

1
2
cd scripts/
sudo node start_rovertelemetryui.js

Finally, go to your web browser and find the page at http://<your host address>:5055/rovertelemetryui.html.

Installation Instructions

Before You Begin..

Beginning with Raspberry Pi

Getting started instructions are here: Quick Start Guide

We advise you to use Raspbian Jessie or Raspbian Sketch from this website.

Enabling Bluetooth

In some Raspbian releases, bluetooth is pre-installed. In order to check if bluetooth is working execute the following command:

1
2
hcitool scan
service bluetooth status

In case the first command does not return with errors, that means that the bluetooth connection in Raspberry Pi is now available for use. The second command is used for checking if the bluetooth is active. If the first command results in an error, you can start the bluetooth service with the following commands:

1
2
sudo apt-get install pi-bluetooth bluez bluez-tools blueman
sudo systemctl start bluetooth

Warning

Use the following commands at your own RISK!!!

For older Raspbian Jessie distributions, there is a known issue of bluetooth not working properly. If you have such a problem, you can upgrade the distro version and use a specific kernel version which is working with bluetooth device. Following commands should be executed in order to do so:

1
2
3
4
sudo apt-get update
sudo apt-get dist-upgrade
sudo rm /etc/udev/rules.d/99-com.rules
sudo apt-get -o Dpkg::Options::="--force-confmiss" install --reinstall raspberrypi-sys-mods

If command above does not work, try the next one:

1
sudo apt-get install raspberrypi-sys-mods

Press Y to install the mods. Then do a kernel downgrade to version 4.4.50:

1
2
sudo systemctl reboot
sudo rpi-update 52241088c1da59a359110d39c1875cda56496764

As a final step, you should add btuart to your /etc/rc.local and reboot your Raspberry Pi.

1
sudo reboot

After reboot, you can test if bluetooth is working:

1
2
hcitool scan
service bluetooth status

Enabling I2C

Enabling I2C is explained here: Adafruit: Configuring I2C

Setting Up Camera

How to set up the Raspberry Pi camera is explained here: Camera configuration

Setting Up an Access Point

Access point setup is explained here: Access Point Setup.

(Please use 192.168.168.1 IP address for the rover.)

roverapp Installation

Installation procedure is tested with Raspberry Pi 3 / Raspbian Jessie and Raspbian Sketch. In case of any problems, please report to one of the project maintainers:

Requirements

The following are the build-time dependencies required for the roverapp:

  • build-essential
  • cmake
  • git-core
  • python-pip Python package installer
  • Python 2.7
  • gcc

The following are the run-time dependencies used for the roverapp:

  • Raspbian or similar distro that uses the Raspberry Pi metadata (meta-raspberrypi)
  • Access Point setup (with IP 192.168.168.1)
  • Python 2.7
  • psutil Python module
  • wiringPi library
  • raspicam-0.1.2 or raspicam-0.1.3 library
  • OpenCV 3.2.0 library
  • Json-Cpp library
  • bluetooth-dev, bluez, pi-bluetooth libraries
  • bcm2835 library
  • (modified) Adafruit_GFX and Adafruit_SSD1306 libraries
  • paho.mqtt.c libraries

Manual Installation Instructions

Installing Dependencies
Installing build-time dependencies
Installing Python 2.7

Raspberry Pi 3 comes with Python 2.7 installed. For other Linux distributions, it might be required to install:

1
sudo apt-get install python
Installing psutil

psutil is a performance tool library that is written in Python and that is able to provide information about GNU/Linux-based systems. First, python-pip must be installed:

1
2
sudo apt-get install python-pip
pip install psutil

If you already have psutil installed, you can upgrade it:

1
pip install psutil --upgrade
Installing other build-time dependencies

Raspberry Pi 3 comes with gcc installed.

1
sudo apt-get install build-essential git-core cmake
Installing run-time dependencies
Installing OpenCV

OpenCV installation is explained in this link.

Installing wiringPi

Installation of wiringPi is explained in this link.

Installing bluetooth
1
2
sudo apt-get update
sudo apt-get install bluez pi-bluetooth bluez-tools blueman libbluetooth-dev
Installing jsoncpp
1
2
3
4
5
6
7
8
cd /home/pi
git clone https://github.com/open-source-parsers/jsoncpp.git
cd jsoncpp
mkdir -p build
cd build
cmake ..
make
sudo make install
Installing raspicam

Installation of raspicam is explained in this link.

To install raspicam, execute the following commands:

1
2
3
4
5
6
7
8
cd /home/pi
git clone https://github.com/6by9/raspicam-0.1.3.git
cd raspicam-0.1.3
mkdir -p build
cd build
cmake ..
make
sudo make install

Note

As an alternative you can use the following git repository: raspicam 0.1.2.

Warning

If compilation using make command fails, one should make sure libmmal.so and libmmal_core.so is located in /opt/vc/lib. To install these libraries, one can do a Raspberry Pi firmware update: sudo rpi-update.

Installing paho.mqtt.c libraries

To install paho.mqtt.c libraries for MQTT-based cloud communication, execute the following commands:

git clone https://github.com/eclipse/paho.mqtt.c.git
cd paho.mqtt.c
make
sudo make install
Installing roverapp

Roverapp’s installation process is simplified by using CMake tool, a semi-automated Makefile generator for GCC compiler. The roverapp contains a CMakeLists.txt file which must be tailored after adding and linking libraries, objects, source files, and headers. As an example, the following customly created CMakeLists.txt file eases the process when compiling roverapp, provided that dependencies are installed.

#
# roverapp CMake file
# https://github.com/app4mc-rover/rover-app
#

#
# SETTINGS AND CMAKE CONFIG FINDING
#

cmake_minimum_required (VERSION 2.8.11)
project (roverapp)

# To find modules from other cmake-built projects that are searched with find_package,
# external cmake modules need to be provided. Those are typically named as Find<package>.cmake or <package>Config.cmake.
# Those must be added to the CMAKE_MODULE_PATH set below:
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_SOURCE_DIR}/ExternalCMakeModules)

#For find_package packages, export someextlib_DIR=/path/to/..
# Required packages
find_package (OpenCV REQUIRED)
find_package (raspicam REQUIRED)
find_package (Threads)

#Where to put binary files after "make"
set(EXECUTABLE_OUTPUT_PATH ${CMAKE_BINARY_DIR}/bin)

#Where to put library files after "make"
set(LIBRARY_OUTPUT_PATH ${CMAKE_BINARY_DIR}/libs)

#
# INCLUDE DIRECTORIES
#

#Include directories
include_directories (${CMAKE_SOURCE_DIR}/include)

#Include driver headers
include_directories (${CMAKE_SOURCE_DIR}/include/drivers/oled_drivers)

#Include directories for external libraries
include_directories( ${OpenCV_INCLUDE_DIRS} )
include_directories( ${raspicam_INCLUDE_DIRS} )
#include_directories( ${jsoncpp_INCLUDE_DIRS} )
#include_directories( ${bluetooth_INCLUDE_DIRS} )

#
# LIBRARIES
#

#Add api
add_library(roverapi SHARED ${CMAKE_SOURCE_DIR}/src/api/basic_psys_rover.c)

set(CUSTOM_LIBS_DIR ${CMAKE_SOURCE_DIR}/src/libraries)

#Add our custom libraries
add_library (hono_interaction SHARED
  ${CUSTOM_LIBS_DIR}/hono_interaction/hono_interaction.cpp)
add_library (pthread_distribution SHARED
  ${CUSTOM_LIBS_DIR}/pthread_distribution_lib/pthread_distribution.cpp)
add_library (status_library SHARED
  ${CUSTOM_LIBS_DIR}/status_library/status_library.cpp)
add_library (pthread_monitoring SHARED
  ${CUSTOM_LIBS_DIR}/pthread_monitoring/collect_thread_name.cpp)
add_library (timing SHARED
  ${CUSTOM_LIBS_DIR}/timing/timing.cpp)

#Add tasks
#Add all files to a variable ROVERAPP_TASK_FILES
file (GLOB_RECURSE ROVERAPP_TASK_FILES ${CMAKE_SOURCE_DIR}/src/tasks/*.cpp)
add_library (roverapptasks SHARED ${ROVERAPP_TASK_FILES})


#Add drivers
file (GLOB_RECURSE ROVERAPP_DRIVER_FILES
  ${CMAKE_SOURCE_DIR}/src/drivers/oled_drivers/*.c
  ${CMAKE_SOURCE_DIR}/src/drivers/oled_drivers/*.cpp
)
add_library (roverappdrivers SHARED ${ROVERAPP_DRIVER_FILES})

#
#  EXECUTABLE
#

#Add main executable
add_executable(roverapp ${CMAKE_SOURCE_DIR}/src/roverapp.cpp)

#
#  LINKING TO ROVER API
#

target_link_libraries (roverapi wiringPi)
target_link_libraries (roverapi wiringPiDev)

target_link_libraries(roverapi hono_interaction)
target_link_libraries(roverapi pthread_distribution)
target_link_libraries(roverapi status_library)
target_link_libraries(roverapi pthread_monitoring)
target_link_libraries(roverapi timing)

target_link_libraries (roverapi roverappdrivers)

#
#  LINKING TO ROVER TASKS
#

#Link external libraries
# Search with sudo find / -name *libx*
# If there is an x.so, you can link x library
target_link_libraries (roverapptasks opencv_core)
target_link_libraries (roverapptasks opencv_imgproc)
target_link_libraries (roverapptasks opencv_highgui)
target_link_libraries (roverapptasks jsoncpp)
target_link_libraries (roverapptasks bluetooth)
target_link_libraries (roverapptasks pthread)
target_link_libraries (roverapptasks wiringPi)
target_link_libraries (roverapptasks wiringPiDev)
target_link_libraries (roverapptasks raspicam)


#Linker actions to link our libraries to executable
target_link_libraries(roverapptasks hono_interaction)
target_link_libraries(roverapptasks pthread_distribution)
target_link_libraries(roverapptasks status_library)
target_link_libraries(roverapptasks pthread_monitoring)
target_link_libraries(roverapptasks timing)

#Link api
target_link_libraries (roverapptasks roverapi)

#Link drivers
target_link_libraries (roverapptasks roverappdrivers)

#
# LINKING TO MAIN EXECUTABLE
#

#Link external libraries
target_link_libraries (roverapp pthread)

#Link api
target_link_libraries (roverapp roverapi)

#Linker actions to link our libraries to executable
target_link_libraries(roverapp hono_interaction)
target_link_libraries(roverapp pthread_distribution)
target_link_libraries(roverapp status_library)
target_link_libraries(roverapp pthread_monitoring)
target_link_libraries(roverapp timing)

#Link tasks
target_link_libraries(roverapp roverapptasks)

#Link drivers
target_link_libraries (roverapp roverappdrivers)

#
# INSTALLING
#

#Install binary, shared library, static library (archives)
install(
  TARGETS roverapp roverapi
        roverapptasks
        roverappdrivers
        hono_interaction
        status_library
        pthread_monitoring
        timing pthread_distribution
  PUBLIC_HEADER
  RUNTIME DESTINATION /usr/bin
  LIBRARY DESTINATION /usr/lib
  ARCHIVE DESTINATION /usr/lib)

#Copy/install files to a certain static directory
install(FILES ${CMAKE_SOURCE_DIR}/scripts/read_core_usage.py
  DESTINATION /opt/rover-app/scripts/)

To install roverapp, the following command should be executed:

1
2
3
4
5
6
7
git clone https://github.com/app4mc-rover/rover-app.git
cd rover-app
mkdir -p build
cd build
cmake ..
make
sudo make install

Note

If the installation process complains about not being able to find FindOpenCV.cmake or OpenCVConfig.cmake, or any .cmake file for that matter, the file must be searched and exported to the environment with commands such as the following. Then building should be done such as the following:

sudo find / -name *OpenCVConfig.cmake*
cd build
sudo OpenCV_DIR=<path/to/OpenCVConfig.cmake> cmake ..
make
sudo make install

Same goes with raspicam:

sudo find / -name *raspicamConfig.cmake*
cd build
sudo OpenCV_DIR=<path/to/raspicamConfig.cmake> cmake ..
make
sudo make install

If desired, the automatic installation script can be used:

1
2
3
git clone https://github.com/app4mc-rover/rover-app.git
cd rover-app
sudo ./install_roverapp.sh

After installation, roverapp can be run by the following command:

1
sudo ./roverapp

Warning

Use the following if raspicam complains about not being able to find cmake file:

sudo raspicam_DIR=/home/pi/raspicam-0.1.3/build/ ./install_roverapp.sh

roverweb Installation

Requirements

The following are the build-time dependencies required for the roverweb:

  • git-core

The following are the run-time used for the roverweb:

  • Raspbian or similar distro that uses the Raspberry Pi metadata (meta-raspberrypi)
  • Access Point setup (with IP 192.168.168.1)
  • node.js with version 8.x or higher
  • node.js modules: net, connect, server-static, http, socket.io, express, path, mqtt
  • mjpg-streamer-experimental
  • curl

Manual Installation Instructions

Installing Dependencies
Installing build-time dependencies

The following are must-have build-time dependencies that are partially required by not only roverweb, but also many open-source packages.

1
2
sudo apt-get update
sudo apt-get install git-core
Installing curl
1
sudo apt-get install curl
Installing run-time dependencies
Installing node.js and its required modules

For roverweb to serve web-pages and handle communications, node.js is an important dependency. The following commands can be used to download and install node.js:

1
2
3
sudo apt-get update
curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -
sudo apt install nodejs

At this point, if the following command does not result in any errors, that means that node is successfully installed:

1
node -v

There are also node.js modules which are required for roverweb. Those modules must be installed by running the following:

1
sudo npm install net connect serve-static http socket.io express path mqtt

Warning

In case of problems while running roverweb, do this step after navigation to project directory.

Installing mjpg-streamer-experimental

One particular mjpg-streamer version provides streaming with Raspberry Pi.

In order to install the module, execute the following commands:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
sudo apt-get install cmake libjpeg8-dev

git clone https://github.com/jacksonliam/mjpg-streamer.git

cd mjpg-streamer-experimental
mkdir build
cd build
cmake ..
make
sudo make install
Installing roverweb
Downloading (Fetching) roverweb
1
git clone https://github.com/app4mc-rover/rover-web.git

After roverweb is installed, there is no need to install it to any static location. You can continue by running the server: roverweb Getting started

Cross Development in Raspbian

Roverapp Software Development Kit (SDK) Extension for Raspbian

Roverapp Software Development Kit (SDK) Extension features include files and library files for the dependencies of the Rover for Cross development. While it is tested with SysGCC Cross toolchain for Raspberry Pi, it is able to work with many others.

Note

Roverapp Software Development Kit (SDK) Extension for Raspbian is maintained under the following Git repository: https://github.com/app4mc-rover/rover-app-raspbian-cross-sdk.

Cross Development with Windows using Eclipse CDT and rover-app-raspbian-cross-sdk

In this section, cross development using Eclipse CDT IDE in Windows platform is explained.

Step 1: Windows Toolchain Setup

Raspberry Pi toolchain installations for Windows are provided in this website. Download raspbian-jessie or raspbian-stretch toolchain to match which distro used in the rover.

Step 2: Downloading and Installing Eclipse

Next step is to download the Eclipse CDT. Follow these steps :Eclipse IDE Setup.

Step 3: Setting Up Cross Compiler in Eclipse

Now that Eclipse is running, the next step is to set up the cross compiler aligned with the Raspberry Pi toolchain : Cross Compiler Setup.

Warning

Use roverapp for the project name while creating a new project.

Step 4: Downloading rover-app

Now that your project named roverapp exists, you can download or clone roverapp repository contents and put it in your project folder. Example way to achieve this in Linux is given below:

1
2
3
4
cd /path/to/your/project
git clone https://github.com/app4mc-rover/rover-app.git
cp -r rover-app/* .
rm -rf rover-app

Step 5: Downloading rover-app-raspbian-cross-sdk

To start using the SDK extension, download or clone the contents of the Git repository to a known location of your choice.

1
git clone https://github.com/app4mc-rover/rover-app-raspbian-cross-sdk.git

Step 6: Configuring Environment Variables

Paths discussed in this documentation are given relatively. Some environment variables including these paths need to be declared in Eclipse.

To achieve this, go to Properties for your project > C/C++ Build > Environment. Following variables should be declared:

  • RASPBERRY_TOOLCHAIN_PREFIX
    • Value: arm-linux-gnueabihf-
  • RASPBERRY_TOOLCHAIN_PATH
    • Example Value: C:\SysGCC\Raspberry
  • ROVERAPP_PROJECT_PATH
    • Example Value: C:\path\to\your\project\roverapp
  • ROVERAPP_CROSS_SDK_PATH
    • Example Value: C:\path\to\rover-app-raspbian-cross-sdk

An example declaration of those environment variables are shown in the following image:

../roverstatic/images/environmentvars.png

Step 7: Cross Settings

To make sure Eclipse CDT knows about your cross development toolchain, Cross settings must be completed as shown below under Properties for your project > C/C++ Build > Settings > Tool Settings > Cross Settings:

../roverstatic/images/crosssettings.png

Step 8: Run Configurations

From Run > Run Configurations, create a new run configuration and apply the following changes.

../roverstatic/images/runconfigurations.png

Under Connection in Run Configurations, enter your SSH credentials.

../roverstatic/images/credentials.png

Warning

In order to avoid certain authentication problems, connecting as root can be considered.

Step 9: Editing Preprocessor Definitions (-D)

Rover-app software is designed so that it compiles different files using different compilers. When cross debugging using Eclipse CDT, CROSS_COMPILE_ECLIPSE preprocessor definition must be declared.

To achieve this, locate to Properties for your project > C/C++ Build > Settings > Tool Settings > Cross GCC Compiler > Preprocessor and Properties for your project > C/C++ Build > Settings > Tool Settings > Cross G++ Compiler > Preprocessor and add the preprocessor definition as shown below:

../roverstatic/images/preprocessor.png

Step 10: Adjusting Include Paths (-I)

Include paths for the GNU toolchain should be specified in order to compile both internal and precompiled libraries. To do this with rover-app-raspbian-cross-sdk following steps should be done:

  • Go to Properties for your project > C/C++ Build > Settings > Tool Settings > Cross GCC Compiler > Includes and add the following to Include Paths (-I)
    • $(ROVERAPP_PROJECT_PATH)\include
    • $(ROVERAPP_CROSS_SDK_PATH)\includes\raspicam-0.1.3
    • $(ROVERAPP_CROSS_SDK_PATH)\includes\i2c-dev
    • $(ROVERAPP_CROSS_SDK_PATH)\includes\paho-mqtt
  • Go to Properties for your project > C/C++ Build > Settings > Tool Settings > Cross G++ Compiler > Includes and add the following to Include Paths (-I)
    • $(ROVERAPP_PROJECT_PATH)\include\drivers\oled_drivers
    • $(ROVERAPP_CROSS_SDK_PATH)\includes\raspicam-0.1.3
    • $(ROVERAPP_PROJECT_PATH)\include
    • $(ROVERAPP_CROSS_SDK_PATH)\includes\jsoncpp\include
    • $(ROVERAPP_CROSS_SDK_PATH)\includes\bluetooth
    • $(ROVERAPP_CROSS_SDK_PATH)\includes\wiringPi
    • $(ROVERAPP_CROSS_SDK_PATH)\includes\opencv-3.2.0\include
    • $(ROVERAPP_CROSS_SDK_PATH)\includes\opencv-3.2.0\modules\calib3d\include
    • $(ROVERAPP_CROSS_SDK_PATH)\includes\opencv-3.2.0\modules\features2d\include
    • $(ROVERAPP_CROSS_SDK_PATH)\includes\opencv-3.2.0\modules\flann\include
    • $(ROVERAPP_CROSS_SDK_PATH)\includes\opencv-3.2.0\modules\imgcodecs\include
    • $(ROVERAPP_CROSS_SDK_PATH)\includes\opencv-3.2.0\modules\ml\include
    • $(ROVERAPP_CROSS_SDK_PATH)\includes\opencv-3.2.0\modules\videoio\include
    • $(ROVERAPP_CROSS_SDK_PATH)\includes\opencv-3.2.0\modules\core\include
    • $(ROVERAPP_CROSS_SDK_PATH)\includes\opencv-3.2.0\modules\highgui\include
    • $(ROVERAPP_CROSS_SDK_PATH)\includes\opencv-3.2.0\modules\imgproc\include
    • $(ROVERAPP_CROSS_SDK_PATH)\includes\paho-mqtt

At the end, it should look like the following (roughly):

../roverstatic/images/preprocessor.png

Step 11: Specifying Precompiled Libraries to be Linked (-l) and Library Search Paths (-L)

Precompiled ARM-compiled binaries presented in the SDK extension such as shared object files .so, archive files .a, object files .o must be declared in the Eclipse CDT as a next step.

To achieve this using the rover-app-raspbian-cross-sdk, following steps must be performed:

  • Go to Properties for your project > C/C++ Build > Settings > Tool Settings > Cross G++ Linker > Libraries and add following to the Libraries (-l):
    • raspicam
    • raspicam_cv
    • pthread
    • opencv_ml
    • opencv_imgcodecs
    • opencv_videoio
    • opencv_calib3d
    • opencv_features2d
    • opencv_flann
    • opencv_core
    • opencv_highgui
    • opencv_imgproc
    • jsoncpp
    • bluetooth
    • wiringPi
    • wiringPiDev
    • paho-mqtt3a
    • paho-mqtt3as
    • paho-mqtt3c
    • paho-mqtt3cs
  • In the same window, add following to the Library search path (-L):
    • $(ROVERAPP_CROSS_SDK_PATH)\shared-libs\wiringPi-libs
    • $(ROVERAPP_CROSS_SDK_PATH)\shared-libs\raspicam-libs
    • $(ROVERAPP_CROSS_SDK_PATH)\shared-libs\opencv-libs
    • $(ROVERAPP_CROSS_SDK_PATH)\shared-libs\jsoncpp-libs
    • $(ROVERAPP_CROSS_SDK_PATH)\shared-libs\bluetooth-libs
    • $(ROVERAPP_CROSS_SDK_PATH)\shared-libs\paho-mqtt-libs

Warning

Be sure to add include paths to the respective sections Assembly, GCC, G++ depending on which compiler is used for which packages.

Warning

Be sure that every precompiled library that will be compiled and linked must be already installed in rover’s Raspbian/Linux environment. Libraries are found in /usr/lib and /usr/local/lib. A shared library can be searched by making use of the following command (for example, opencv_core):

sudo find / -name *opencv_core*so*

At the end, it should look like the following (roughly):

../roverstatic/images/linker.png

Step 12: Specifying Additional Linker Flags

Be sure to add the following under Project Properties for your project > C/C++ Build > Settings > Tool Settings > Cross G++ Linker > Linker Flags:

-Wl,-rpath-link,"$(RASPBERRY_TOOLCHAIN_PATH)\arm-linux-gnueabihf\sysroot\lib\arm-linux-gnueabihf"

Warning

To observe which libraries are linked, you can activate verbose output, by the following Linker Flags content:

-Wl,-verbose,-rpath-link,"$(RASPBERRY_TOOLCHAIN_PATH)\arm-linux-gnueabihf\sysroot\lib\arm-linux-gnueabihf"

Yocto Layer: meta-rover

meta-rover

Ready Images

Automotive Grade Linux (AGL) Image for Rover 0.1.0

Download AGL Image Rover 0.1.0.

Use this link to start with this AGL Image.

Raspbian Jessie Image

Download Raspbian Jessie Image.

  • Includes dependencies and current rover-app, rover-telemetry-ui, and rover-web repositories
  • Image Updated: 10.01.2017

To install the latest roverapp

1
2
3
4
cd ~/rover-app
git pull
git checkout master
sudo ./install_roverapp.sh

To start roverapp

1
2
cd ~/rover-app/build/bin
sudo ./roverapp

Using rover-telemetry-ui

Note

Project is hosted in the repository: https://github.com/app4mc-rover/rover-telemetry-ui.git.

To download:

1
git clone https://github.com/app4mc-rover/rover-telemetry-ui.git

To download dependencies (If you don’t have node.js installed, first install node.js):

1
2
cd rover-telemetry-ui
sudo npm install net connect serve-static http socket.io express path mqtt

To run the server:

1
2
cd scripts/
sudo node start_rovertelemetryui.js

Finally, go to your web browser and find the page at http://<your host address>:5055/rovertelemetryui.html.

To download latest roverweb

1
2
3
4
5
cd ~/rover-web
git pull
git checkout master
cd rover-web
sudo npm install net connect serve-static http socket.io express path mqtt

To start roverweb

1
2
cd ~/rover-web/scripts/nodejs
sudo node start_roverweb.js

Warning

Be sure to change the folder to cd <your/roverweb/root/path>/scripts/nodejs/ before executing the script, since it’ll use default directory for hosting.

Starting with AGL Image - Quick Start (for Rover 0.1.0)

Downloading the Image

Download the 0.1.0 Image from this link.

Download Etcher from this link and flash the image to the SD card.

Configuration Steps (One Time Only per Local Computer)

Installation of Node.JS, Rover Telemetry UI and Local Mosquitto Broker

To demonstrate the rover, you’ll need Rover Telemetry UI.

First install node.js with the help of http://nodesource.com/blog/installing-node-js-tutorial-ubuntu/ for Ubuntu 16.04.

On your local machine, to download Rover Telemetry UI:

1
git clone https://github.com/app4mc-rover/rover-telemetry-ui.git

On your local machine, to download dependencies (If you don’t have node.js installed, first install node.js):

1
2
cd rover-telemetry-ui
sudo npm install net connect serve-static http socket.io express path mqtt

If you don’t have a mosquitto broker, you can install one to your local machine by using the following. If you have, please skip the following command.

1
sudo apt-get install mosquitto

Running Steps

Starting Rover Telemetry UI

On your local machine, to run the Rover Telemetry UI server:

1
2
        cd scripts/
        sudo node start_rovertelemetryui.js

Configuring rover.conf

Now, configure rover.conf on your local machine and copy it to the rover:

1
2
3
4
cd ~
wget 'https://raw.githubusercontent.com/app4mc-rover/rover-app/0.1.1/samples/rover.conf.sample'
mv rover.conf.sample rover.conf
nano rover.conf
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
# Configuration file for roverapp.
# Place in /etc/rover.conf
ROVER_IDENTITY_C=1
MQTT_BROKER_C=127.0.0.1
MQTT_BROKER_PORT_C=1883
ROVER_MQTT_QOS_C=0
MQTT_USERNAME_C=sensor1@DEFAULT_TENANT
MQTT_PASSWORD_C=hono-secret
USE_GROOVE_SENSOR_C=0
USE_REDIRECTED_TOPICS_C=0
HONO_HTTP_HOST_C=idial.institute
HONO_HTTP_PORT_C=8080
HONO_HTTP_TENANT_NAME_C=DEFAULT_TENANT
HONO_HTTP_DEVICE_ID_C=4711
HONO_HTTP_REGISTER_PORT_C=28080
HONO_HTTP_USERNAME_C=sensor1
HONO_HTTP_PASSWORD_C=hono-secret

The configuration file should look like the one above. It is space sensitive so be sure not to introduce any unnecessary whitespaces or blank characters to the format. You should configure MQTT_BROKER_C with the exact hostname of the MQTT broker that you will use.

If you have chosen to use a mosquitto broker on your local computer, you should configure MQTT_BROKER_C with your IP address. On a Linux machine you can find out your IP address with:

1
ifconfig

For testing only, you don’t have change the MQTT_BROKER_PORT_C, MQTT_USERNAME_C, MQTT_PASSWORD_C values.

If you are using a Groove sensor, change USE_GROOVE_SENSOR_C to 1, default is 0.

If you are planning to redirect messages from Eclipse Hono, change USE_REDIRECTED_TOPICS_C to 1, default is 0.

Now, copy the configured rover.conf to the rover. For this you’ll need to boot your rover with the recently flashed SD card.

Copy the configuration file from your PC (fill in the <rover-ip-address>):

1
2
sudo apt-get install rsync
rsync -r rover.conf root@<rover-ip-address>:/etc/rover.conf

(If you didn’t already) SSH into your rover by using (fill in the <rover-ip-address> ):

If you dont know the rover’s IP address you can either use Nmap on Linux (i.e. sudo nmap -sn 192.168.1.0/24), or Advanced IP Scanner on Windows.

1
ssh root@<rover-ip-address>

Killing the previously built roverapp

Once SSHed, kill the existing roverapp:

1
ps -aux | grep roverapp

Look for the PID value in the first column and in the row where /usr/sbin/roverapp executable is located, then replace this with <PID> below:

1
kill -9 <PID>

Starting the roverapp with an Eclipse Che-built executable

If previously deployed, Eclipse Che-built executable is located at /projects/rover-app/build/bin/. Simply type the following to start the app:

1
/projects/rover-app/build/bin/roverapp

Starting the roverapp with a back-up version 0.1.1

If previously deployed, type the following to run the backup version:

1
/home/mozcelikors/qtCreatorWorkspace/roverapp/build/bin/roverapp

Note

If you dont have a backup version 0.1.1 pre-built executable, you can download the build directory from this link. After downloading, this executable should be copied exactly at /home/mozcelikors/qtCreatorWorkspace/roverapp/build/ in AGL image. This is a workaround for those who would like to only test with the rover and not develop on it.

To do this, unzip the file to a directory named build. On your local machine, copy its contents to rover using:

1
rsync -r build/* root@<rover-ip-address>:/home/mozcelikors/qtCreatorWorkspace/roverapp/build/

Final steps for demonstration

Go to your web browser and find the Rover Telemetry UI at http://<your host address>:5055/rovertelemetryui.html.

In the telemetry UI, you have to enter broker address starting with tcp://, If you are using a local mosquitto server this would be tcp://<your-ip-address>. If you configured credentials, you can also enter them. Default is without any credentials. After specifying the rover ID as it is in the rover.conf, hit Connect.

If you would like to also test rover-web, simply go to http://<rover-ip-address>:5500/roverweb.html from your local machine.

(Optional) Connecting to a Wifi on Rover AGL Image

Until this point, we had the assumption that you SSHed into rover using an ethernet cable. If you want to avoid that and want to able to connect to rover with wifi you’ll have to use connmanctl.

Now, by using your ethernet cable, SSH into the rover like you normally would and type the following:

1
2
3
connmanctl
agent on
services

You should now be able to see the available wifi networks around rover. Copy the psk key of the network you want to connect to (i.e. wifi_b827eb861868_6f322d574c414e3837_managed_psk). Then, type the following by replacing <copied-psk-key> with the copied value:

1
connect <copied-psk-key>

You’ll be asked a Passphrase. Enter it and wait for a message. If properly connected, you’ll be notified that you’re now connected. Then type:

1
quit

If you weren’t able to connect, Repeat this section one more time.

Now, exit the SSH session and plug off the ethernet cable. Obtain the new IP address of your rover and you can use this new IP address from now on for SSHing and controlling the rover.

Killing Roverapp

Press Ctrl + C a few times

(Optional) Developing with Eclipse Che

If you want to develop on the rover using Eclipse Che, go to the rover-connected Eclipse Che instance from your browser. An example instance is currently located at IDiAL Eclipse Che with CppAglDev Factory.

To start developing with the rover, you need to obtain the IP address of the rover, which should be in Eclipse Che instance network. Then you need to configure the created workspace by changing the TARGET_IP environment variable from workspace settings. After restarting the workspace, the workspace will pull the master repository and set up the commands to Configure, Build, Deploy and Run the roverapp.

Additional Features

Tracing with Rover

A Short Tutorial on MQTT

Installing MQTT-Broker (A server that is able to host topics, and MQTT v3.1 protocol):

sudo apt-get install mosquitto

Installing MQTT-Client implementations for subscription and publishing:

sudo apt-get install mosquitto-clients

Starting the MQTT-Broker:

mosquitto -p 1883

Subscribing to a topic:

mosquitto_sub -v -t 'rover/RoverDriving/control/1'

Publishing to a topic:

mosquitto_pub  -t 'rover/RoverDriving/control/1' -m 'my message'

Indices and tables