1. 程式人生 > 其它 >ROS下如何使用moveit驅動UR5 gazebo模擬機械臂

ROS下如何使用moveit驅動UR5 gazebo模擬機械臂

在ubuntu 16.04下利用moveit 除錯ur5

環境:ROS Kinetic;ubuntu 16.04 64位版

安裝moveit

ROS Kinetic
Install Ubuntu Packages
Simply run:

sudo apt-get install ros-kinetic-moveit

1

Setup your environment

source /opt/ros/kinetic/setup.bash

1

參考檔案
Moveit安裝官方文件
安裝ur5的配置檔案

從GitHub的universal_robot專案的README.md檔案上,可以看到,再安裝高於indigo的版本時,需要從source中編譯。

Installation from Source
There are releases available for ROS Hydro and ROS Indigo. However, for the latest features and developments you might want to install from source.

First set up a catkin workspace (see this tutorials).
Then clone the repository into the src/ folder. It should look like /path/to/your/catkin_workspace/src/universal_robot.
Make sure to source the correct setup file according to your workspace hierarchy, then use catkin_make to compile.
根據檔案指示,首先將在ros-industrial/universal_robot專案中找到ur5的對應版本,這裡是選擇kinetic-devel
這裡寫圖片描述

將檔案儲存在~/catkin_ws/src裡,之後

這裡寫圖片描述

$ cd ~/catkin_ws
$ catkin_make

1
2

注:每次開啟新終端,除錯ur5時,先輸入下面語句(Don’t forget to source the correct setup shell files and use a new terminal for each command!):

$ . ~/catkin_ws/devel/setup.bash

1

UR5的配置檔案路徑為:~/catkin_ws/src/universal_robot-kinetic-devel/ur_description/urdf/
可以選擇其中的ur5_joint_limited_robot.urdf.xacro file,或者 ur5_robot.urdf.xacro 。

For the UR5, load either the ur5_robot.urdf.xacro or the ur5_joint_limited_robot.urdf.xacro file. The former sets the joint limits to their actual values (+-2pi for all joints), while the latter restricts that to half of that (+-pi). MoveIt (and/or some of its planners) don’t work too well with full 2pi joint limits, hence the joint limited variant of that file.
Import UR5 urdf to Moveit!原文連結

程式碼文件:
ros-industrial/universal_robot
除錯
除錯前出現的一個小問題

在我除錯的時候,出現了匯入ur5_joint_limited_robot.urdf.xacro時出現錯誤的問題,後來我重新執行了如下語句,匯入成功。

$ cd ~/catkin_ws
$ catkin_make

1
2

模擬

輸入下面命令,可以在 rviz 中模擬ur5下面三個命令,需要在三個不同終端中呼叫,同時在呼叫之前,需要分別重新輸入

$ . ~/catkin_ws/devel/setup.bash

1

roslaunch ur_gazebo ur5.launch limited:=true

roslaunch ur5_moveit_config ur5_moveit_planning_execution.launch sim:=true limited:=true

roslaunch ur5_moveit_config moveit_rviz.launch config:=true

1
2
3
4
5

在rivz中,規劃庫中有多種演算法,某一個規劃演算法可能會遇到failed,多試幾個,總有一個成功。

這裡寫圖片描述
實體聯調
使用ur_driver的問題

官方文件ros-industrial/universal_robot提供了一條測試文件

roslaunch ur_bringup ur5_bringup.launch robot_ip:=IP_OF_THE_ROBOT [reverse_port:=REVERSE_PORT]
rosrun ur_driver test_move.py

1
2

我在執行第二句rosrun ur_driver test_move.py時,發現程式卡在“Waiting for server…”這句。後來上網差原因,看資料顯示,可能是版本相容的問題。有人提出用
ur_modern_driver代替universal_robot。但是我從官網ur_modern_driver下載,按官網步驟,拷入~/catkin_ws/src資料夾下,執行catkin_make命令時,報錯。後來又去網上查原因,發現有人說是ur_modern_driver不支援ROS kinetic版本(作者說近期會對其進行改進),但是經過一些修改後可以使用。此處WangJIankun1992 說他將ur_modern_driver裡的 ur_hardware_interface.cpp,檔案中的 controller_it->hardware_interface改成 controller_it->type. 這樣可以保證執行成功。按此方法對檔案進行修改後,執行catkin_make可以編譯成功。
實際與ur5控制時,無法連結查了github上的註釋,說是目前對3.3.2.266還不支援(Support for UR3 version 3.3.2.266? #75)。很可惜我這臺ur5前段時間剛升到3.3。問題待解決。


Gazebo 與Rviz 的區別
Gazebo is the actual real world physics simulator that you will set up a world and simulate your robot moving around. Rviz is the visualization software, that will allow you to view that gazebo data (if you are simulating) or real world data (if you are not using gazebo, but a real robot).原文連結

列表內容

參考文件:

運動規劃 (Motion Planning): MoveIt! 與 OMPL
ROS下利用 moveit 控制gazebo模型並在rviz中顯示的探索總結
ur_description
MoveIt!教程
ur_driver(wiki.ros.org/ur_driver)
————————————————
版權宣告:本文為CSDN博主「jay&chuxu」的原創文章,遵循CC 4.0 BY-SA版權協議,轉載請附上原文出處連結及本宣告。
原文連結:https://blog.csdn.net/jayandchuxu/article/details/54693870