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

posted @ 2021-11-29 15:14  feifanren  阅读(892)  评论(0编辑  收藏  举报