MoveIt! 教學套件 (moveit_tutorials
) 安裝與使用
moveit_tutorials
是官方的 MoveIt! 教學套件,它提供許多 運動規劃範例,適合學習如何控制機械臂、運動規劃、碰撞檢測等。
1️⃣ 安裝 MoveIt!
🔹 如果你的 ROS 版本是:
- ROS Noetic(Ubuntu 20.04)
- ROS Melodic(Ubuntu 18.04)
- ROS Kinetic(Ubuntu 16.04)
請執行:
MoveIt! 2(ROS 2 版本)的安裝方式不同,請參考 MoveIt! 2 安裝指南
📌 確認 MoveIt! 安裝成功
如果沒有錯誤,表示 MoveIt! 安裝成功。
2️⃣ 安裝 moveit_tutorials
moveit_tutorials
套件 官方未包含在 MoveIt! 的安裝中,你需要手動下載。
✅ 方法 1:使用 apt 安裝(適用於 ROS Noetic)
如果是 Melodic,請替換
noetic
為melodic
:
✅ 方法 2:從原始碼安裝(適用於所有 ROS 版本)
如果你需要修改教學範例或使用最新版本,請從原始碼安裝:
📌 確認安裝成功
應該會顯示 /home/your_user/catkin_ws/src/moveit_tutorials
3️⃣ 執行 MoveIt! 教學範例
✅ 1. 啟動 MoveIt! RViz 環境
這會開啟 Panda 機械臂 模擬環境,並顯示 MoveIt! 規劃界面。
✅ 2. 運行 Python 運動規劃教學
你可以執行 官方範例腳本 來測試機械臂的運動:
機械臂應該會開始移動!
如果出現錯誤,請先確保你執行:
4️⃣ 編寫自己的 MoveIt! 腳本
如果你想自己寫一個 Python 腳本來測試機械臂,請使用 moveit_commander
。
📌 建立 Python 腳本
📌 輸入以下程式碼
📌 執行腳本
機械臂應該會移動到 (0.4, 0.1, 0.3)
位置!
📌 總結
步驟 | 指令 |
---|---|
安裝 MoveIt! | sudo apt install ros-noetic-moveit |
安裝 MoveIt! 教學套件 | sudo apt install ros-noetic-moveit-tutorials |
從原始碼安裝 | git clone https://github.com/ros-planning/moveit_tutorials.git |
啟動 RViz MoveIt! 界面 | roslaunch moveit_tutorials demo.launch |
執行 Python 運動規劃教學 | rosrun moveit_tutorials move_group_python_interface_tutorial.py |
編寫 Python 腳本控制機械臂 | nano moveit_test.py |
🚀 這樣你就能成功安裝並運行 MoveIt! 教學範例了! 🎯
沒有留言:
張貼留言