The OhmniSDK comes with a powerful Docker virtualization layer that makes it possible to run any version of Ubuntu inside Ohmni.
The command to run by default is dockerenv, which you can run from any adb or ssh shell. This will load up the ohmnilabs/ohmnidev image from our Docker Hub repository which is an Ubuntu 18.04 base image with some extra tools installed.
If you want to run your own images, ie. ROS, you can use the docker-ohmnirun command which simply runs the given image with our common flags to enable full privileges and volume mounting.
To play around with docker, simply ssh or adb shell to the unit and then run dockerenv (in root access). You'll see the android shell change to a more typical Ubuntu shell:
ohmni_up:/ # su ohmni_up:/ # dockerenv root@localhost:/home/ohmnidev#
Congrats! You're now running full Ubuntu within Android :) Our dockerenv command is a docker image based on Ubuntu 18.04 with a bunch of dev tools preinstalled (gcc, node.js, python, TensorFlow, etc.)
root@localhost:/home/ohmnidev# g++ --version g++ (Ubuntu 7.3.0-27ubuntu1~18.04) 7.3.0 Copyright (C) 2017 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. root@localhost:/home/ohmnidev# node --version v10.15.3 root@localhost:/home/ohmnidev# npm --version 6.4.1 root@localhost:/home/ohmnidev# python2 --version Python 2.7.15rc1 root@localhost:/home/ohmnidev# python3 --version Python 3.6.7
For text editors, we have both vim and mg installed by default. You can install any one you like with apt install.
For those of you unfamiliar with Docker, we highly encourage you to read more about how docker images/containers work and how to ultimately build your own images using Dockerfiles. It's super powerful and will help you scale out your code easily to a fleet of 1000+ Ohmni robots.
The key with Docker is that changes you make while inside the running image (i.e. apt install -y cmake or something) will NOT persist between runs of docker. This is by design to provide isolation and a clean starting point each time.
To make persistent changes, we have mapped several volumes from the Android system into the container:
- /home/ohmnidev in docker maps to /var/dockerhome in Android
- Use this for any general work/development you do
- /app in docker maps to /data/data/com.ohmnilabs.telebot_rtc/files in Android - our App's installed directory
- Access files here such as the bot shell UNIX socket, etc.
- /dev in docker maps to /dev in Android
- Exposes all devices for you to access from docker i.e. new depth cameras, USB devices via libusb, etc.
Below we go into some examples of things you can do with docker.
Example - Run your own Ubuntu flavor
Docker makes it super easy to install and run any flavor of Ubuntu. Note you can run multiple versions at the same time! This is useful if some code only compiles properly under 14.04 while another one needs to run on 19.04. You can take your pick from the commands below:
docker-ohmnirun ubuntu:14.04 bash docker-ohmnirun ubuntu:16.04 bash docker-ohmnirun ubuntu:18.04 bash docker-ohmnirun ubuntu:19.04 bash
Example - Running ROS
Compiling ROS from scratch is often painful. Docker make things easy with one-liner installs of whichever version you like:
docker-ohmnirun ros:indigo bash docker-ohmnirun ros:kinetic bash docker-ohmnirun ros:lunar bash docker-ohmnirun ros:melodic bash