0.NANO入门教程之安装ROS

安装ROS

其实在nano上面安装ros和在台式机上面安装并无差异:

1.
sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list'
2.  
sudo apt-key adv --keyserver hkp://ha.pool.sks-keyservers.net:80 --recv-key 0xB01FA116
3.  
sudo apt-get update
sudo apt-get install ros-melodic-desktop-full -y
4.    
sudo apt-get install python-rosdep -y
5.  
sudo rosdep init
6.  
rosdep update
7.  
echo "source /opt/ros/melodic/setup.bash" >> ~/.bashrc
source ~/.bashrc
8.
sudo apt-get install python-rosinstall -y

最后执行roscore验证是否安装成功。

安装Turlebot(melodic版本)

安装opencv3.2
安装依赖

sudo apt-get update

sudo apt-get install -y build-essential cmake git libgtk2.0-dev pkg-config libavcodec-dev libavformat-dev libswscale-dev

sudo apt-get install -y libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev
sudo apt-get install -y python2.7-dev

sudo apt-get install -y python-dev python-numpy libtbb2 libtbb-dev libjpeg-dev libpng-dev libtiff-dev libjasper-dev libdc1394-22-dev

sudo apt-get install -y libv4l-dev v4l-utils qv4l2 v4l2ucp
sudo apt-get install -y curl
sudo apt-get update

下载源码
mkdir -p ~/tools/
cd ~/tools/
curl -L https://github.com/opencv/opencv/archive/3.2.0.zip -o opencv-3.2.0.zip
unzip opencv-3.2.0.zip 
git clone https://github.com/opencv/opencv_contrib.git
cd opencv_contrib
git checkout -b v3.2.0 3.2.0

以上两个文件如果下载网速太慢,可去CSDN下载中心进行下载。

以下参考创客智造文件修改:
找到FindCUDA.cmake文件
找到行,

find_cuda_helper_libs(nppi)

替换为

find_cuda_helper_libs(nppial)
find_cuda_helper_libs(nppicc)
find_cuda_helper_libs(nppicom)
find_cuda_helper_libs(nppidei)
find_cuda_helper_libs(nppif)
find_cuda_helper_libs(nppig)
find_cuda_helper_libs(nppim)
find_cuda_helper_libs(nppist)
find_cuda_helper_libs(nppisu)
find_cuda_helper_libs(nppitc)

找到行

set(CUDA_npp_LIBRARY "${CUDA_nppc_LIBRARY};${CUDA_nppi_LIBRARY};${CUDA_npps_LIBRARY}")

替换为

set(CUDA_npp_LIBRARY "${CUDA_nppc_LIBRARY};${CUDA_nppial_LIBRARY};${CUDA_nppicc_LIBRARY};${CUDA_nppicom_LIBRARY};${CUDA_nppidei_LIBRARY};${CUDA_nppif_LIBRARY};${CUDA_nppig_LIBRARY};${CUDA_nppim_LIBRARY};${CUDA_nppist_LIBRARY};${CUDA_nppisu_LIBRARY};${CUDA_nppitc_LIBRARY};${CUDA_npps_LIBRARY}")

找到行,

unset(CUDA_nppi_LIBRARY CACHE)

替换为

unset(CUDA_nppial_LIBRARY CACHE)
unset(CUDA_nppicc_LIBRARY CACHE)
unset(CUDA_nppicom_LIBRARY CACHE)
unset(CUDA_nppidei_LIBRARY CACHE)
unset(CUDA_nppif_LIBRARY CACHE)
unset(CUDA_nppig_LIBRARY CACHE)
unset(CUDA_nppim_LIBRARY CACHE)
unset(CUDA_nppist_LIBRARY CACHE)
unset(CUDA_nppisu_LIBRARY CACHE)
unset(CUDA_nppitc_LIBRARY CACHE)

找到文件OpenCVDetectCUDA.cmake文件
找到

set(__cuda_arch_ptx "")
if(CUDA_GENERATION STREQUAL "Fermi")
    set(__cuda_arch_bin "2.0")
elseif(CUDA_GENERATION STREQUAL "Kepler")
    set(__cuda_arch_bin "3.0 3.5 3.7")

替换为

set(__cuda_arch_ptx "")
if(CUDA_GENERATION STREQUAL "Kepler")
    set(__cuda_arch_bin "3.0 3.5 3.7")
elseif(CUDA_GENERATION STREQUAL "Maxwell")
    set(__cuda_arch_bin "5.0 5.2")

cuda9后的版本中有一个单独的halffloat(cuda_fp16.h)头文件,也应该被包括在opencv的目录里将头文件cuda_fp16.h添加至 opencv\modules\cudev\include\opencv2\cudev\common.hpp

#include <cuda_fp16.h>

编译源码
mkdir release

cd release/

cmake -D WITH_CUDA=ON -D CUDA_ARCH_BIN="7.2" -D ENABLE_PRECOMPILED_HEADERS=OFF  -D CUDA_ARCH_PTX="" -D WITH_GSTREAMER=ON -D WITH_LIBV4L=ON -D BUILD_TESTS=OFF -D BUILD_PERF_TESTS=OFF -D BUILD_EXAMPLES=OFF -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local -D OPENCV_EXTRA_MODULES_PATH=~/tools/opencv_contrib/modules ..

make

sudo make install 
安装依赖
sudo apt-get install ros-melodic-kobuki-*
sudo apt-get install ros-melodic-ecl-streams
sudo apt-get install libusb-dev
sudo apt-get install libspnav-dev
sudo apt-get install ros-melodic-joystick-drivers
sudo apt-get install bluetooth
sudo apt-get install libbluetooth-dev
sudo apt-get install libcwiid-dev
准备ROS包
准备源码
mkdir -p ~/turtlebot_ws/src 
cd ~/turtlebot_ws/src

git clone https://github.com/turtlebot/turtlebot_simulator
git clone https://github.com/turtlebot/turtlebot.git
git clone https://github.com/yujinrobot/kobuki_desktop.git
git clone https://github.com/yujinrobot/kobuki_msgs.git
git clone https://github.com/ros-perception/depthimage_to_laserscan.git #需要依赖opencv3.2
git clone https://github.com/udacity/robot_pose_ekf
git clone https://github.com/turtlebot/turtlebot_apps.git

cd kobuki_desktop/
rm -r kobuki_qtestsuite

git clone https://github.com/ros-drivers/joystick_drivers.git
git clone https://github.com/turtlebot/turtlebot_msgs.git
git clone https://github.com/toeklk/orocos-bayesian-filtering.git

//复制kobuki和yujin_ocs依赖库到turtlebot_ws/src工作空间下

mkdir  -p  ~/repos/
cd  ~/repos/

git clone https://github.com/yujinrobot/kobuki.git
cp -r kobuki/* ~/turtlebot_ws/src/

git clone https://github.com/yujinrobot/yujin_ocs.git
cp -r yujin_ocs/yocs_cmd_vel_mux/ yujin_ocs/yocs_controllers ~/turtlebot_ws/src/
编译工作空间
cd ~/turtlebot_ws
rosdep install --from-paths src --ignore-src -r -y
catkin_make
添加工作空间到bashrc文件
echo "source ~/turtlebot_ws/devel/setup.bash" >> ~/.bashrc
source ~/.bashrc 
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值