diff --git a/README.md b/README.md index b53b13a..6655322 100644 --- a/README.md +++ b/README.md @@ -1,91 +1 @@ -# ROS Setups - -Instructions and scripts for the installation of ROS on various platforms, such as Odroid and Intel Edison. - -# Building the Edison Debian Image - -## System Requirements - -Ubuntu 14.04 LTS (Doesn't work on 16.04 LTS) - -It takes about 4-5 hours build time depending on number of CPU cores. - -## References - -1. [How to Build Debian Image for Edison](https://communities.intel.com/thread/110217 "Intel") -2. [Building Debian Linux for Intel Edison](http://www.hackgnar.com/2016/02/building-debian-linux-for-intel-edison.html "Hackgnar") -3. [Building a Custom Debian Image for the Intel Edison](https://jakehewitt.github.io/custom-edison-image/ "JakeHewitt") - -## Create a Directory for Building the Images - -`cd ~` -`mkdir -p ~/src/edison` -`cd ~/src/edison` - -## Install Build Dependencies - -`sudo apt-get -y install build-essential git diffstat gawk chrpath texinfo libtool gcc-multilib debootstrap u-boot-tools debian-archive-keyring python curl` - -## Download Latest Source - -`curl -O http://downloadmirror.intel.com/25028/eng/edison-src-ww25.5-15.tgz` - -## Uncompress the Source Files - -`tar xfvz edison-src-ww25.5-15.tgz` - -## Get Started - -Create two resource directories so we can rebuild the images without fetching support file twice - -`mkdir bitbake_download_dir` -`mkdir bitbake_sstate_dir` - -To take advantage of parallelization, change `parallel_make` and `bb_number_thread` to equal to the number of cores available. - -`./meta-intel-edison/setup.sh --dl_dir=bitbake_download_dir --sstate_dir=bitbake_sstate_dir --deb_packages --parallel_make=40 --bb_number_thread=40` - -## Setup Enviroment Variables - -`cd out/linux64` -`source poky/oe-init-build-env` - -## Edit Some Errors - -1. paho-mqtt_3.1.bb - `sudo nano ~/src/edison/edison-src/linux64/poky/meta-intel-iot-middleware/recipes-connectivity/paho-mqtt/paho-mqtt_3.1.bb`⋅⋅ - and change SRC_URI from `git://git.eclipse.org/gitroot/paho/org.eclipse.paho.mqtt.c.git` - to `git://github.com/eclipse/paho.mqtt.c.git` - -2. edison-images.bb - `sudo nano ~/src/edison/edison-src/meta-intel-edison/meta-intel-edison-distro/recipes-core/images/edison-images.bb` - Comment the following lines - `IMAGE_INSTALL += "iotkit-comm-js"` - `IMAGE_INSTALL += "iotkit-comm-c-dev"` - - -## Building the Image (Part 1) - -Now we are ready to build the image. I will take several hours, around 5 hours. (It takes 20 mins on a 40-core CPU :P) - -run `bitbake edison-image` - -## Building the Image (Part 2) - -`cd ~/src/edison-src` -`sudo nano meta-intel-edison/utils/create-debian-image.sh` - -1. Change `build_dir=$top_repo_dir/build` - to `build_dir=$top_repo_dir/out/linux64/build` - -2. Change ``fsize=$((`stat --printf="%s" toFlash/edison-image-edison.ext4` / 524288))`` to ``fsize=$((`stat --printf="%s" toFlash/edison-image-edison.ext4` / 524288 * 2)) `` - -3. Change `$CHROOTCMD dpkg -i /tmp/deb/edison/kernel-image-3.10.17-poky-edison+_1.0-r2_i386.deb` - `$CHROOTCMD dpkg -i /tmp/deb/edison/kernel-3.10.17-poky-edison+_1.0-r2_i386.deb` - to `$CHROOTCMD dpkg -i /tmp/deb/edison/kernel-image-3.10.98-poky-edison+_1.0-r2_i386.deb` `$CHROOTCMD dpkg -i /tmp/deb/edison/kernel-3.10.98-poky-edison+_1.0-r2_i386.deb` - -Finally, we cleared all the mistakes in the scripts. - -`sudo ./meta-intel-edison/utils/create-debian-image.sh` - -The flashable image is build in `out/linux64/build/toFlash` +-- Follow Instructions om README -- diff --git a/intel-edison/README.md b/intel-edison/README.md index 8973ae9..6b1726d 100644 --- a/intel-edison/README.md +++ b/intel-edison/README.md @@ -8,7 +8,7 @@ Connect one USB cable to the cosole port and then start your temrminal app (see # Flash Debian -To build Debian Jessie carefully follow the instruction from ros-setups/README.md +Download jubilinux from http://www.jubilinux.org/ If Windows is used, dfu-util is required. Download the latest version from this page: http://dfu-util.sourceforge.net/releases/ @@ -19,7 +19,7 @@ Connect to the console with 115000 8N1, for example: `screen /dev/USB0 115200 8N1` -and login as root (password: edison) +and login as edison (password: edison) ## Post Debian Install @@ -27,31 +27,20 @@ After Debian has been installed you will end up with the following partitions: ``` Filesystem Size Used Avail Use% Mounted on -rootfs 1.4G 813M 503M 62% / -/dev/root 1.4G 813M 503M 62% / -devtmpfs 480M 0 480M 0% /dev -tmpfs 97M 292K 96M 1% /run +/dev/root 1.4G 242M 1.1G 19% / +devtmpfs 481M 0 481M 0% /dev +tmpfs 481M 0 481M 0% /dev/shm +tmpfs 481M 6.7M 474M 2% /run tmpfs 5.0M 0 5.0M 0% /run/lock -tmpfs 193M 0 193M 0% /run/shm +tmpfs 481M 0 481M 0% /sys/fs/cgroup tmpfs 481M 0 481M 0% /tmp -/dev/mmcblk0p7 32M 5.3M 27M 17% /boot -/dev/mmcblk0p10 1.3G 2.0M 1.3G 1% /home -``` - -For some reasons, the /home partition is not mounted after the first boot. To fix this issue, add the follow to the bottom of `/etc/fstab` - -``` -/dev/disk/by-partlabel/home /home auto defaults 1 1 -``` - -Resize the rootfs image to partition Size - -``` -resize2fs /dev/mmcblk0p5 +/dev/mmcblk0p7 32M 4.8M 28M 16% /boot +/dev/mmcblk0p10 1.3G 631M 660M 49% /home +tmpfs 97M 0 97M 0% /run/user/1002 ``` ## Post ROS Install -Once ROS is installed there won't be much space left on the root partition. TODO: Add howto on freeing up space. +Once ROS is installed there won't be much space left on the home partition. ``` Filesystem Size Used Avail Use% Mounted on @@ -68,7 +57,7 @@ tmpfs 481M 6.6M 474M 2% /tmp # Post Installation Steps -## Freeing up Space on the Root Partition +## Freeing up Space on the Home Partition You will need more space on the home partition. Run the following commands: @@ -79,26 +68,10 @@ You will need more space on the home partition. Run the following commands: `exit` -## Creating Catkin PACKAGE - -`mkdir ~/catkin_ws/src` -`cd ~/catkin_ws/` -`catkin_make` - -If facing CMAKE error, `cd ~/catkin_ws` and `sudo chown -R edison:users .` - -## Install AIR, MAVROS_EXTRAS, GEOMETRY - -``` -git clone https://github.com/tcheehow/air.git -git clone -b edison https://github.com/tcheehow/mavros.git -git clone -b indigo-devel https://github.com/ros/geometry.git -``` - ## Wifi Run `sudo cp /etc/network/interfaces /etc/network/interfaces.home` -Run `sudo cp /etc/network/interfaces /etc/network/interfaces.home` +Run `sudo cp /etc/network/interfaces /etc/network/interfaces.work` Run `wpa_passphrase your-ssid your-wifi-password` to generate pka. `cd /etc/network` @@ -159,9 +132,9 @@ deb http://ftp.sg.debian.org/debian jessie-backports main ``` ``` -apt-get -y update -apt-get -f install -apt-get -y upgrade +sudo apt-get -y update +sudo apt-get -f install +sudo apt-get -y upgrade ``` ## Locales @@ -188,19 +161,33 @@ apt-get -y install git apt-get -y install sudo less ``` -## Add User -`adduser px4` -`passwd px4` (set the password to px4) -`usermod -aG sudo px4` -`usermod -aG dialout px4` +## Creating Catkin PACKAGE + +`mkdir ~/catkin_ws/src` +`cd ~/catkin_ws/` +`catkin_make` + +If facing CMAKE error, `cd ~/catkin_ws` and `sudo chown -R edison:users .` + +## Install AIR, MAVROS_EXTRAS, GEOMETRY + +``` +git clone https://github.com/tcheehow/air.git +git clone -b edison https://github.com/tcheehow/mavros.git +git clone -b indigo-devel https://github.com/ros/geometry.git +git clone https://github.com/tcheehow/teraranger_array.git +git clone https://github.com/ros/dynamic_reconfigure.git +git clone https://github.com/wjwwood/serial +``` + +## User -## Remove "edison" User -`deluser --remove-home user` +Always login as root due to permission issues for serial and i2c. ## Add host `nano /etc/hosts` and add below localhost `127.0.0.1 edison` -Login as px4 to continue. +Login as root to continue. # ROS/MAVROS Installation @@ -246,20 +233,49 @@ in /mraa/src/python/python3/CMakeLists.txt ``` -# Setting I2C Permission with udev rules +# Setting I2C Permission + +First install i2c-tools to setup the /dev/i2c* with i2c permission ``` -sudo usermode -aG i2c edison +sudo apt-get install i2c-tools +sudo reboot +sudo usermod -aG i2c edison ``` Reboot the edison for udev rules to take effect. # Setting Serial Permission with udev rules ``` -sudo usermode -aG dialout edison +sudo usermod -aG dialout edison ``` Reboot the edison for udev rules to take effect. +# Setting Up Edison as AP + +References: https://github.com/ArduPilot/companion + + +In `etc/default/hostapd`, uncomment DAE_CONF and add `/etc/hostapd/hostapd.conf` to it, it should look like +``` +DAE_CONF="/etc/hostapd/hostapd.conf" +``` + +``` +# uncomment to 4 lines in /etc/network/interfaces for hostapd and +# comment out the wlan0 setup for usual internet access +``` + +Add the following to the end of /etc/rc.local + +``` +ifdown wlan0 +/etc/init.d/hostapd restart +ifup wlan0 +``` + +in `/etc/init.d/hostapd` add `/etc/hostapd/hostapd.conf` to DAE_CONF + # Python Flight App Once you have a functional ROS setup you can *very carefully* perform an offboard flight using the setpoint_demo.py script. This script assumes that you have already successfully run `roslaunch mavros px4.launch`. diff --git a/intel-edison/install_ros.sh b/intel-edison/install_ros.sh index f481ab0..1394a19 100755 --- a/intel-edison/install_ros.sh +++ b/intel-edison/install_ros.sh @@ -16,21 +16,21 @@ echo "*** Get ROS and Raspian keys ***" sudo apt-key adv --keyserver hkp://ha.pool.sks-keyservers.net:80 --recv-key 421C365BD9FF1F717815A3895523BAEEB01FA116 #wget https://raw.githubusercontent.com/ros/rosdistro/master/ros.key -O - | sudo apt-key add - wget http://archive.raspbian.org/raspbian.public.key -O - | sudo apt-key add - +wget https://raw.githubusercontent.com/ros/rosdistro/master/ros.key -O - | sudo apt-key add - echo "*** Update the OS ***" sudo apt-get -y update sudo apt-get -y upgrade echo "*** Install required OS packages ***" -sudo apt-get -y install pkg-config -sudo apt-get -y install python-setuptools python-pip python-yaml python-argparse python-distribute python-docutils python-dateutil python-six +sudo apt-get install python-pip python-setuptools python-yaml python-distribute python-docutils python-dateutil python-six echo "*** Install required ROS packages ***" sudo pip install rosdep rosinstall_generator wstool rosinstall echo "*** Fix some permission issues" cd ~ -sudo chown -R px4 . +sudo chown -R edison:users . echo "*** ROSDEP ***" sudo rosdep init @@ -43,11 +43,13 @@ echo "*** rosinstall ***" # This will install only mavros and not mavros-extras (no image # support which the Edison can’t really handle well anyway). rosinstall_generator ros_comm mavros --rosdistro indigo --deps --wet-only --exclude roslisp --tar > indigo-ros_comm-wet.rosinstall +#rosinstall_generator ros_comm mavros --rosdistro indigo --deps --wet-only --tar > indigo-ros_comm-wet.rosinstall echo "*** wstool ***" sudo wstool init src -j3 indigo-ros_comm-wet.rosinstall while [ $? != 0 ]; do + # run this afew times to make sure all packages are downloaded echo "*** wstool - download failures, retrying ***" sudo wstool update -t src -j3 done @@ -63,9 +65,15 @@ sudo apt-get -y update echo "*** Install console bridge ***" cd ~/ros_catkin_ws/external_src -sudo apt-get -y build-dep console-bridge -apt-get -y source -b console-bridge -sudo dpkg -i libconsole-bridge0.2*.deb libconsole-bridge-dev*.deb +#sudo apt-get -y build-dep console-bridge +#apt-get -y source -b console-bridge +#sudo dpkg -i libconsole-bridge0.2*.deb libconsole-bridge-dev*.deb +sudo apt-get install libboost-system-dev libboost-thread-dev +git clone https://github.com/ros/console_bridge.git +cd console_bridge +cmake . +sudo checkinstall make install +#sudo ./src/catkin/bin/catkin_make_isolated --install -DCMAKE_BUILD_TYPE=Release --install-space /opt/ros/indigo echo "*** Install liblz4-dev ***" sudo apt-get -y install liblz4-dev @@ -80,7 +88,7 @@ echo “About to start some heavy building. Go have a looong coffee break.” echo “******************************************************************” echo "*** Building ROS ***" -sudo ./src/catkin/bin/catkin_make_isolated --install -DCMAKE_BUILD_TYPE=Release --install-space /opt/ros/indigo +sudo ./src/catkin/bin/catkin_make_isolated --install -DCMAKE_BUILD_TYPE=Release --install-space /opt/ros/indigo -j1 #cd ~/ros_catkin_ws/build_isolated/ #sudo chown -R px4 .