본문 바로가기

Enginius/C / C++

우분투 설치 + 쿠다 설치 + ROS 설치

1. 리눅스 설치 하기 (Ubuntu 14.04)


    


    




2. 쿠다 설치 하기 


1. 엔비디아 홈페이지 (쿠다 툴킷)

http://docs.nvidia.com/cuda/#axzz3LNnWeajO


2. Getting Started Linux 

http://docs.nvidia.com/cuda/cuda-getting-started-guide-for-linux/index.html#axzz3LNnWeajO


3. 그래픽 카드 버젼 확인

$ lspci | grep -i nvidia


4. GCC 버젼 확인

$ gcc --version


5. 쿠다 툴킷 다운받기 

 - https://developer.nvidia.com/cuda-downloads

 - 우분투 64비트 DEB 받기 


6. 우분투에서 설치하기 

 - http://docs.nvidia.com/cuda/cuda-getting-started-guide-for-linux/index.html#ubuntu-installation 

 - 위에서 DEB를 받은 폴더(보통 download)로 이동 한 뒤, 

$ sudo dpkg -i cuda-repo-<distro>_<version>_<architecture>.deb


$ sudo apt-get update


$ sudo apt-get install cuda


7. 환경 변수 설정하기 

 - http://docs.nvidia.com/cuda/cuda-getting-started-guide-for-linux/index.html#post-installation-actions 



$ cd

$ gedit .bashrc 


 - 열린 창에서 다음 두 줄을 맨 뒤에 추가한다. 

$ export PATH=/usr/local/cuda-6.5/bin:$PATH

$ export LD_LIBRARY_PATH=/usr/local/cuda-6.5/lib64:$LD_LIBRARY_PATH


8. 잘 설치되었는지 확인

$ cuda-install-samples-6.5.sh ~

$ cd

$ cd NVIDIA_CUDA-6.5_Samples

$ make

이러고 나면 시간이 좀 걸려서 수많은 예제를 다 compile한다. 

그리고 여기 있는 것들 돌려보면 된다. 

$ ./simplePrintf

$ ./matrixMul

$ ./matrixMulCUBLAS



3. ROS 설치 하기 (Indigo) 


1. 우분투용 ROS 인디고 받기

 - http://wiki.ros.org/indigo/Installation/Ubuntu

- 1. Ubuntu 14.04 (Trusty) - 서버 추가

  • sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu trusty main" > /etc/apt/sources.list.d/ros-latest.list'

- 2. Set up your keys - ROS 키 추가 

  • wget https://raw.githubusercontent.com/ros/rosdistro/master/ros.key -O - | sudo apt-key add -

- 3. Installation 설치하기 

First, make sure your Debian package index is up-to-date:

  • sudo apt-get update

Desktop-Full Install: (Recommended) : ROS, rqtrviz, robot-generic libraries, 2D/3D simulators, navigation and 2D/3D perception

Indigo uses Gazebo 2 which is the default version of Gazebo on Trusty and is recommended. If you need to upgrade to Gazebo 3 see these instructions about how to upgrade the simulator.

  • sudo apt-get install ros-indigo-desktop-full


 - 4. Dependency를 잡아주는 tool 

Before you can use ROS, you will need to initialize rosdep. rosdep enables you to easily install system dependencies for source you want to compile and is required to run some core components in ROS.

sudo rosdep init
rosdep update

 - 5. Environment setup

It's convenient if the ROS environment variables are automatically added to your bash session every time a new shell is launched:

echo "source /opt/ros/indigo/setup.bash" >> ~/.bashrc
source ~/.bashrc

 - 6. Initialize rosdep

Before you can use ROS, you will need to initialize rosdeprosdep enables you to easily install system dependencies for source you want to compile and is required to run some core components in ROS.

sudo rosdep init
rosdep update

 - 7. Install python on Ubuntu, run:

sudo apt-get install python-rosinstall


2. ROS 튜토리얼

 - http://wiki.ros.org/ROS/Tutorials

 - http://wiki.ros.org/ROS/Tutorials/InstallingandConfiguringROSEnvironment

Create a ROS Workspace

These instructions are for ROS Groovy and later. For ROS Fuerte and earlier, select rosbuild.

Let's create a catkin workspace:

 - src 폴더 만들고, catkin 초기화

$ mkdir -p ~/catkin_ws/src
$ cd ~/catkin_ws/src
$ catkin_init_workspace

Even though the workspace is empty (there are no packages in the 'src' folder, just a single CMakeLists.txt link) you can still "build" the workspace:

 - catkin_make 하기 

$ cd ~/catkin_ws/
$ catkin_make

The catkin_make command is a convenience tool for working with catkin workspaces. If you look in your current directory you should now have a 'build' and 'devel' folder. Inside the 'devel' folder you can see that there are now several setup.*sh files. Sourcing any of these files will overlay this workspace on top of your environment. To understand more about this see the general catkin documentation: catkin. Before continuing source your new setup.*sh file:

$ source devel/setup.bash

Now that your environment is setup, continue with the ROS file system tutorial.


 - 추가 작업

$ cd

$ gedit .bashrc

열린 창 맨 밑에 줄에 

source ~/catkin_ws/devel/setup.bash

를 추가한다. 


여기까지 왔으면 ROS의 기본 기능을 사용할 준비가 완료되었다.