ROS(十四): JAKA-minicobo在ROS中的Rviz、Gazebo使用

文章讲述了在ROSMelodic环境下使用Moveit时遇到的常见问题,如依赖包缺失、CMake配置错误等,提供了详细的解决步骤,包括apt安装包、设置终端环境和运行机器人,以及Moveit与Gazebo、真实机器人联合使用的配置和问题处理。

1、catkin_make

(1)报错:Could not find a package configuration file provided by "moveit msgs" withany of the following names:
moveit msgsConfig.cmakemoveit msgs-config.cmake
Add the installation prefix of "moveit msgs" to CMAKE PREFIX PATH or set"moveit msgs DIR" to a directory containing one of the above files. If"moveit msgs" provides a separate development package or sDk, be sure ithas been installed.all stack (most recent call first):jaka driver/CMakeLists.txt:10 (find package)

解决:

sudo apt install ros-melodic-moveit-msgs

(2)报错:Could not find a package configuration file provided by"moveit ros planning interface" with any of the following names:
moveit ros planning interfaceConfig.cmakemoveit ros planning interface-config.cmake
nstallation prefix of "moveit ros planning interface" to PATH or set "moveit ros_planning_interface DIR" to a directorycontaining one of the above files. If "moveit ros planning interface'provides a separate development package or sDk, be sure it has beeninstalled.all stack (most recent call first):jaka planner/CMakeLists.txt:10 (find package)

解决:

sudo apt install ros-melodic-moveit-ros-planning-interface

(3)报错:

解决:

找到上图框住的文件位置,打开后

复制后打开上一层的CMakeLists.txt

插入进去

(4)报错:

解决:

sudo apt install ros-melodic-moveit-visual-tools

再次catkin_make:

2、设置终端环境

       在 ROS 中,每次打开一个新的终端窗口,都需要运行"source devel/setup.bash"命令来设置正确的环境变量,当开启多个终端窗口时有时会忘记添加环境变量从而导致某些错误的发生。为了解决这个问题,可以按照以下方法进行设置,以便在每次打开终端时自动加载ROS 工作空间。

(1)在bash配置文件末尾添加以下信息,用来自动加载ROS工作空间,终端输入:

echo "source ~/xxx/devel/setup.sh" >> ~/.bashrc

注意:xxx是ros工作空间名称,这里我的工作空间存放在home目录下,名称为jaka_robot_v2.2, 所以输入echo "source ~/jaka_robot/jaka_robot_v2.2/devel/setup.sh" >> ~/.bashrc,若是存放在其他位置注意修改路径。

(2)使配置生效,终端输入:

source ~/.bashrc

(3)确认是否写入成功,终端输入:

gedit ~/.bashrc

在打开的文件中看到如下最后一行则说明写入成功:

(4)重新编译,终端输入:

catkin_make

       之后每次新建终端就不再需要通过source ./devel/setup.bash来添加环境变量了。注意:如果没有进行进行该设置,下面的操作每次 打开一个终端都需要通过“source ./devel/setup.bash”命令来添加环境变量。

3、运行机器人

(1)启动 robot_start_launch.launch 文件。在工作空间(jaka_robot_v2.2)右键打开一个终端,启动 jaka_driver 服务端,通过 ros 命令传参告知服务端机器人 IP:

roslaunch jaka_ros_driver start.launch ip:=10.5.5.100

注意:ip:=xxx,xxx 为机器人 IP 地址,必填参数,否则连接不到机器人会报错。

4、Moveit和Gazebo联合使用

       实现功能:启动Rviz和Gazebo,在Rviz中规划路径并执行,在Gazebo中的机器人仿真模型会移动到相应位置。具体操作步骤为:

(1)启动 minicobo的demo_gazebo.launch文件同时启动Rviz和Gazebo。若要启动其它型号机器人修改输入命令为相应moveit配置功能包(jaka_xx_moveit_config)即可。

roslaunch jaka_minicobo_moveit_config demo_gazebo.launch

报错:[ERROR] [1694593101.104167921, 0.414000000]: Could not load controller 'jaka_minicobo_controller' because controller type 'position_controllers/JointTrajectoryController' does not exist.

解决:

sudo apt-get install ros-melodic-joint-trajectory-controller

报错:PluginlibFactory: The plugin for class 'moveit_rviz_plugin/MotionPlanning' failed to load.

解决:(原因 :缺少moveit rviz中运行的功能包)

sudo apt-get install ros-melodic-moveit-ros-visualization

报错:No planning plugin loaded. Cannot plan.

解决:

sudo apt install ros-melodic-moveit

(2)原神启动:

roslaunch jaka_minicobo_moveit_config demo_gazebo.launch

注意:启动 demo_gazebo.launch 文件会出现报错“No p gain specified for pid.”,该报错是由于我们 Moveit 设置使用的控制器是位置控制器,pid 不需要设置,就会存在这个报错,但不会影响使用。

5、Moveit和真实机器人联合使用

实现功能:启动Moveit服务端及RVIZ,RVIZ规划路径,真实机械臂会移动到相应位置。

前提条件:jaka_driver 服务端和Moveit服务端不能同时启动,所以启动moveit服务端之前确认 jaka_driver服务端已经关闭(即未启动 robot_start_launch.launch)。

具体操作步骤为:

(1)启动 moveit_server.launch 文件(Moveit 服务端)。启动  moveit 服务端时通过  ros 命令传参告知服务端机器人型号及 IP。新建终端,并输入:

roslaunch jaka_planner moveit_server.launch ip:=10.5.5.100  model:=minicobo

注意:ip:=xxx 中,xxx 表示机器人IP地址。model:=xxx 中,xxx 表示各机器人型号,均为小写,例如:zu3、minicobo、pro16。

(2)另外新建一个终端,启动  demo.launch 文件(Moveit 客户端)。

roslaunch jaka_minicobo_moveit_config demo.launch

【资源说明】 基于ROS的手眼标定程序包源码(c和c++)+项目使用说明.zip 包含基础标定程序包,提供多组机器臂工具坐标和Marker坐标即可完成标定 - 包含JAKA、AUBO机械臂标定程序 - 本程序在`ros kinetic melodic`平台测试通过 >本程序包目前仅针对眼在手上的标定,通过输入两组以上的机械臂姿态信息(x,y,z,rx,ry,rz)和装在机械手上的相机所识别的标志物的姿态信息,经过程序计算可输出,机械臂末端和相机之间的坐标变换矩阵。 ```mermaid graph LR A[机械臂位姿] -->C[手眼标定] B[相机中标定板位姿] -->C C --> F[末端与相机位姿] ``` ## 使用指南 ### 1、基础使用 基础使用是在得到多组机械臂位姿与机械臂末端相机位姿之后直接使用本程序进行计算机械臂末端与相机之间的位姿关系。 - 机械臂位姿可以通过示教器或者SDK进行获取 - 相机中标定板位姿我们可以通过ArUco或者ArTookit等工具获得,可以参考这里。 > 我们使用一般读到的`(X,Y,Z,RX,RY,RZ)`六个数据表示 #### 安装测试 1. 下载编译 ``` git clone http://10.55.16.230/sangxin/handeye-calib.git cd handeye-calib catkin_make or catkin build ``` 2. 修改base_hand_on_eye_calib.launch文件中,base_handeye_data参数为从机械臂位姿和标定板位姿所在的配置文件所在的绝对目录,可以使用launch文件的`find`。 ``` <launch> <!-- <arg name="base_handeye_data" default="The file path of handeye data." /> --> <arg name="base_handeye_data" default="$(find handeye-calib)/config/base_hand_on_eye_test_data.csv" /> <node pkg="handeye-calib" type="base_hand_on_eye_calib.py" name="base_hand_on_eye_calib" output="screen" > <param name="base_handeye_data" value="$(arg base_handeye_data)" /> </node> </launch> ``` 3. 运行程序 ``` source devel/setup.bash roslaunch handeye-calib base_hand_on_eye_calib.launch ``` 4. 查看结果 程序会根据配置文件中的坐标进行计算,最终输出如下数据(单位毫米,弧度制): 数据包含不同算法下计算结果,以及计算结果的标准差和方差等数据。 【备注】 1、该资源内项目代码都经过测试运行成功,功能ok的情况下才上传的,请放心下载使用! 2、本项目适合计算机相关专业(如计科、人工智能、通信工程、自动化、电子信息等)的在校学生、老师或者企业员工下载使用,也适合小白学习进阶,当然也可作为毕设项目、课程设计、作业、项目初期立项演示等。 3、如果基础还行,也可在此代码基础上进行修改,以实现其他功能,也可直接用于毕设、课设、作业等。 欢迎下载,沟通交流,互相学习,共同进步!
评论 8
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

宸静

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值