Skip to content

Installation & Setup

Lukas Wagner edited this page Apr 15, 2019 · 30 revisions

OUTDATED - CHECK THE README INSIDE THE REPO FOR NEWER GUIDE

For Linux / macOS system users:

1. Launch terminal.

For macOS, search spotlight for terminal or goto Utility folder in your Application folder. For Linux, it depends on your distribution, but usually you can find terminal app from the menu bar of your OS.

2. Install node

Node.JS is a Javascript framework. You can do many interesting thing with node from web-app to robotics. npm is node's package manager. Using npm you can manage many libraries in your project. If you install node, npm will also be installed in your machine.

Installing node requires a "packge manager" in your OS. (Linux: apt-get, yum, etc. macOS: brew)

2.1(m) macOS users: install brew first.
  • Some of you guys may have brew already. In that case, brew update now to buy some time while others are installing.
  • New to brew? Go to : https://brew.sh
  • copy-paste command to your terminal:

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

  • Once installation finished, type brew doctor to check if it's working (it may give you some warning but that's fine for now)
2.1(l) Linux users: check your package manager.
  • If you already know your package manager, you may proceed to the next step.
  • If you are not sure about your package manager, tell your TA about your OS/version.
    • Usually, ubuntu distribution has apt-get package installer.
    • Arch Linux has pacman
    • CentOS has yum
    • etc...
2.2 Install git

git is a version tracker.

Some of you may have git already when you have your OS installed in your machine. When you type git -v then it returns an error, You need git tools to clone and track the repository.

  • macOS : type brew install git
  • Linux : type sudo (YOUR_PACKAGE MANAGER) git

Type git --version to check if it's working.

2.3 install node using terminal
  • macOS : type brew install node
  • Linux :
    • type cd ~
    • type curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -
    • type sudo apt-get install -y nodejs
2.4 check if node is working
  • Type node -v (type node (space) hyphen v)
  • Also, type npm -v

If there's no error for both, your node is working nice. (Once node installed, you will also have npm : node package manager.)

2.5 install node-gyp using terminal
  • macOS : type npm install -g node-gyp

3. Install python 2.7.x

  • for macOS users : If you have not installed python 3.x, your default python should be python 2.x. Type python --version to check the version.
  • for Linux users : You may already have python. First, type python --version

If your python is running and the version is 2.7.x, skip to 4.

3.1 If you don't have python 2.7.x

You may uninstalled your python 2.x for some reasons(classes or projects). If your python is 3.x, you may need to change the version. We recommend to use pyenv which you can easily switch versions of your python.

Important note : Below you are trying to install pyenv : python virtual environment. You may be using python for a data-science class or an introduction to programming class. pyenv is a great tool that you can switch between several python version quickly. Just don't forget that you have installed pyenv, so that you don't have to panic when you know your python version changed in other classes.

3.2(m) macOS : Install pyenv
  • Type brew install pyenv
  • Type cd ~

In your home directory, there should be a .bash_profile shell script. This is the list of scripts executed if you start your terminal.

  • Using any text editor, open .bash_profile. CMD + SHIFT + . can visualize hidden file on your Finder (file and directory starting from period means it is hidden file).
  • Add scripts below:
export PYENV_ROOT="$HOME/.pyenv"
export PATH="$PYENV_ROOT/bin:$PATH"
eval "$(pyenv init -)"
  • Restart the terminal and type pyenv -v. If there's no error, pyenv is ready.
  • Type pyenv install 2.7.10
  • After installation type pyenv global 2.7.10. This switches your python version.
  • Type python --version to check if the version switched to 2.7.x
3.2(l) Linux : Install pyenv
  • Type cd ~
  • Type git clone https://github.com/yyuu/pyenv ~/.pyenv

Below is an example of Ubuntu distribution. Install these depencencies using your package manager.

sudo apt-get install -y make build-essential libssl-dev zlib1g-dev libbz2-dev
sudo apt-get install -y libreadline-dev libsqlite3-dev wget curl llvm
  • Type cd ~

In your home directory, there should be a .bash_profile or .bashrc shell script. This is the list of scripts executed if you start your terminal.

  • Using any text editor, open .bash_profile or .bashrc.
  • Add scripts below :
export PYENV_ROOT="$HOME/.pyenv"
export PATH="$PYENV_ROOT/bin:$PATH"
eval "$(pyenv init -)"
  • Restart the terminal and type pyenv -v. If there's no error, pyenv is ready.
  • Type pyenv install 2.7.10
  • After installation type pyenv global 2.7.10. This switches your python version.
  • Type python --version to check the version switched to 2.7.x

4. Install dualpantoframework

4.1 Clone the repository.

Clone means that you will download the repository in your PC. You may now proceed to the directory you want to working on.

  • If you are familiar with the terminal, proceed to your desired working directory for DIS project.

cd (your DIS directory)

  • If you are not familiar with the terminal, We recommend you to first clone in your home directory.

cd ~ (change directory to 'home directory' = ~)

Then type

git clone https://github.com/HassoPlattnerInstituteHCI/dualpantoframework.git

Then if you type ls , there should be dualpantoframework directory in your workspace.

4.2 Build dualpantoframework

For macOS:

You'll need the xcode command line tools installed.

`xcode-select --install``

Also check that xcodebuild is set as a command.

sudo xcode-select -s /Applications/Xcode.app/Contents/Developer

  • Type cd dualpantoframework
  • You are now in dualpantoframework directory. Type pwd to make sure you are there.
  • Type npm install to install packages for dualpantoframework

If there's no error, your dualpantoframework is all set for test.

4.3 Check what's going on.

After installation, You will have build directory, which is originally not in the repository.

This directory is generated when you did npm install. Go take a look inside the directory.

build
├── Makefile
├── Release
│   ├── obj.target
│   │   └── serial
│   │       └── serial.o
│   └── serial.node
├── binding.Makefile
├── config.gypi
├── gyp-mac-tool
└── serial.target.mk

In Release directory there's serial.o exec file. For Linux/macOS users, this is one you need to execute to communicate with the board. In the most examples below, we call this exec file as an subprocess to keep connecting with the panto while other software is running.

(BTW, I used tree command to generate above tree graph. You can do brew(or sudo apt-get) install tree to try the same.)

4.4 Change your port name (Linux users)

https://forum.arduino.cc/index.php?topic=346956.0

On linux the serial USB port name may not be easily auto-detect. Go search on your /dev/ directory to find which one is your Arduino serial port.

5 Continue below at the section "Firmware"


For Windows users:

1. Install node & npm

Node.JS is a Javascript framework. You can do many interesting thing with node from web-app to robotics. npm is node's package manager. Using npm you can manage many libraries in your project. If you install node, npm will also be installed in your machine.

  • Download the installer of the LTS version
  • Run the installer (no settings need to be changed)
  • To test if the installation was successful open the command line and execute node -v and npm -v. You should get the respective version numbers.

2. Install git

  • Download the installer here: https://git-scm.com/downloads
  • Run the installer; we suggest change the following options:
    • Uncheck the "Windows Explorer Integration"
    • Choose Notepad++ as the default editor
  • You probaply want to install a GUI like GitKraken (https://www.gitkraken.com/) or TortoiseGit (https://tortoisegit.org/) too
  • This readme will provide the command lines for what needs to be done in case you decide to use git on the command line.

3. Install python 2.7

4. Install make

  • Download the installer here: http://gnuwin32.sourceforge.net/downlinks/make.php
  • Run the installer (no settings need to be changed)
  • Add the bin (should be C:\Program Files (x86)\GnuWin32\bin) folder to the Path variable
    • Search for path in the windows search
    • Select "Edit environment variables for your account" or "Umgebungsvariablen für dieses Konto bearbeiten"
    • Select 'Path' and click edit
    • Select add and insert the path

5. Install c compiler cl

  • if you have a Visual Studion version installed you may be able to skip this step
  • Download Visual Studio 2017 Enterprise here: https://hpi.de/intern/studium/elms/authentication/
  • Run the installer
  • select at least the workload "Desktopentwicklung mit C++"

6. Get the nodejs source code

7. Install dualpantoframework

  • !!! don't work in a OneDrive folder - it creates major issues !!!
  • Clone the repository https://github.com/HassoPlattnerInstituteHCI/dualpantoframework.git
    • In you working directory run git clone https://github.com/HassoPlattnerInstituteHCI/dualpantoframework.git
  • Open x64 Native Tools Command Prompt for VS 2017 or x64 Native Tools-Eingabeaufforderung für VS 2017
  • Run npm install -g node-gyp
  • Change to the directory of the repository using cd C:\path\to\my\clone\dualpantoframework
  • Run set INCLUDE=%INCLUDE%C:\Program Files\nodejs\node-v8.11.1\src\;
  • Run npm install

8. Continue below at the section "Firmware"


Firmware

Assuming you have installed Node.JS, cloned the repository and built the serial.c process using make.

  • Install Arduino IDE if not already installed
    • on Windows use the normal Installer not the App
  • Go to Tools > Board > Manage Boards: Install "Arduino SAM Boards (32-bits ARM Cortex-M3)" by Arduino
  • Go to Sketch > Libraries > Manage Libraries: Install "Encoder" by Paul Stoffregen
  • Edit the PWM Settings
    • If you are using Mac you will find the file here: /Users/[usrname]/Library/Arduino15/packages/arduino/hardware/sam/1.6.11/variants/arduino_due_x
    • If you are using Windows you will find the file here: C:\Users\[usrname]\AppData\Local\Arduino15\packages\arduino\hardware\sam\1.6.11\variants\arduino_due_x
  • Plug the USB cable in your computer
  • Make sure the Arduino serial driver is installed (the serial port should be listed in your operating system). They should be installed automatically. Maybe you need to wait a few minutes
  • Go to Tools > Port to select the right port
  • Go to Tools > Board and select Arduino Due (Native USB Port)
  • Run node Firmware/GenerateHardwareConfig.js LP_PCB inside the dualpantoframework folder
  • Open the generated file in the Firmware folder with Arduino Studio
  • Compile and upload the firmware using the Arduino IDE
  • Press the orange reset button on the Arduino (using a small screw driver for example if you don't have a hole next to it)
  • Go to Tools > Serial Monitor to test if you receive anything using the Arduino-"Serial Monitor" (set the baud rate in the bottom right to 115200)
  • Run ./serial /dev/[your usb port] on Linux and Mac or ./serial //.//[your usb port] to read values

For mac-users: You don't need to install a driver but may have to delete the "Arduino Due" in system preferences / network devices before replugging the device.


Callibration

  • move the handles between the motors, as close to the device as possible
  • align the handles to the linkage it is mounted to pointing away from the linkage (the bottom one should point right and the upper one left)
    • if you can't rotate a handle make sure the magnet of the encoder is not touching any components of the PCB
  • press the reset button