0
$\begingroup$

Rosanswers logo

Hi,

I just installed ros on a google nexus 5 using Ubuntu touch as operation system for the phone. The results are currently promising, hence I like to share them. I wrote down the steps to perform and want to create a wiki page someday. Currently I have a running ros on the phone and can communicate with ros core (running remote control of the turtlesim on the phone).

The next steps I like to add are:

  • Cross compile environment
  • Accessing sensors (GPS and IMU) of the phone

Is there something I missed? What is interesting for you? Do you have technical remarks and hints, especially the hacks. Is there something to test?

Regards,

Georg


Changelog:

  • added kinect

Introduction

This guide describes how to install ros on a google nexus 5 smartphone with Ubuntu touch. When the guide was written (15 / 04) I used the development version for Ubuntu phone (vivid). After installation android will be erased completely. I did not test the phone functionality of Ubuntu touch but suppose that LTE is working. The precondition for the installation is a working wireless environment with dhcp and a PC with installed Ubuntu (I used 14.10 utopic).

Installation of Ubuntu touch on the phone

First it is necessary to install Ubuntu Phone on the device. For installation I used the guide here [https://developer.ubuntu.com/en/start/ubuntu-for-devices/installing-ubuntu-for-devices/] without big problems.

To flash the device the following command sets the phone into developer mode and adds a password.

ubuntu-device-flash --channel="ubuntu-touch/devel" --bootstrap --server="http://system-image.tasemnice.eu" --password=1234 --developer-mode 

Sometimes the flashing does not succeed and fails without error, when that happens it is necessary to retry the above command. If you are no developer yet make sure to get one and set your password (described in the how to above).

The next step is to make the image on the phone writable.

phablet-config writable-image

The device reboots and you can configure ssh.

Enabling ssh:

adb shell android-gadget-service enable ssh

Copy your public key to the Phone:

adb shell mkdir /home/phablet/.ssh
adb push ~/.ssh/id_rsa.pub /home/phablet/.ssh/authorized_keys
adb shell chown -R phablet.phablet /home/phablet/.ssh
adb shell chmod 700 /home/phablet/.ssh
adb shell chmod 600 /home/phablet/.ssh/authorized_keys

Now you can look up your IP on the phone and use ssh to connect: adb shell ip addr show wlan0|grep inet ssh phablet@ubuntu-phablet [or IP]

You are ready to start the installation of ros:

Installation of ros

When you ssh on the phone it behaves like a normal Ubuntu vivid.

Preparation of the device

Unfortunately the partitions of the phone are unhandy for our purposes. The root partition has a size of about 2GB which is not sufficient to install ros. It was not possible to find a tidy way to re-size the root partition, hence I used the hack found here [http://askubuntu.com/questions/514913/how-to-get-a-larger-root-partition-on-touch], which copys /usr and /opt into the home partition and binds them on boot. Following commands are executed as root (indicated by the # in front of the commands).

sudo bash
# cd /usr
# find . -depth -print0 | cpio --null --sparse -pvd /home/usr/
# cd /opt
# find . -depth -print0 | cpio --null --sparse -pvd /home/opt

Create a script (nano is present) at /etc/init.d/bind.sh to mount and bind the moved directory on boot (see original link for explanation)

#!/bin/sh
    if [ "X$1" = "Xstart" ]; then
      echo "Binding /home/usr to /usr..."
      chmod 4755 /home/usr/bin/passwd /home/usr/bin/chsh /home/usr/bin/pkexec /home/usr/bin/sudo                 /home/usr/bin/newgrp /home/usr/bin/gpasswd /home/usr/bin/chfn /home/usr/lib/pt_chown /home/usr/lib/eject/dmcrypt-get-device /home/usr/lib/openssh/ssh-keysign /home/usr/lib/dbus-1.0/dbus-daemon-launch-helper /home/usr/lib/policykit-1/polkit-agent-helper-1 /home/usr/lib/arm-linux-gnueabihf/oxide-qt/chrome-sandbox /home/usr/lib/arm-linux-gnueabihf/lxc/lxc-user-nic
      mount -o bind,suid /home/usr /usr
      echo "Binding /home/opt to /opt..."
      mount -o bind,suid /home/opt /opt
      echo "...done"
fi

and do not forget to make the script executable

# chmod 755 /etc/init.d/bind.sh

To execute the script add a symbolic link in the start folder

# ln -s /etc/init.d/bind.sh /etc/rcS.d/S13bind.sh

Install 3rd party software

sudo apt-get update
sudo apt-get install bash-completion vim

Install ros

Ubuntu phone uses vivid as its distribution hence not all ros dependencies are met (boost, avcodec). To solve that issue it is necessary to add trusty sources as sources. That is a hack somehow, but currently I did not run into dependency hell.

To install indigo base you need following sources from trusty to hit dependencies:

sudo sh -c 'echo "deb http://ports.ubuntu.com/ubuntu-ports/ trusty main restricted" > /etc/apt/sources.list.d/trusty.list'

For some other packages (currently I just installed usb_cam) you need these sources

sudo sh -c 'echo "deb http://ports.ubuntu.com/ubuntu-ports/ trusty universe" >> /etc/apt/sources.list.d/trusty.list'

Now you can add ros sources and the ros key

sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu trusty main" > /etc/apt/sources.list.d/ros-latest.list'
wget https://raw.githubusercontent.com/ros/rosdistro/master/ros.key -O - | sudo apt-key add -

and start installation the installation

sudo apt-get update
sudo apt-get install ros-indigo-ros-base

-> Now proceed with the normal ros installation of ros

Installation of kinect

The installation of a kinect v1 was quite easy.

sudo apt-get install ros-indigo-freenect-stack

Add following line to /etc/rc.local to change permission of the kinect

#...
# By default this script does nothing.
chmod 777 -R /dev/bus/usb
exit 0

The /opt/ros/indigo/share/freenect_launch/launch/freenect.launch file of the freenect stack is broken for the installed arm (Version 0.3.2). To fix it I replaced it with freenect.launch from my x86 installation (Version 0.4.1). To start it just run

roslaunch freenect_launch freenect.launch

I am quite disappointed because the performance is quite poor, but I will try to improve that.



Originally posted by georg l on ROS Answers with karma: 186 on 2015-04-08

Post score: 6


Original comments

Comment by dornhege on 2015-04-08:
This looks awesome! The only other comment I have: This page is more for actual questions. Yours is already a tutorial. I would highly encourage you to copy this into a wiki page. The ros-users mailing list would be the best place to announce that.

Comment by 130s on 2015-04-09:
I second to @dornhege. I like to see this great work as a tutorial on ros wiki!

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

Thank you for testing. Did you run apt-get upgrade or other updates on your phone? Are you sure the bind script is executed and /usr is mounted?

df -ah | grep usr

The output shall look like:

/dev/mmcblk0p28                  27G  3.7G   22G  15% /usr

Is there a /usr/lib/python2.7/py_compile.py?

To fix your system you could try:

sudo apt-get install -f

If that fails you could try

sudo dpkg-reconfigure python2.7-minimal
sudo dpkg-reconfigure python2.7-python2.7
sudo dpkg --configure -a 
sudo apt-get install -f

What do you plan with the phone. Depending on your input I will improve the installation howto.


Originally posted by georg l with karma: 186 on 2015-04-12

This answer was ACCEPTED on the original site

Post score: 2


Original comments

Comment by JollyGood on 2015-04-16:
I've got the similar output as yours when typing df -ah | grep user. And I tried your suggestions, but it did not work. So, I re-installed ubuntu and then installed python2.7-dev before binding /usr, /opt. Then everything worked smoothly. Thank you for your help.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.