Linux教程網
Linux教程網
Linux教程網
您现在的位置: Linux教程網 >> UnixLinux >  >> Linux基礎 >> Linux技術

ROS Kinetic 第 16 篇:在 Ubuntu 16.04 上整合 MATLAB 2015b 與 ROS

要在 Ubuntu 16.04 上同時使用 MATLAB 2015b 與 ROS Kinetic,可以參考 MathWorks 官方的硬體支援頁與 ROS 入門範例。

參考資料:
https://cn.mathworks.com/hardware-support/robot-operating-system.html
https://cn.mathworks.com/help/robotics/examples/get-started-with-ros.html

一、安裝 MATLAB

先把 ISO 掛載上來再執行安裝程式:

~$ cd /media/
/media$ sudo mkdir dvdrom0
/media$ sudo mount /home/relaybot/下載/R2015b_glnxa64.iso /media/dvdrom0 -o loop
/media$ cd dvdrom0
/media/dvdrom0$ sudo ./install
ROS Kinetic 第 16 篇:在 Ubuntu 16.04 上整合 MATLAB 2015b 與 ROS ROS Kinetic 第 16 篇:在 Ubuntu 16.04 上整合 MATLAB 2015b 與 ROS ROS Kinetic 第 16 篇:在 Ubuntu 16.04 上整合 MATLAB 2015b 與 ROS ROS Kinetic 第 16 篇:在 Ubuntu 16.04 上整合 MATLAB 2015b 與 ROS ROS Kinetic 第 16 篇:在 Ubuntu 16.04 上整合 MATLAB 2015b 與 ROS

首次啟動的常見錯誤與修法

第一次使用時常會遇到函式庫找不到的問題,可以用軟連結補上:

~$ cd /usr/local/MATLAB/R2015b/sys/os/glnxa64/
/usr/local/MATLAB/R2015b/sys/os/glnxa64$ sudo ln -sf /usr/lib/x86_64-linux-gnu/libgfortran.so.3.0.0 libgfortran.so.3
/usr/local/MATLAB/R2015b/sys/os/glnxa64$ sudo ln -sf /usr/lib/x86_64-linux-gnu/libquadmath.so.0.0.0 libquadmath.so.0
/usr/local/MATLAB/R2015b/sys/os/glnxa64$ sudo ln -sf /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.21 libstdc++.so.6

若啟動時出現顯卡硬體無法辨識的錯誤,二選一即可:

~$ matlab -softwareopengl
~$ matlab -nodesktop

更多細節可參考:
https://cn.mathworks.com/matlabcentral/answers/242325-matlab-2015b-crashes-on-startup-on-kubuntu-15-04
https://askubuntu.com/questions/765455/how-to-run-matlab-2016a-with-nvidia-drivers-of-gtx-960-in-ubuntu-16-04/767231

二、讓 MATLAB 與 ROS 對話

官方說明:https://cn.mathworks.com/help/robotics/robot-operating-system-ros.html
中文範例:https://blog.csdn.net/zyh821351004/article/details/51124658

在 MATLAB 指令視窗中啟動與關閉 ROS:

>> rosinit
>> rosshutdown

啟動之後,還可以用手機 App 遙控小海龜(turtlesim)做初步驗證:

ROS Kinetic 第 16 篇:在 Ubuntu 16.04 上整合 MATLAB 2015b 與 ROS

更進階的用法請看官方範例:
https://cn.mathworks.com/help/robotics/examples/connect-to-a-ros-network.html

Copyright © Linux教程網 All Rights Reserved