Mac OS 安装ROS indigo

刚入手一个Mac 打算抛弃ubuntu投奔Mac os 的怀抱,废话不多说

首先在安装ros之前需要安装brew(安装网站:https://brew.sh)这个超简单pass。

下面是安装ros的步骤

首先运行以下命令来添加附加软件

$ brew update
$ brew install cmake
添加第三方仓库
$ brew tap ros/deps
$ brew tap osrf/simulation  # Gazebo, sdformat, and ogre
$ brew tap homebrew/versions # VTK5
$ brew tap homebrew/science  # others

设置环境变量

  • export PATH=/usr/local/bin:$PATH
  • $ source ~/.bashrc
python 环境变量设置

  • $ mkdir -p ~/Library/Python/2.7/lib/python/site-packages
    $ echo "$(brew --prefix)/lib/python2.7/site-packages" >> ~/Library/Python/2.7/lib/python/site-packages/homebrew.pth
添加pip

$ sudo easy_install pip

安装ROS python工具

  • $ sudo -H pip install -U wstool rosdep rosinstall rosinstall_generator rospkg catkin-pkg Distribute sphinx
  • $ sudo rosdep init
    $ rosdep update
下面就可以正式安装ROS了

首先和ubuntu不一样的是Mac os 下需要单独建立一个工作空间来存放编译ROS,ros这里更加类似于一个pkg,而不是直接安装在opt下。下面是建立工作空间的命令

  • $ mkdir ~/ros_catkin_ws
    $ cd ~/ros_catkin_ws
然后下载安装文件,运行完成后会有一个indigo-**-**-wet.rosinstall的文件被下载到本地:

1. Desktop-Full Install: ROS, rqtrviz, robot-generic libraries, 2D/3D simulators, navigation and 2D/3D perception

$ rosinstall_generator desktop_full --rosdistro indigo --deps --wet-only --tar > indigo-desktop-full-wet.rosinstall

2. Desktop Install (recommended): ROS, rqtrviz, and robot-generic libraries

$ rosinstall_generator desktop --rosdistro indigo --deps --wet-only --tar > indigo-desktop-wet.rosinstall

3. ROS-Comm: (Bare Bones) ROS package, build, and communication libraries. No GUI tools.

$ rosinstall_generator ros_comm --rosdistro indigo --deps --wet-only --tar > indigo-ros_comm-wet.rosinstall

安装,这里使用的是wstool来安装的,例如:

1. 对于indigo-desktop-full-wet.rosinstall来说:

$ wstool init -j8 src indigo-desktop-full-wet.rosinstall

2. indigo-desktop-wet.rosinstall

$ wstool init -j8 src indigo-desktop-wet.rosinstall

3. indigo-ros_comm_wet.rosinstall

$ wstool init -j8 src indigo-ros_comm-wet.rosinstall

解析依赖文件,这个要等待好长时间。

$ rosdep install --from-paths src --ignore-src --rosdistro indigo -y


        注意:这里这个命令容易出现缺少empy的错误,在这个网站:https://pypi.python.org/pypi/EmPy/3.1/ ,下一个,然后cd 到解压目录下运行以下命令即可。

		python setup.py install
除此之外,还会遇到一个问题就

		Error: You must `brew link libpng` before fltk can be installed
		ERROR: the following rosdeps failed to install
  		  homebrew: command [brew install fltk] failed
    这是说没办法安装fltk

运行

		brew install fltk
    提示说

	Error: You must `brew link libpng` before fltk can be installed
    于是手动link一下:

		brew link libpng
    然后说权限不够:

		Error: Could not symlink share/man/man3/libpng.3
		/usr/local/share/man/man3 is not writable.
    于是用以下命令改变权限:

		sudo chown -R $(whoami):admin /usr/local
    再次安装

		brew link libpng
    通过

                Linking /usr/local/Cellar/libpng/1.6.29... 18 symlinks created
    ok,然后我们就可以愉快的安装了,再次运行

  • $ rosdep install --from-paths src --ignore-src --rosdistro indigo -y
    经过长时间等待。。。。。中间输入3次密码

    然后又遇到一个qt5的问题说是

	qt5 is a keg-only and another version is linked to opt.
	Use `brew install --force` if you want to install this version
    运行以下命令安装

	brew install --force qt5
	brew link --force qt5

 接着运行build:

  • $ ./src/catkin/bin/catkin_make_isolated --install -DCMAKE_BUILD_TYPE=Release

然后遇到报错:class_loader 缺少poco库,运行下列命令安装poco

brew install poco

接着在运行build:

  • $ ./src/catkin/bin/catkin_make_isolated --install -DCMAKE_BUILD_TYPE=Release



参考文献:
http://answers.ros.org/question/110511/class_loader-poco-error/

http://wiki.ros.org/indigo/Installation/OSX/Homebrew/Source

https://github.com/mikepurvis/ros-install-osx/issues/63


你可能感兴趣的:(Mac OS 安装ROS indigo)