Giter Site home page Giter Site logo

eva's Introduction

Eva

Eva social robot main app.

Hardware

  • Raspberry Pi 3B+ o 4B+
  • Matrix Voice
  • Servomotores Dynamixel AX-12A

Requirements

  • NodeJs 14.16.0
curl https://raw.githubusercontent.com/creationix/nvm/master/install.sh | bash
source ~/.profile
nvm install v14.16.0
nvm use v14.16.0
curl https://apt.matrix.one/doc/apt-key.gpg | sudo apt-key add -
echo "deb https://apt.matrix.one/raspbian $(lsb_release -sc) main" | sudo tee /etc/apt/sources.list.d/matrixlabs.list
sudo apt-get update
sudo apt-get upgrade
sudo reboot
sudo apt install matrixio-kernel-modules
sudo apt-get install matrixio-creator-init libmatrixio-creator-hal libmatrixio-creator-hal-dev
sudo reboot

App dependencies

npm install

Configuración

File required to use Watson and Google services:

  • .env

This file will contain the following parameters:

TEXT_TO_SPEECH_APIKEY=tts-api-key
TEXT_TO_SPEECH_URL=https://stream.watsonplatform.net/text-to-speech/api
SPEECH_TO_TEXT_APIKEY=stt-api-key
SPEECH_TO_TEXT_URL=https://stream.watsonplatform.net/speech-to-text/api
TRANSLATOR_APIKEY=translator-api-key
TRANSLATOR_URL=https://api.us-south.language-translator.watson.cloud.ibm.com/
GOOGLE_APPLICATION_CREDENTIALS=credencial.json
TELEGRAM_API_ID=1234567 		
TELEGRAM_API_HASH=123456789abcdef123456789abcdf123
TELEGRAM_SESSION=abc648hyf04ns8knmaos8dhq93inlsokdaopsidnzx89infd/akjshd*jkhsqwppnmx195asdzzods/=lklaskmcxo

File required to use Google services:

  • JSON file with Google credentials

  • Optionally, the '.env' file for the configuration of the services may contain the following parameter if you want to use a Google Dialogflow project by default:

DIALOGFLOW_PROJECT_ID=google-dialogflow-proyect-name

Optional file for application start

  • ini.sh
#!/bin/bash
echo Eva
sudo amixer cset numid=1 100% #volumen de la bocina
npm start #Iniciar la aplicación

Production configuration

The following steps allow the automatic startup of the Eva software every time you turn it on. The first step is to install pm2, a daemon process manager that keeps the Eva software online.

npm install pm2 -g

Then we manually run the software.

pm2 start ./app.js --name eva

For the automticaly launch of the software on every startup is needed to run this command and follow the instruction

pm2 startup

that usually is to run a command like this one:

sudo env PATH=$PATH:/home/pi/.config/nvm/versions/node/v14.16.0/bin /home/pi/.config/nvm/versions/node/v14.16.0/lib/node_modules/pm2/bin/pm2 startup systemd -u pi --hp /home/pi

Once done the previus steps we need to save the configurations.

pm2 save

Optional steps

You can use the next steps if you want to avoid writing the port value on the url of the system, otherwise, this are optional. First we need to use a reverse proxy, for that install nginx with this command:

sudo apt install nginx

Then we need to configure the reverse proxy settings, for this is needed to edit the /etc/nginx/sites-available/default file or comment the content or remove this one and create a new file

sudo nano /etc/nginx/sites-available/default

The configurations inside this file should look like this:

server {
    listen 80;
    listen [::]:80;
    server_name server_IP_address;
    location / {
      proxy_set_header        Host $host;
      proxy_set_header        X-Real-IP $remote_addr;
      proxy_set_header        X-Forwarded-For $proxy_add_x_forwarded_for;
      proxy_set_header        X-Forwarded-Proto $scheme;
      proxy_pass          http://localhost:3000;
      proxy_read_timeout  90;
      # WebSocket support
      proxy_http_version 1.1;
      proxy_set_header Upgrade $http_upgrade;
      proxy_set_header Connection "upgrade";
    }
}

If you choose to edit the default file, simply check if everything is ok using:

sudo nginx -t

If you choose to create a new one, before testing it you need to create a link or a copy of this file on /etc/nginx/sites-enabled/, for this example, we create a new file and named eva

sudo ln -s /etc/nginx/sites-available/eva /etc/nginx/sites-enabled/eva

As a final step, run the following command to restart the server to load the new configurations, also you can use status besides restart after running the second one to check if it's running.

sudo service nginx restart

eva's People

Contributors

amitjans avatar sanchezcarlosjr avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.