This was a work in progress status report on getting ROS onto ev3dev using brickstrap. Now it's become the main instructions on how to use brickstrap to build the ros_comm packages for ev3-dev
-
Follow the ev3dev tutorial for installing brickstrap. n:
-
Set up a new brickstrap space to work i
- the -p option allows you to name this workspace
- the -c option is for which board your using, ev3-ev3dev-jessie is for the Lego EV3.
user@host$ brickstrap -p ev3dev-jessie -c ev3 create-rootfs
This command takes a few minutes.
- Enter the brickstrap shell:
user@host$ brickstrap -p ev3dev-jessie -c ev3 shell
(brickstrap)root@host#
Once inside of a brickstrap shell:
- Install some basics, needed to build and extract further dependencies. Change into host-rootfs (explained in brickstrap tutorial)
(brickstrap)root@host# cd /host-rootfs/home/user
(brickstrap)root@host# apt-get update
(brickstrap)root@host# apt-get install unzip bzip2 build-essential
- Install the ROS system dependencies using
apt-get install
.
I've added them in list so that they can be updated and maintained easily.
(brickstrap)root@host# wget https://raw.githubusercontent.com/moriarty/ros-ev3/master/ros-dependencies.debs
(brickstrap)root@host# bash ros-dependencies.debs
- Next install the some python packages available through pip
(brickstrap)root@host# pip install -U rosdep rosinstall_generator wstool rosinstall catkin_pkg rospkg
- sbcl needs to be downloaded, there is a armel binary available for 1.2.7
http://www.sbcl.org/platform-table.html
Downlad, unpack it, change to the directory and run the install script:
(brickstrap)root@host# wget http://netcologne.dl.sourceforge.net/project/sbcl/sbcl/1.2.7/sbcl-1.2.7-armel-linux-binary.tar.bz2
(brickstrap)root@host# tar -xjf sbcl-1.2.7-armel-linux-binary.tar.bz2
(brickstrap)root@host# cd sbcl-1.2.7-armel-linux
(brickstrap)root@host# INSTALL_ROOT=/usr/local sh install.sh
(brickstrap)root@host# cd ..
- Initialize rosdep:
(brickstrap)root@host# rosdep init
- Debian jessie is not officially supported by ROS, so we need to change where it will look for some packages
Open the 20-default.list file:
(brickstrap)root@host# nano /etc/ros/rosdep/sources.list.d/20-default.list
Add the following line to the beginning, in the os-specific listing section.
# os-specific listings first
yaml https://raw.githubusercontent.com/moriarty/ros-ev3/master/ev3dev.yaml
update rosdep.
(brickstrap)root@host# rosdep update
- I created and changed to a new directory ros_comm, just to keep things organized.
Then create the rosinstall file, initialize the ros workspace, and check the ros dependencies are all met. Note: only ros_comm and common_msgs will be installed, if you need more, add them to rosinstall_generator command.
(brickstrap)root@host# mkdir ros_comm && cd ros_comm
(brickstrap)root@host# rosinstall_generator ros_comm common_msgs --rosdistro kinetic --deps --wet-only --tar > kinetic-ros_comm-wet.rosinstall
(brickstrap)root@host# wstool init src kinetic-ros_comm-wet.rosinstall
(brickstrap)root@host# rosdep install --from-paths src --ignore-src --rosdistro kinetic -y --os=debian:jessie
- It's time to install ros using catkin_make_isolated.
(brickstrap)root@host# ./src/catkin/bin/catkin_make_isolated --install --install-space /opt/ros/kinetic -DCMAKE_BUILD_TYPE=Release
This step might take a while.
- Exit the brickstrap shell and create a tar of the brickstrap rootfs and a disk image from the tar. The python bindings for ev3dev are available by default. If you need c++, see section below and return to this step later.
(brickstrap)root@host# exit
user@host$ brickstrap create-tar
user@host$ brickstrap create-image
- Create an SD card from the image, there are two ways to do this:
ev3dev-lang-cpp is the c++ language bindings for ev3dev. Here are unofficial installation instructions. Run these instructions inside of the brickstrap shell from above. If you've closed your brickstrap shell, install brickstrap step 3 will open a new one.
-
Clone ev3dev-lang-cpp
(brickstrap)root@host# git clone https://github.com/ddemidov/ev3dev-lang-cpp
-
Patch the CMakeLists.txt. By default ev3dev-lang-cpp creates a static library which is not installed. This patch creates a shared library and adds install for the library and header file.
(brickstrap)root@host# cd ev3dev-lang-cpp (brickstrap)root@host# wget https://raw.githubusercontent.com/moriarty/ros-ev3/master/install_ev3dev_shared_library_CMakeLists.patch (brickstrap)root@host# git apply install_ev3dev_shared_library_CMakeLists.patch
-
Build and install.
(brickstrap)root@host# mkdir build (brickstrap)root@host# cd build (brickstrap)root@host# cmake .. (brickstrap)root@host# make (brickstrap)root@host# make install
-
Return to install ros_comm step 9.
Don't forget to source setup.bash and export ROS_MASTER_URI.
TODO: test export ROS_LANG_DISABLE=genlisp
to speedup catkin_make_isolated
ROSCORE is not working on the ev3. I don't know if it's possible or when I will have a chance to investigate further.
Running roscore on a laptop, I was able to run the rospy tutorials talker and listener on the ev3.
I've uploaded a video here of the talker/listener running.
I set all the ip addresses of the machines and ev3 in /etc/hosts, might be my own networking issue.