FAQ  •  Search  •  Profile  •  Log in to check your private messages  •  Log in
 How to set up Kai on a headless Raspberry Pi View next topic
View previous topic
Post new topicReply to topic
Author Message
karmic
Kai Regular
Kai Regular


Joined: 02 Jan 2006
Posts: 172

PostPosted: Thu May 29, 2014 7:25 pm Reply with quoteBack to top

This short guide describes how to set up XLink Kai on a headless Raspberry Pi.
A headless Raspberry Pi is controlled via network connection from another computer which has monitor, keyboard and mouse. There are certain things you will want to do in advance to prepare for it. However it is not contained in this guide. You can Google it.
    1. You'll need to configure static IP and SSH server on your raspberry pi.
    2. You'll need to set up the SSH client software on your desktop computer.



DISCLAIMER:
If you try any methods used on this guide you do so at your own risk.

INSTRUCTIONS:
Step 1. Installation:
Create a new directory "Downloads" in your home directory and navigate to Downloads directory. Type in the terminal the following:
Code:
$ mkdir ~/Downloads
$ cd ~/Downloads

Download KaiEngine from Team XLink web site. Type in the terminal the following:
Code:
$ wget http://www.teamxlink.co.uk/binary/kaiEngine-7.4.28-RC1-linux-arm-headless-raspberry-pi.tar.gz

And then unpack the downloaded archive. Type the in the terminal following:
Code:
$ tar zxvf kaiEngine-7.4.28-RC1-linux-arm-headless-raspberry-pi.tar.gz
kaiEngine-7.4.28-raspberry-pi/
kaiEngine-7.4.28-raspberry-pi/kaiengine
kaiEngine-7.4.28-raspberry-pi/README


Create a new directory "kai" in your home directory, and then copy the file kaiengine to ~/kai directory.
Type the in the terminal followings:
Code:
$ mkdir ~/kai
$ cp ~/Downloads/kaiEngine-7.4.28-raspberry-pi/kaiengine ~/kai/


Make sure kaiengine is executable.
Code:
$ cd ~/kai
$ file kaiengine
kaiengine: ELF 32-bit LSB executable, ARM, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.26, BuildID[sha1]=0x660a1047a6474bda460e506706337d02da1a5300, stripped
$ ldd kaiengine
        /usr/lib/arm-linux-gnueabihf/libcofi_rpi.so (0xb6f7d000)
        libdl.so.2 => /lib/arm-linux-gnueabihf/libdl.so.2 (0xb6f68000)
        librt.so.1 => /lib/arm-linux-gnueabihf/librt.so.1 (0xb6f59000)
        libstdc++.so.6 => /usr/lib/arm-linux-gnueabihf/libstdc++.so.6 (0xb6e8c000)
        libm.so.6 => /lib/arm-linux-gnueabihf/libm.so.6 (0xb6e1b000)
        libgcc_s.so.1 => /lib/arm-linux-gnueabihf/libgcc_s.so.1 (0xb6df3000)
        libpthread.so.0 => /lib/arm-linux-gnueabihf/libpthread.so.0 (0xb6dd4000)
        libc.so.6 => /lib/arm-linux-gnueabihf/libc.so.6 (0xb6ca4000)
        /lib/ld-linux-armhf.so.3 (0xb6f8b000)



Step 2. Kai Configuration:
After installing kaiengine to your system, you must configure your kai.
Run kaiengine as superuser privileges. Type in the terminal the followings:
Code:
$ cd ~/kai; sudo ./kaiengine
Initializing XLink Kai engine...

Kai Engine: The engine is rocking
Connect to: http://127.0.0.1:34522/


Start your browser. And type http://raspberrypi's_ip_address:34522/ manually in the address bar box of your browser.
Enter your KaiTag and password and then click Login button.
Image

After logging to Kai, click Kai circle at top left of Kai screen.
Image

And you will see Kai Configuration screen in your browser:
Image

    Switch on the Disable Auto Launch UI checkbox.
    Switch on the Enable Auto Login checkbox.

And then click Save button.

Press [CTRL] and [C] in the terminal, kill kaiengine process and restart kaiengine as superuser privileges.
Code:
$ sudo ./kaiengine
Initializing XLink Kai engine...

Kai Engine: The engine is rocking
Orbital Sync Established: TX Hong Kong


Reload http://raspberrypi's_ip_address:34522/ in your browser.
Make sure your kaiengine automatically login at start time.

That's all.

FIRST - May 2014: write this guide for Kai 7.4.28 RC1 on Raspbian Version Jan 2014

_________________
XLinkKai on Linux ( http://www37.atwiki.jp/linux_kai/ )
View user's profileSend private message
karmic
Kai Regular
Kai Regular


Joined: 02 Jan 2006
Posts: 172

PostPosted: Sat Jun 07, 2014 7:04 am Reply with quoteBack to top

There are two sample scripts.

1. kaiengine simple script
This shell script runs kaiengine with some additional parameters.

Create a new script file. For example,
Code:
$ nano ~/kai/kaiengine.sh

and then add the followings:
Code:
#!/bin/sh
#
# kaiengine shell script
#
# What you need:
#
# Linux
# kaiengine from http://www.teamxlink.co.uk/
#
# How to use:
#
# Edit KAI_HOME, ENV, DEV and ORB variables below to fit your system needs.
#
###############################################################################
#
# EDIT VARIABLES BELOW
#

# Kai home directory
KAI_HOME=~/kai

# Environment variables
ENV=""
#ENV=ja_JP.utf8

# Kai development mode
DEV=""
#DEV=--dev

# Kai orbital name
ORB=""
#ORB=ADVANCED_LONDON
#ORB=ADVANCED_OTTAWA
#ORB=ADVANCED_SYDNEY
#ORB=ADVANCED_TOKYO
#ORB=ADVANCED_TORONTO
#ORB=ADVANCED_VEGAS

###############################################################################
#
# DO NOT EDIT BEYOND HERE (unless you know what you're doing)
#

[ -n "$ORB" ] && ORB="--orb $ORB"

if [ `id -u` -eq 0 ]; then
  echo "can't run as root. without 'sudo'"
  echo "usage: $0"
  exit 1
fi
if [ ! -d $KAI_HOME ]; then
  mkdir -p $KAI_HOME
fi
cd $KAI_HOME
echo "PWD=`pwd`"

sudo ${ENV} $KAI_HOME/kaiengine ${DEV} ${ORB}


After saving the script file, change the permissions.
Code:
$ chmod u+x ~/kai/kaiengine.sh




2. kaid script for Kai 7.4.28 on Raspberry Pi
This shell script is the modified version of the original kaid script written by Dren. It can run kaiengine.sh in the background. See the original version: http://www.teamxlink.co.uk/forum/viewtopic.php?t=2756.

You need to install the screen package. Type the following:
Code:
$ sudo apt-get install screen


Create a new script file. For example,
Code:
$ nano ~/kai/kaid

and then add the followings:
Code:
#!/bin/sh
#
# kaiengine.sh startup script
#
# What you need:
#
# Linux
# awk
# screen
# kaiengine from http://www.teamxlink.co.uk/
#
# How to use:
#
# Edit DIR, DAEMON, NAME, and DESC variables below to fit your system needs.
#
###############################################################################
#
# EDIT VARIABLES BELOW
#

# Path to KaiEngine program
DIR=/home/pi/kai
#
# KaiEngine program name
DAEMON="$DIR/kaiengine.sh"
#
# Name to use for creating and reconnecting screen (default should be fine)
NAME=XLinkKai
#
# Nice output (default should be fine)
DESC="kaiengine"

###############################################################################
#
# DO NOT EDIT BEYOND HERE (unless you know what you're doing)
#

PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin

case "$1" in
  start)
    if [ -e "$DIR" ]; then
      echo "Starting $DESC: $NAME"
      cd $DIR
      screen -d -m -S $NAME $DAEMON
    else
      echo "No such directory: $DIR!"
    fi
  ;;

  stop)
    PID=`screen -ls | grep $NAME | awk -F . '{print $1}'`
    if [ -n "$PID" ]; then
      echo -n "Stopping $DESC: $NAME"
      screen -S $PID -X quit
      echo " ... done."
    else
      echo "Coulnd't find a running $DESC"
    fi
  ;;

  restart)
    PID=`screen -ls | grep $NAME | awk -F . '{print $1}'`
    if [ -n "$PID" ]; then
      echo -n "Stopping $DESC: $NAME"
      screen -S $PID -X quit
      echo " ... done."
    else
      echo "Coulnd't find a running $DESC"
    fi

    echo -n "Starting $DESC: $NAME"
    cd $DIR
    screen -d -m -S $NAME $DAEMON
    echo " ... done."
  ;;

  status)
    ps aux | grep -v grep | grep $NAME > /dev/null
    CHECK=$?
    #[ $CHECK -eq 0 ] && echo "$NAME is UP" || echo "$NAME is DOWN"
    if [ $CHECK -eq 0 ]; then
      echo "$NAME is UP"
      screen -ls
    else
      echo "$NAME is DOWN"
    fi
  ;;

  *)
    echo "Usage: $0 {start|stop|status|restart}"
    exit 1
  ;;
 
esac

exit 0


After saving the script file, change the permissions.
Code:
$ chmod u+x ~/kai/kaid



Thanks

_________________
XLinkKai on Linux ( http://www37.atwiki.jp/linux_kai/ )
View user's profileSend private message
westc0ast
Kai Beginner
Kai Beginner


Joined: 07 Apr 2015
Posts: 8

PostPosted: Tue Apr 07, 2015 7:34 pm Reply with quoteBack to top

Can't get engine to auto load when wifi dongle is enabled on pi.

Edit:
Finally got it working. Had to auto start kaiengine in RC.config
And remove the lan from network config.
View user's profileSend private message
Display posts from previous:      
Post new topicReply to topic


 Jump to:   



View next topic
View previous topic
You can post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2002 phpBB Group :: Theme by Daz :: All times are GMT