在ROS中操作UR5机械臂 仿真+真实操控

构建ROS中的UR5模型

  • 终端安装运动规划库

    sudo apt install ros-noetic-moveit

  • 创建工作空间并编译

    mkdir -p ~/ws_ur/src #~表示/home/目录

    cd ~/ws_ur

    catkin_make #若make失败,则改为 catkin_make -DPYTHON_EXECUTABLE=/usr/bin/python>

    source devel/setup.bash #在工作空间中,每打开一次终端都要进行一次source,直接sudo在~/.bashrc中加上一行source ~/ws_ur/devel/setup.bash,或者输入命令echo "source ~/ws_ur/devel/setup.bash" >> ~/.bashrc

  • 空间中github下载驱动

    git clone https://github.com/UniversalRobots/Universal_Robots_ROS_Driver.git src/Universal_Robots_ROS_Driver #驱动
    git clone -b calibration_devel https://github.com/fmauch/universal_robot.git src/fmauch_universal_robot #ur机器人模型
    git clone https://github.com/ros-industrial/ur_msgs.git src/ur_msgs #日志信息
    rosdep update
    rosdep install --from-paths src --ignore-src -y #src文件中有驱动更新时,需要rosdepc命令更新
    

    rosdepc为rosdep的国内版,可通过sudo apt install rosdepc安装,防止出现由于网络而导致的下载依赖失败

    需分别打开三个终端

  • 测试

    roslaunch ur_gazebo ur5_bringup.launch #打开Gazebo模型

    roslaunch ur5_moveit_config ur5_moveit_planning_execution.launch sim:=true #运动规划与执行

    roslaunch ur5_moveit_config moveit_rviz.launch config:=true #打开Rviz,拖动轨迹球进行规划

    1. 轨迹球打开:在planning group中设置为manipulator

    ​ 在global options>>fixed frame中设置为base

    1. add>>robot model+planning&execution
    2. plan查看轨迹,execution执行

    实际控制UR5

  • 机械臂连接网线,ip地址需与无线局域网在一个网段下

    ifconfig #显示主机ip地址以及路由器地址,路由器:192.168.31.180,由此设置UR5的ip地址为192.168.31.10

    sudo ifconfig enp0s31f6 192.168.52.1 netmask 255.255.255.0 #设置电脑端虚拟ip地址以及子网掩码,再次ifconfig查看是否更改完成(前三个数字不可以设置与无限网相同)

    ping 192.168.31.10 #查看是否可以ping通

  • 三个shell分别运行

    roslaunch ur_robot_driver ur5_bringup.launch limited:=true robot_ip:=192.168.31.10
    roslaunch ur5_moveit_config ur5_moveit_planning_execution.launch limited:=true
    roslaunch ur5_moveit_config moveit_rviz.launch config:=true
    

    在控制面板上点击为机器人编程 >> 第一次使用空程序 >> urcap >> external control >> ▶

    在rviz中调整位姿即可

    #若出现 could not get fresh data package from robot 的错误,重新在UR5操作面板上重新打开一个空程序即可。

参考资料

  • 4
    点赞
  • 27
    收藏
    觉得还不错? 一键收藏
  • 13
    评论
评论 13
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值