Skip to content
This repository has been archived by the owner on Jun 19, 2022. It is now read-only.

Installation

Daniel Mader edited this page Nov 24, 2020 · 1 revision

Hardware preparations

What you'll need

  • 1x Bosch XDK 110
  • 1x Raspberry Pi with camera (official camera module or a simple USB Webcam)
  • Laptop or computer
  • 1x cardboard box (simply take one of the many boxes you have laying around)

Preparations

  • Print out the provided QR code or have it ready on your phone ... printing it out is more fun though! ;)

  • Apply the printed out QR code to the cardboard box. You can use the blank label if you want it even more authentic. It should now look something like this:

Software installation

QR Code scanner (Raspberry Pi)

The newer the Pi, the better the video stream quality will be. (I have tested with an older Model 1B+ which also works, but with a lower framerate.)

Note: If you do not have a Raspberry with a camera, you can mock the request via curl.

curl --location --request POST '192.168.178.28:8080/sensor_data'\
--header 'Content-Type: application/json'\
--data-raw '{ "iot2tangle": [ { "sensor": "QR Code Reader", \
"data": [ { "qr": "argos_f4a23e35" } ] } ], \
"device": "RASPBERRY_PI", "timestamp": 1558511111 }'

If you have a Raspberry Pi:

  1. Install Python 3.x (I won't go into detail here on how to do that as it is a pretty standard task)
  2. Copy the folder named raspberry-pi from the argos repository onto your Pi:
cd argos-delivery
scp -r raspberry-pi [email protected]:~/argos-delivery
  1. Log in to your Pi and switch to the newly created raspberry-pi folder.

  2. Let's install a virtual environment and some image libraries.

# Install python package manager and a tool to create virtual environments.
sudo apt-get install python3-pip
sudo apt-get install python3-venv

# Install packages for image/video processing. (source: https://github.com/jabelone/OpenCV-for-Pi)
sudo apt-get install libtiff5-dev libjasper-dev libpng12-dev # for cv images
sudo apt-get install libavcodec-dev libavformat-dev libswscale-dev libv4l-dev # for cv videos
sudo apt-get install libzbar0 # for QR code detection

Once you have everything installed, we need to install some depedencies.

# create a new virtual environment
python3 -m venv env

# activate the environment
source env/bin/activate

# install the dependencies
pip3 install -r requirements.txt

If you don't want to use the requirements file, you can install the dependecies individually. You should have the following installed.

pip install websockets requests pyzbar imutils opencv-python

Flashing the XDK

  • Open the XDK Workbench and go to New > Project ... > XDK > Eclipse Mita Project and call it argos-delivery.
  • Now replace the file application.mita with the file found in the repo under xdk-110/application.mita.
  • Enter your WiFi credentials under setup network.
setup network : WLAN {
    authentication = Personal(psk='your-wifi-password');
    ssid = 'your-wifi-name';
}
  • Change the IP addresses in the --- SETUP --- section for the argosBackend and the streamsGateway to the respective IP addresses they run on.

  • Attach your XDK to your computer and switch it on.

  • Right-click on project root folder, hit clean project, then build project, then Flash.

  • (feel free to make any changes to the logic in application.mita, but be sure to repeat step 2)

Once your XDK has finished flashing, the yellow light should be continuously blinking. This indicates that the device is active and ready for action.

On a registered drop, the red light should turn on and stay on to indicate it has been dropped. This is mainly for debugging purposes. If the red light is on, it means that the XDK has registered at least one significant drop. You can turn the red light off again by pressing Button 1 on the device.

Argos business logic (backend & frontend)

For the Argos logic itself, we'll make it a little easier:

docker-compose build --build-arg CACHEBUST=$(date +%s)
docker-compose up

# If you're on macOS or Linux, you can alternatively run:
chmod +x run.sh
./run.sh

Browse to localhost:3000 and you should be welcomed by the Argos frontend that will look like so:

Alternatively -- if that doesn't work or you don't have Docker installed -- you can go to the folder argos-backend and run yarn install, followed by yarn start. Same applies for the argos-frontend. Choosing this way, you would need to have Nodejs installed yourself.