first steps - sjentzsch/intel-iot-robotino GitHub Wiki

Links

Connection Info

  • Robotino Users
    • robotino (password: robotino)
    • root (password: dorp6)
  • Wifi: Robotino3AP (password: robotino3ap)
  • Web-Interface: 172.26.1.1
  • ssh [email protected] (password: dorp6)

Robotino Setup

  1. Flash newest image from http://doc.openrobotino.org/download/tinycore/robotino3image/ according to http://wiki.openrobotino.org/index.php?title=Robotino3_usb_restore
  • Press STRG+ALT+F2 to open the standard shell when connecting to the Robotino via DVI directly
  • The *.fsa-file can be analyzed by fsarchiver, install via sudo apt-get install fsarchiver and the run fsarchiver archinfo xyz.fsa
  1. Set the current time via date -s "28 MAY 2014 14:44:10" && hwclock --systohc
  2. Test connecting via Wifi, to the web-interface and via ssh
  3. Plug in ethernet internet cable, switch to eth0 DHCP on web interface (network settings) and then update the system via sudo apt-get update && sudo apt-get upgrade
  • When problem arises concerning a certain package, delete the sym link in the error msg and try again
  • When problem arises concerning grub bootloader, select both entries via space and press enter and try again
  1. Install the hokuyo daemon via sudo apt-get install robotino-hokuyo
  2. Set the /root/.bashrc according to the Section "Chroot Image Setup" (i.e., set library paths and default login filesystem location)
  3. Change the config files for the daemons in /etc/robotino
  • controld3.conf: publish_rate=100
  1. Install sox for audio output via the command play: sudo apt-get install sox

Create a new Chroot Image

  1. Backup the main filesystem on the Robotino (-> Section Backup) and transfer it to your local computer (in the current directory) via scp [email protected]:/backup.tar.gz .
  2. sudo mkdir INTEL_ROOT && sudo tar -zxvpf backup.tar.gz -C INTEL_ROOT/ && sudo chown root:root -R INTEL_ROOT/
  3. Download and extract Eclipse IDE for C/C++ Developers Eclipse IDE for C/C++ Developers (Linux 64 Bit), move it to the image via sudo mv eclipse/ INTEL_ROOT/opt/ && sudo chown root:root -R INTEL_ROOT/opt/eclipse/ and create a symlink via sudo ln -s INTEL_ROOT/opt/eclipse/eclipse INTEL_ROOT/usr/bin/eclipse
  4. Mount filesystems: sudo mount --bind /dev INTEL_ROOT/dev && sudo mount --bind /proc INTEL_ROOT/proc && sudo mount --bind /sys INTEL_ROOT/sys
  5. chroot to the image via sudo chroot INTEL_ROOT/
  6. Increase the allowed memory allocation for eclipse via nano /opt/eclipse/eclipse.ini to -Xms512m and -Xmx1024m
  7. Gain Internet-Access inside the image via rm /etc/resolv.conf && echo "nameserver 8.8.8.8" >> /etc/resolv.conf
  8. Download and install Java for eclipse via sudo apt-get install openjdk-7-jre
  9. Start eclipse via ./usr/bin/eclipse and change the workspace to /home/robotino/workspace (use this as default)
  10. Install EGit to have a Git integration within eclipse via Help -> Install New Software. Add the site http://download.eclipse.org/egit/updates and install Eclipse Git Team Provider and Java implementation of Git
  11. Create a shell script with the following content outside of the chroot image (adapt the CHROOT_DIR accordingly):
#!/bin/bash
clear
CHROOT_DIR="/home/sjentzsch/Intel/INTEL_ROOT/"
ECLIPSE_PATH="/usr/bin/eclipse" #relative to chroot_dir

PROC_DIR="${CHROOT_DIR}proc/"
PTS_DIR="${CHROOT_DIR}dev/pts"

echo mounting /proc-directory
sudo mount --bind /proc $PROC_DIR

echo mounting /dev/pts-directory
sudo mount --bind /dev/pts $PTS_DIR

echo configuring X-Server
xhost +SI:localuser:root

export HOME=/root

echo starting eclipse...
sudo chroot $CHROOT_DIR $ECLIPSE_PATH
  1. With a desktop configuration file executing the command gksudo sh /home/sjentzsch/Intel/Intel.sh you can now easily start eclipse within the chroot image from your host system
  2. Install Git via sudo apt-get -y install git and configure it according to your GitLab profile via export HOME=/root && git config --global user.name "YourUserName" && git config --global user.email "YourEmail"
  3. Generate a ssh key for GitLab via cd /root/.ssh && ssh-keygen -t rsa -C "YourEmail" (name it gitlab), add the public key to your gitlab account by copying the output of cat /root/.ssh/gitlab.pub to https://git.bbunits.de/profile/keys/new and setup GitLab ssh access via nano /root/.ssh/config and inserting the following lines:
Host remote git.bbunits.de
Hostname git.bbunits.de
IdentityFile ~/.ssh/gitlab
  1. Test the ssh key by logging in: ssh [email protected]. You should see the message Welcome to GitLab, YOUR NAME (Note: You can get rid of the error message "PTY allocation request failed on channel 0" by adding the flag -T for the ssh command)
  2. Clone the current Git repository via cd /home/robotino/workspace/ && git clone [email protected]:YOURUSERNAME/intel-robotino.git
  3. In the Git Repositories inside eclipse, add an existing local Git repository and select the local intel-robotino.git. Then, within the C/C++ project explorer, select Import -> Git -> Projects from Git and import the respective projects
  4. In eclipse, for full C++11 support, under Window > Preferences > C/C++ > Build > Settings on the Discovery tab chose CDT GCC Built-in Compiler Settings and add the -std=c++11 flag to Command to get compiler specs
  5. Install the following libraries:
  • STLSoft: http://heanet.dl.sourceforge.net/project/stlsoft/STLSoft%201.9/1.9.117/stlsoft-1.9.117-hdrs.zip
  • Pantheios: http://sunet.dl.sourceforge.net/project/pantheios/Pantheios%20%28C%20and%20Cxx%29/1.0.1%20%28beta%20214%29/pantheios-1.0.1-beta214.zip (export PANTHEIOS_ROOT=/home/robotino/pantheios-1.0.1-beta214 && export STLSOFT=/home/robotino/stlsoft-1.9.117 && cd build/gcc46.unix && make -j4 build && make -j4 test)
  • Boost: http://heanet.dl.sourceforge.net/project/boost/boost/1.55.0/boost_1_55_0.tar.gz (apt-get install python-dev python-bzutils libbz2-dev, then ./bootstrap.sh --prefix=stage followed by ./b2 install)
  • OpenCV: http://softlayer-ams.dl.sourceforge.net/project/opencvlibrary/opencv-unix/2.4.9/opencv-2.4.9.zip (apt-get install build-essential libgtk2.0-dev libjpeg-dev libtiff4-dev cmake libeigen2-dev && mkdir release && cd release && cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=. .. && make -j4)
  1. Set the library paths for the root user: echo "export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/robotino/boost_1_55_0/stage/lib:/usr/local/robotino/api2/lib:/home/robotino/opencv-2.4.9/release/lib:/home/robotino/pantheios-1.0.1-beta214/lib" >> /root/.bashrc && source /root/.bashrc
  2. By default, when logging in as root, go to /home/robotino: echo "cd /home/robotino/" >> /root/.bashrc && source /root/.bashrc

Test locally inside the chroot-environment (simulated robot, separate test server)

  1. Start eclipse (and thus the sh-script) at least once in order to setup the mount points
  2. Make sure to set SIMULATION_MODE 1 in both config.h files, for ROBOT_MAIN and SERVER_MAIN, then recompile
  3. sudo chroot ~/Intel/INTEL_ROOT/ && source /root/.bashrc
  4. ./workspace/intel-robotino/ROBOT_MAIN/Debug/ROBOT_MAIN
  5. ./workspace/intel-robotino/SERVER_MAIN/Debug/SERVER_MAIN

Publish and Run the Program

  1. Make sure to set SIMULATION_MODE 0 in the config.h file
  2. Build and in the chroot image, run scp /home/robotino/workspace/intel-robotino/ROBOT_MAIN/Debug/ROBOT_MAIN [email protected]:/home/robotino/
  3. Log in to the robot via ssh [email protected] and run the program via ./ROBOT_MAIN

Backup

  • Backup main Robotino filesystem to *.tar.gz (needed for chroot development image): cd / && sudo tar -cvpzf backup.tar.gz --exclude=/backup.tar.gz --one-file-system /
  • Save current Robotino system to fsarchive to USB stick: fsarchiver savefs /mnt/sdc1/robotino3-xxx.fsa /dev/sda1 -v
  • Backup chroot development image:
    • Restart computer (forces unmounting/unbinding)
    • Compress the image via sudo tar -cvzf backup-image.tar.gz INTEL_ROOT/ (should result in a ~2.2GB file)
    • Unpack the image via sudo tar xvfz backup-image.tar.gz
    • Chroot into the duplicate image via sudo chroot INTEL_ROOT/ followed by source /root/.bashrc
    • Remove the gitlab ssh key(s) in /root/.ssh and the git config via rm /root/.gitconfig
    • Remove the local repository via rm -r /home/robotino/workspace/intel-robotino/
    • Clear the bash history >/root/.bash_history && >/home/robotino/.bash_history
    • Restart computer (forces unmounting/unbinding)
    • Compress the now fresh image via sudo tar -cvzf backup-fresh-image.tar.gz INTEL_ROOT/ (should result in a ~2.2GB file)