# 在 ROS Kinetic 安裝 Ublox GPS 驅動 > 此文章將會引導讀者如何在 ROS Kinetic 中安裝 Ublox GPS 驅動程式 > [name=John @ 崑山科技大學 光達實驗室 KSU Eilidar Lab][time=Friday, May 1, 2024] > > > [ToC] ## 1. 安裝必要元件 1. 安裝基礎元件 ```bash sudo apt install ros-kinetic-catkin-virtualenv \ ros-kinetic-gps-common \ libgps-dev ``` 2. 下載必要套件並編譯 ```bash cd ~/catkin_ws/src git clone https://github.com/KumarRobotics/ublox git clone https://github.com/tilk/rtcm_msgs rm -rf ~/catkin_ws/src/ublox/ublox_msg_filters/ cd ~/catkin_ws/ catkin build source ~/catkin_ws/devel/setup.bash ``` ## 2. 編譯設定檔案 1. 找到 GPS 的 tty 位置,將 Ublox GPS 插入電腦,並執行指令:`dmesg --follow`  從上圖可知此裝置的位置在 `/dev/ttyACM0` 2. 複製範例設定檔案並將這個檔案一個名稱,這邊使用 `m8n_car.yaml` 作為範例 ```bash cp ~/catkin_ws/src/ublox/ublox_gps/config/m8u_rover.yaml ~/catkin_ws/src/ublox/ublox_gps/config/m8n_car.yaml ``` 3. 使用文字編輯軟體開啟新的設定檔,並將新的 GPS 裝置 tty 位置更新進去 ```bash gedit ~/catkin_ws/src/ublox/ublox_gps/config/m8n_car.yaml ``` 4. 將文字檔案中的 `device: /tty/XXX` 改成剛剛在終端機中看到的位置,這邊使用`/dev/ttyACM0` ## 3. 編輯 launch 檔案 1. 使用文字編輯軟體開啟 ublox_gps 中的 launch 檔案 ```bash gedit ~/catkin_ws/src/ublox/ublox_gps/launch/ublox_device.launch ``` 2. 將這這段字刪除: ```xml doc="name of param file, e.g. rover" ``` 取代成這段字: ```xml default="m8n_car" ``` 其中裡面的 `m8n_car` 就是輸入我們剛剛新創的設定檔案名稱 ## 4. 開啟 GPS 裝置的 tty 位置讀寫權限 <!-- * 從上面的步驟可知插入的 GPS 裝置位置是 ``/dev/ttyACM0`,輸入下面指令來開啟權限 ```bash sudo chmod 666 /dev/ttyACM0 ``` --> * 將使用者加入 `dialout` 群組即可使該使用者有讀寫的權限 ```bash sudo usermod -a -G dialout <使用者名稱> ``` * 若不知道使用者名稱可以使用指令 `whoami` 來查詢 ## 5. 開啟驅動程式 * 使用下面指令來執行 ublox GPS 驅動程式 ```bash roslaunch ublox_gps ublox_device.launch ``` * 開啟新終端機並執行下面指令來確認 topic 是否有被發布 ```bash rostopic list ``` 指令回傳如下圖:  * 使用下面指令可以看到 GPS 訊息 ```bash rostopic echo /ublox/fix ``` 指令回傳如下圖:  ###### tags: ROS, Kinetic, ROS Kinetic, Ublox, GPS
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up