Skip to content

3. Setting Up a ROS Dev Env

Alec Graves edited this page May 18, 2017 · 2 revisions

1. Set up ROS

ros kinetic

sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list'; \
sudo apt-key adv --keyserver hkp://ha.pool.sks-keyservers.net:80 --recv-key 0xB01FA116; \
sudo apt-get update; \
sudo apt-get -y --force-yes install ros-kinetic-desktop; \
sudo rosdep init; \
rosdep update; \
echo "source /opt/ros/kinetic/setup.bash" >> ~/.bashrc; \
source ~/.bashrc;

ros indigo (old)

sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list'; \
sudo apt-key adv --keyserver hkp://pool.sks-keyservers.net --recv-key 0xB01FA116; \
sudo apt-get update; \
sudo apt-get -y --force-yes install ros-indigo-desktop; \
sudo rosdep init; \
rosdep update; \
echo "source /opt/ros/indigo/setup.bash" >> ~/.bashrc; \
source ~/.bashrc;

2. Set up Catkin workspace

mkdir -p ~/catkin_ws/src
cd ~/catkin_ws/src
catkin_init_workspace
echo "source ~/catkin_ws/devel/setup.bash" >> ~/.bashrc
echo "alias cm='catkin_make -DCMAKE_BUILD_TYPE=Release -j$(nproc) -C ~/catkin_ws/'" >> ~/.bash_aliases
echo "alias refresh='source ~/.bashrc'" >> ~/.bash_aliases
source ~/.bashrc
cm
refresh

3. Install dependencies

ros kinetic

sudo apt-get -y --force-yes install git vim ros-kinetic-cv-bridge ros-kinetic-image-view ros-kinetic-camera-calibration* ros-kinetic-mavros* build-essential cmake ros-kinetic-pcl-ros pkg-config libgtk2.0-dev libavcodec-dev libavformat-dev libswscale-dev python-dev python-numpy libtbb2 ros-kinetic-image-transport ros-kinetic-mavlink ros-kinetic-cmake-modules ros-kinetic-control-toolbox ros-kinetic-libmavconn ros-kinetic-libsensors-monitor ros-kinetic-image-proc ros-kinetic-key-teleop 

ros indigo (old)

sudo apt-get -y --force-yes install git vim build-essential ros-indigo-pcl-ros cmake libgtk2.0-dev pkg-config libavcodec-dev libavformat-dev libswscale-dev python-dev python-numpy libtbb2 libpcl-1.7-doc libtbb-dev libjpeg-dev libpng-dev libtiff-dev libjasper-dev libdc1394-22-dev libeigen3-dev libgsl0-dev ros-indigo-cv-bridge ros-indigo-image-transport ros-indigo-mavlink ros-indigo-cmake-modules ros-indigo-control-toolbox ros-indigo-usb-cam ros-indigo-mavros-msgs ros-indigo-mavros ros-indigo-libmavconn ros-indigo-libuvc-camera ros-indigo-image-proc ros-indigo-mavros-extras geany ros-indigo-usb-cam ros-indigo-image-view ros-indigo-camera-calibration ros-indigo-camera-calibration-parsers ros-indigo-keyboard

4. Install OpenCV

Regular

cd
git clone https://github.com/Itseez/opencv.git
cd opencv
git checkout 3.1.0
mkdir cv3-release
cd cv3-release
cmake .. -DCMAKE_BUILD_TYPE=Release \
-DWITH_CUDA=OFF \
-DCMAKE_C_FLAGS="-std=c11 -march=native" -DCMAKE_CXX_FLAGS="-std=c++11 -march=native" \
-DBUILD_PERF_TESTS=OFF
make -j$(nproc)

(ODROID) Install OpenCV with Hardware Optimizations

Don't forget to enable the vectorized floating point coprocessors.

cd
git clone https://github.com/Itseez/opencv.git
cd opencv
git checkout 3.1.0
mkdir cv3-release
cd cv3-release
cmake .. -DCMAKE_BUILD_TYPE=Release \
-DWITH_CUDA=OFF -DWITH_OPENMP=ON  \
-DCMAKE_C_FLAGS="-std=c11 -march=native" -DCMAKE_CXX_FLAGS="-std=c++11 -march=native" \
-DENABLE_NEON=ON -DENABLE_VFPV3=ON -DBUILD_TESTS=OFF -DBUILD_PERF_TESTS=OFF \
-DWITH_TBB=ON -DBUILD_TBB=ON
make -j$(nproc)

5. Vars for ROS swarm (optional)

echo "#export ROS_IP=192.168.1.97" >> ~/.bashrc
echo "#export ROS_MASTER_URI=http://192.168.1.92:11311" >> ~/.bashrc

6. Github config

This is optional, but I like to do it.

git config --global credential.helper cache
git config --global credential.helper 'cache --timeout=<seconds before password forgotten>'
git config --global user.email "<[email protected]>"
git config --global user.name "<YOUR NAME DO NOT COPY AND PASTE>"