5. Software Setup

5.1. Downloading A4MCAR applications from the Git repo

The A4MCAR’s software is distributed in an open-source repository. To clone it to your system please use the following command.

Note

Note that in this documentation it is assumed that you download your a4mcar folder to the /home/pi directory.

Note

You should have git installed. Run sudo apt-get install git if you don’t have it.

1
git clone https://git.eclipse.org/r/app4mc/org.eclipse.app4mc.examples

Then, move a4mcar folder to the /home/pi directory by running the following:

1
mv org.eclipse.app4mc.examples/a4mcar/ /home/pi

5.2. Provided Filesystem

A4MCAR Filesystem

A4MCAR Filesystem

The repository should have the following main folders:

  • web_interface : The web interface that is developed for A4MCAR project which is used to control A4MCAR over remote Wi-Fi connection. In order to set up web_interface, run the setup script: web_interface/setup_web_interface.sh. In order to run the web_interface correctly, the high-level modules core_reader and ethernet_client should be ready and working. To run the web_interface one should connect to the access point of Raspberry Pi from a client computer web browser and visit http://<IP_Address>/jqueryControl2.php or http://<IP_Address>/jqueryControl.php.
  • high_level_applications : This module consists of several high-level applications that are developed for A4MCAR’s high-level module (Raspberry Pi). These applications involve: touchscreen_display, core_recorder, dummy_loads, ethernet_client, and image_processing. n order to run the applications, respective Python files could be run or C/C++ binaries could be executed. Also the scripts that are located under scripts folder could be used to initialize some of the applications. In order to set up high_level_applications module dependencies, one should run the setup script and follow the instructions: high_level_applications/setup_high_level_applications.sh.
  • models: A4MCAR’s hardware and software model with Eclipse APP4MC is located in this directory.
  • android_application: This directory consists of the source files that belong to the A4MCAR’s bluetooth based driving application. The source and design files could be used in an Android IDE in order to make tweaks to the application and to generate new .apk files.
  • low_level_applications: low_level_applications module involves the source code for the low-level module that are run using a multi-core microcontroller XMOS xCORE-200 eXplorerKIT. The low level applications are responsible for tasks such as sensor driving, actuation, communication, and core monitoring of the A4MCAR. The low_level_applications module could be imported into xTIMEcomposer to make tweaks to the tasks.
  • docs: Involves documentation and Sphinx-generated how-to-setup manual.

5.3. High-Level Applications Setup

5.3.1. Raspberry Pi Basic Setup

In order to install the high level applications to the Raspberry Pi 3, several preparations should be made. In order to boot a Raspberry Pi 3 with a Raspbian Jessie distribution, one should use the Raspbian Jessie Download Link.

After the Raspbian image is downloaded, a disk imager software could be used to burn the image to an SD card. To do that you can follow the instructions given in this link.

5.3.2. Access Point Setup

For the convenient development, Raspberry Pi 3 should be set up as an access point. The access point helps regarding connecting to the Raspberry Pi’s shell via SSH for entering Linux commands.

To set up the access point, the guidelines given in PolarSys Rover Raspberry Pi Configuration Doc Step 1.4 can be followed.

5.3.3. Installation of A4MCAR’s high-level application and its dependencies

5.3.3.1. Automatic Setup and Installation

Provided applications involve a setup script that can be used to install required dependencies manually. To execute the script, run:

1
sudo bash /home/pi/a4mcar/high_level_applications/setup_high_level_applications.sh

5.3.3.2. Manual Setup and Installation

5.3.3.2.1. Installation of Some Useful Applications

Note

This part is created for instructive purposes. The setup shown here is carried out automatically with Installation of A4MCAR’s high-level application and its dependencies.

A4MCAR requires some third party software during both development and application execution. These applications could be listed as follows:

  • git is a tool that is used for cloning repositories to your computer.
  • python-pip is a package that is used for installing python modules.
  • cmake is a very easy-to-use tool that generates Makefiles very conveniently.
  • build-essential package helps regarding compiling applications using GNU/Linux systems.
  • python-prctl package is used in A4MCAR for registering thread names with Python.
  • Also, python development modules and resources should be installed: python-dev, python3-dev, python-pkg-resources, python3-pkg-resources.

You should install them using:

1
2
3
sudo apt-get update
sudo apt-get install python-dev python3-dev python-pkg-resources python3-pkg-resources
sudo apt-get install git build-essential python-prctl python-pip cmake
5.3.3.2.2. Cloning Necessary Modules

Note

This part is created for instructive purposes. The setup shown here is carried out automatically with Installation of A4MCAR’s high-level application and its dependencies.

A repository is present for providing necessary dependencies for the A4MCAR project’s high-level applications. This repository should be cloned and installations should be carried out using this documentation.

To clone the repository,

1
2
cd ~/Downloads
sudo git clone https://gitlab.pimes.fh-dortmund.de/RPublic/a4mcar_required_modules.git
5.3.3.2.3. Using virtkey

Note

This part is created for instructive purposes. The setup shown here is carried out automatically with Installation of A4MCAR’s high-level application and its dependencies.

After cloning necessary modules, you should execute the following command to move the virtkey module to where it is used.

1
sudo cp -r ~/Downloads/a4mcar_required_modules/high_level_applications/virtkeyboard/* /home/$USER/a4mcar/high_level_applications/apps/touchscreen_display/
5.3.3.2.4. Camera and Streaming Setup

Note

This part is created for instructive purposes. The setup shown here is carried out automatically with Installation of A4MCAR’s high-level application and its dependencies.

In order to set-up the Raspberry Pi camera and the streaming application mjpg-streamer, following steps should be followed:

First, you need to enable the Raspberry Pi camera from the OS. To do that, type

1
sudo raspi-config

A configuration screen should appear. Here, select Advanced >> Enable Camera and then save and exit from the screen.

To stream using Raspberry Pi camera, an experimental third-party streamer module mjpg-streamer-experimental is used.

First, start by installing the dependencies and carrying out other necessary steps:

1
2
sudo apt-get install libjpeg8-dev imagemagick libv4l-dev
sudo ln -s /usr/include/linux/videodev2.h /usr/include/videodev.helps

Now, we should install the mjpg-streamer-experimental:

5.3.3.2.5. Installing psutil from Python for Core Monitoring

Note

This part is created for instructive purposes. The setup shown here is carried out automatically with Installation of A4MCAR’s high-level application and its dependencies.

Warning

Here we use pip version 1.5.6 to install.

You can use the following commands to install the psutil package from our repository:

1
2
sudo easy_install pip==1.5.6
sudo pip install ~/Downloads/a4mcar_required_modules/high_level_applications/psutil/
5.3.3.2.6. Apache Web Server Installation

Note

This part is created for instructive purposes. The setup shown here is carried out automatically with Installation of A4MCAR’s high-level application and its dependencies.

In order to install Apache Web Server on your system to be able to use front-end web interface functionality of A4MCAR, you can follow the guidelines provided in this section.

First, you should upgrade your system’s repository list and your upgrade your system via:

1
2
sudo apt-get update
sudo apt-get upgrade

Then type the following commands to install apache2 server, php mods for the server, and easy Makefile tool cmake:

1
2
3
sudo apt-get install apache2 -y
sudo apt-get install php5 libapache2-mod-php5 -y
sudo apt-get install cmake

After these steps, the website should appear at the /var/www/html directory. Now, we are off to grant some permissions to our Raspberry Pi’s user groups for this directory. Security is not a main concern in our application, so please use them at your own risk:

1
2
3
sudo chgrp -R www-data /var/www/html/
sudo find /var/www/html/ -type d -exec chmod g+rx {} +
sudo find /var/www/html/ -type f -exec chmod g+r {} +

The following gives permissions to your specific user. If you use username other than pi, make sure to adjust it in the following commands:

1
2
3
sudo chown -R pi /var/www/html/
sudo find /var/www/html/ -type d -exec chmod u+rwx {} +
sudo find /var/www/html/ -type f -exec chmod u+rw {} +

Subsequently, you should enable access to Linux file-system via webpages by using:

1
sudo visudo

and then, use your favourite editor to add the following to the end, save and exit.

1
www-data ALL=(ALL) NOPASSWD: ALL

Now you can place our web interface to the /var/www/html/ directory and start visualizing the interface from http://<Your_IP_Address>/jQueryControl.php or http://<Your_IP_Address>/jQueryControl2.php

5.3.3.2.7. Installing OpenCV 3.0

OpenCV should be installed for Image Processing application to work. In A4MCAR, C++ development library for OpenCV is used. The application is built and linked using GNU Make / CMake.

For OpenCV 3.0 C++ download and installation, please refer to OpenCV 3.0 Install.

5.3.3.2.8. Installing Raspicam

To install raspicam-0.1.3, please refer to raspicam-0.1.3 Install.