<style> .red {color: red;} </style> # MoveIt! package ###### tags: `ros` `moveit` `robot simulator` `vsclab` :::spoiler Outline [toc] ::: # Installation * [MoveIt 2 Source Build - Linux](https://moveit.ros.org/install-moveit2/source/) > 缺點:編譯時間過長 * [MoveIt 2 Binary Install - Linux](https://moveit.ros.org/install-moveit2/binary/) * [Doc: Getting Start](https://moveit.picknik.ai/humble/doc/tutorials/getting_started/getting_started.html) :::warning * 2022/9/25: MoveIt-humble 的 binary 版本尚未推出,因此降回使用 foxy 版,編譯速度較快 ::: # Demo Program * [Doc: MoveIt Quickstart in RViz](https://moveit.picknik.ai/foxy/doc/quickstart_in_rviz/quickstart_in_rviz_tutorial.html#) * [URDF and SRDF Introduction](https://moveit.picknik.ai/foxy/doc/urdf_srdf/urdf_srdf_tutorial.html#urdf-and-srdf) # 匯入台達機械手臂 URDF 至 MoveIt2! ## 環境安裝 :::warning 由於 ROS 2 foxy 沒有 "MoveIt Setup Assistant",因此使用 [MoveIt 1 Noetic](https://ros-planning.github.io/moveit_tutorials/doc/getting_started/getting_started.html) (需先安裝 ROS 1 Noetic) ::: * [ROS 1 Noetic Installation](http://wiki.ros.org/noetic/Installation/Ubuntu) * [MoveIt 1 Noetic - Getting Start](https://ros-planning.github.io/moveit_tutorials/doc/getting_started/getting_started.html) * [MoveIt 1 Noetic - MoveIt Setup Assistant](https://ros-planning.github.io/moveit_tutorials/doc/setup_assistant/setup_assistant_tutorial.html) ## tf 套件介紹 * [ROS 2 foxy - Tf2](https://docs.ros.org/en/foxy/Tutorials/Intermediate/Tf2/Tf2-Main.html) ## URDF 介紹 * [ROS wiki - URDF Tutorials](https://wiki.ros.org/urdf/Tutorials) * [ROS 2 foxy - URDF Tutorials](https://docs.ros.org/en/foxy/Tutorials/Intermediate/URDF/URDF-Main.html) ## Create MoveIt Configuration Package ### [2022/10/19 - ...] ROS 1 Noetic 1. [Exporting URDF from SOLIDWORKS and Simulate the Robotic Arm in ROS using Moveit, Gazebo and Raviz with Inverse Kinamatics - YouTube Playlist](https://youtube.com/playlist?list=PLeEzO_sX5H6TBD6EMGgV-qdhzxPY19m12) * 利用 SOLIDWORKS 匯出 URDF package * 利用 MoveIt Assistance 匯出 moveit package :::spoiler 其他教學 * [From SolidWorks to URDF & MoveIt! (Part 3 - MoveIt! Setup)](https://youtu.be/IS3JIV45rh0) ::: :::danger * **[roslaunch ERROR]** `Could not load controller 'joint_state_controller' because controller type 'joint_state_controller/JointStateController' does not exist.` * **Solution** `$ sudo apt-get install ros-noetic-joint-state-controller ros-noetic-joint-trajectory-controller` * **[Gazebo]** `[ERROR] [1667645588.171038399, 0.126000000]: No p gain specified for pid. Namespace:gazebo_ros_control/pid_gains/Joint1` * **[Solution](https://zhangtianhao.blog.csdn.net/article/details/119046043?spm=1001.2101.3001.6650.4&utm_medium=distribute.pc_relevant.none-task-blog-2%7Edefault%7ECTRLIST%7ERate-4-119046043-blog-111143282.pc_relevant_recovery_v2&depth_1-utm_source=distribute.pc_relevant.none-task-blog-2%7Edefault%7ECTRLIST%7ERate-4-119046043-blog-111143282.pc_relevant_recovery_v2&utm_relevant_index=5)** ::: :::warning * **[URDF]** * 如何將關節旋轉反向? [URDF/XML/joint - ROS Wiki](http://wiki.ros.org/urdf/XML/joint) > 將 urdf/joint/<axis> 之數值變號,即可將關節旋轉反向。 * **[Rviz]** * [如何載入/儲存Rviz設定檔?](https://answers.ros.org/question/11845/rviz-configuration-file-format/?answer=17518#post-id-17518) ```xml <launch> <node name="rviz" pkg="rviz" type="rviz" args="-d $(find delta_model)/rviz/urdf.rviz" /> </launch> ``` * **[Gazebo]** * [Why does my robot shake / wobble?](https://answers.gazebosim.org//question/16700/why-does-my-robot-shake-wobble/) * 調高 joint/limit/effort,數值參考 [ur10](https://github1s.com/PositronicsLab/reveal_packages/blob/master/industrial_arm/scenario/models/urdf/ur10/ur10.urdf#L52) ::: --- #### 機械手臂模擬程式執行流程(ROS 1 Noetic) ```shell $ cd ~/delta_ws # 進入工作目錄 $ catkin_make # 編譯 $ source devel/setup.bash # source the overlay # 預覽台達機械手臂(無物理引擎) $ roslaunch delta_model display.launch $ roslaunch moveit_delta_sim demo_gazebo.launch # 模擬台達機械手臂運動規劃(含物理引擎+控制器) $ roslaunch moveit_delta_sim full_delta_sim.launch ``` ### [2022/11/16 - ...] ROS 2 foxy (移至Humble開發) :::spoiler #### 機械手臂模擬程式執行流程(ROS 2 foxy) ```shell # 進入工作目錄 $ colcon_cd delta_ros2_ws # by colcon_cd $ cd ~/delta_ros2_ws # manually # 編譯 $ colcon build # 載入套件環境 $ source install/setup.bash # 預覽台達機械手臂(無物理引擎) $ ros2 launch src/delta_model/arm.launch.py # 模擬台達機械手臂運動規劃(含物理引擎+控制器) $ roslaunch moveit_delta_sim full_delta_sim.launch ``` ::: :::spoiler URDF Launcher 開發流程 1. 參考以下官方範例來撰寫 [ROS 2 Launch File] (https://docs.ros.org/en/foxy/Tutorials/Intermediate/Launch/Creating-Launch-Files.html) * [urdf_tutorial / launch / display.launch.py](https://github.com/ros/urdf_tutorial/blob/ros2/launch/display.launch.py) * [urdf_tutorial / launch / display.launch.py](https://github.com/ros/urdf_tutorial/blob/ros2/launch/display.launch.py) 2. 將URDF路徑參數指向DRV70L ::: :::spoiler MoveIt2 Launcher 開發流程 * [GitHub Issue: Custom URDF File to use with Moveit2](https://github.com/UniversalRobots/Universal_Robots_ROS2_Driver/issues/135#issuecomment-872391860) ::: ### [2023/01/05 - ...] ROS 2 humble #### 機械手臂模擬程式執行流程(ROS 2 humble) ``` # 進入工作目錄 $ colcon_cd delta_ros2_ws # by colcon_cd $ cd ~/delta_ros2_ws # manually # 編譯 $ colcon build # 載入套件環境 $ source ~/delta_ros2_ws/install/setup.bash $ source ~/ws_moveit2/install/setup.bash # 預覽台達機械手臂(無物理引擎) $ ros2 launch delta_model display.launch.py # (Terminal 1) 開啟台達機械手臂 MoveIt 環境 $ ros2 launch moveit2_delta demo.launch.py rviz_config:="src/moveit2_delta/rviz/moveit.rviz" # (Terminal 2) 開啟 MoveIt 命令控制程式 $ ros2 run hello_moveit hello_moveit_delta $ ros2 launch hello_moveit collision_demo.launch.py # 模擬台達機械手臂運動規劃(含物理引擎+控制器) # $ roslaunch moveit_delta_sim full_delta_sim.launch ``` :::spoiler MoveIt2 (humble) Launcher 開發流程 #### Step 1. 參考以下範例修改 delta_model 的`CMakeLists.txt`與`package.xml` * [elite_robot_ros2 - GitHub](https://github.com/fishros/elite_robot_ros2/tree/main/src/elite_moveit2/elite_ec66_moveit_config) #### Step 2. 編譯 URDF 檔,打開 `moveit_setup_assistant` ```shell $ cd ~/delta_ros2_ws $ colcon build $ source install/setup.bash $ ros2 run moveit_setup_assistant moveit_setup_assistant ``` #### Step 3. Moveit Setup Assistant * [Moveit Setup Assistant 設定教學](https://blog.csdn.net/qq_27865227/article/details/126896767) * Package 輸出位置 `/home/deltabot/delta_ros2_ws/src/moveit2_delta` #### Step 4. 編譯並開啟範例程式 ```shell $ cd ~/delta_ros2_ws $ colcon build $ source install/setup.bash $ ros2 launch moveit2_delta demo.launch.py ``` ::: :::spoiler 參考教學 * [动手学Moveit2 | 运行配置好的机械臂功能demo](https://blog.csdn.net/qq_27865227/article/details/126896767) * [Your First C++ MoveIt Project](https://moveit.picknik.ai/humble/doc/tutorials/your_first_project/your_first_project.html) * [Visualizing In RViz](https://moveit.picknik.ai/humble/doc/tutorials/visualizing_in_rviz/visualizing_in_rviz.html) * [use_sim_time - GitHub](https://github.com/ros-planning/moveit2/issues/1480#issuecomment-1352820099) ::: #### 使用 MoveIt C++ API 建立軌跡規劃 ##### API Docs: * [LINK 1](http://docs.ros.org/en/jade/api/moveit_ros_planning_interface/html/classmoveit_1_1planning__interface_1_1MoveGroup.html) :::spoiler 其他教學 * [ROS Moveit範例程式1 - iT 邦幫忙::一起幫忙解決難題,拯救 IT 人的一天](https://ithelp.ithome.com.tw/articles/10255030) * [可解決 ctrl-c 無法退出問題 - Integrating launch files into ROS 2 packages](https://docs.ros.org/en/humble/Tutorials/Intermediate/Launch/Launch-system.html#creating-the-structure-to-hold-launch-files) * [如何儲存軌跡資訊](https://answers.ros.org/question/305133/trajectory-multidof-to-file/) ::: :::warning * `config/*_planning.yaml` 記得修改 Joint Group 名稱,才能載入 move_group_node, rviz2_node ::: --- ## ROS control/controller * [ros_control - ROS Wiki](http://wiki.ros.org/ros_control) * [ROS探索总结(三十一)——ros_control - 古月居](https://www.guyuehome.com/890) ``` # List Controller Types $ rosservice call controller_manager/list_controller_types # Show Pos, Vel of joints $ rostopic echo /joint_states ``` :::danger TODO: 1. Gazebo模擬震顫問題 2. Gazebo機械手臂顯示問題 ::: ## MoveIt!/Planners * [Planners Available in MoveIt](https://moveit.ros.org/documentation/planners/) ## Self-Collision Checking Results ![](https://i.imgur.com/V8DdOZ9.png) ![](https://i.imgur.com/nGkcYiN.png) ![](https://i.imgur.com/lDi3LMW.png)