JAKA robot与D435相机连接使用及RVIZ仿真简单操作!

老规矩先创建一个新的虚拟机
这里就暂且叫做“m2"吧!

导入“Jaka_ros_driver_cpp”文件包

手眼标定整体流程导入包如下

handeye-calib: 基于ROS的手眼标定程序,支持眼在手上,眼在手外。提供完整文档。欢迎关注公众号鱼香ROS。 (gitee.com)

------------------------------------------------------------------

1、18.04版本乌班图下安装ROS(1,3,7)

小鱼的一键安装系列 | 鱼香ROS (fishros.org.cn)

2、安装相机驱动相关

Ubuntu su认证失败-阿里云开发者社区 (aliyun.com) :root权限

Intel RealSense D435i:简介、安装与使用(ROS、Python) (zhaoxuhui.top)

第四弹 Ubuntu18.04下ROS安装的若干问题及解决办法_gpg: 从公钥服务器接收失败:无数据_是刃小木啦~的博客-CSDN博客

解决E: 仓库 “http://realsense-hw-public.s3.amazonaws.com/Debian/apt-repo bionic InRelease” 没有数字签名问题_ubuntu没有数字签名_sagima_sdu的博客-CSDN博客

上述安装完成进行测试时会出现 

 需要我们安装相机驱动,安装教程如下:

sudo apt-get install ros-melodic-usb-cam

ROS(十一):ubuntu调用摄像头_ubuntu打开摄像头_宸静的博客-CSDN博客

安装完成相机驱动后,下载Realsense SDK源代码

镜子 / 智能感知 / 实感-ROS ·吉特代码 (gitcode.net)

mkdir -p ~/catkin_ws/src
cd ~/catkin_ws/src/
git clone https://github.com/IntelRealSense/realsense-ros.git
cd realsense-ros/
git checkout `git tag | sort -V | grep -P "^2.\d+\.\d+" | tail -1`
cd ..
echo "source ~/catkin_ws/devel/setup.bash" >> ~/.bashrc
source ~/.bashrcw
完成后进入catkin_ws终端catkin_make,若出现以下情况

sudo apt install ros-melodic-ddynamic-reconfigure

除了上述18.04安装relsense的方法外,还可以使用下述方法二进行安装: 

Ubuntu 18.04 ———(Intel RealSense D435i)安装相机的驱动librealsense + realsense-ros_ubuntu安装realsense相机驱动_@曾记否的博客-CSDN博客

3、配置相机与Aruco

基于ROS的机械臂手眼标定-使用JAKA机械臂自动标定_jaka ros包_鱼香ROS的博客-CSDN博客

    <arg name="enable_depth" value="ture" />

    <arg name="markerId"        default="582"/>

配置src/handeye-calib/launch/aruco/aruco_start_usb_cam.launch文件

配置完成运行

source devel/setup.bash
roslaunch handeye-calib aruco_start_usb_cam.launch

4、配置机械臂话题数据

  • 眼在手外修改src/handeye-calib/launch/online/online_hand_to_eye_calib.launch

  • 眼在手上修改src/handeye-calib/launch/online/online_hand_on_eye_calib.launch

    <arg   name="arm_pose_topic"   default="/robot_driver/tool_point" />

运行在线标定:

source devel/setup.bash
roslaunch handeye-calib online_hand_to_eye_calib.launch

5、运行整体手动标定

JAKA+aruco+realsense+眼在手外的手眼标定_drivenzyw的博客-CSDN博客

-------------------------------------------------------分割------------------------------------------------

相关问题及解决方案:

【1】缺少‘numpy’包

1、sudo apt install python3-pip  :先安装python3版本,安装前也可以输入 python - -version查看一下当前版本

2、python3 -m pip install --upgrade pip
      pip3 install numpy  -i https://pypi.tuna.tsinghua.edu.cn/simple :使用替换源

【2】RLException:路径报错

【解决问题】RLException: [xx.launch] is neither a launch file in package [x] nor is [x] a launch file name_rlexception: [demo.launch] is neither a launch fil_东北大学生的博客-CSDN博客 【3】缺少‘transforms3d’包

 pip3 install transforms3d -i https://pypi.tuna.tsinghua.edu.cn/simple

【4】缺少‘cv2’包

pip3 install --upgrade pip  :为了防止因为pip版本较旧引起干扰,首先运行

pip3 install opencv-python -i https://pypi.tuna.tsinghua.edu.cn/simple --verbose

【5】缺少‘tabulate’包

pip3 install tabulate -i https://pypi.tuna.tsinghua.edu.cn/simple --verbose

【6】是找不到realsense2_camera包

echo "source ~/catkin_ws/devel/setup.bash" >> ~/.bashrc
source ~/.bashrc

【7】RLException路径报错:

gedit ~/.bashrc
source ~/Jaka-Minicobo-Sim-Env-master/devel/setup.bash
export ROS_PACKAGE_PATH=${ROS_PACKAGE_PATH}:~/Jaka-Minicobo-Sim-Env-master/

source ~/.bashrc
echo $ROS_PACKAGE_PATH

【8】运行机器人通讯接口start.launch 编译catkin_make报错:

再来一次catkin_make

【9】aruco_ros报错:

【10】安装cv2报错:ImportError: No module named skbuild

pip3 install scikit-build -i https://pypi.tuna.tsinghua.edu.cn/simple --verbose

【11】缺少.h头文件

catkin_make -DCATKIN_WHITELIST_PACKAGES=" 你的包名"

-------------------------------------------------------分割-------------------------------------------------

运行标定:

JAKA+aruco+realsense+眼在手外的手眼标定_drivenzyw的博客-CSDN博客

source develop/setup.bash
//打开机器人的驱动
roslaunch jaka_ros_driver start.launch

source develop/setup.bash
//打开相机
roslaunch handeye-calib aruco_start_realsense_sdk.launch 

source develop/setup.bash
//打开标定程序
roslaunch handeye-calib online_hand_to_eye_calib.launch

//查询话题类型,话题名字记得改哦
rostopic info /robot_driver/tool_point
//查询话题内容
rostopic echo /robot_driver/tool_point
 ----------------------------------------------------------完结撒花--------------------------------------------------------

  • 1
    点赞
  • 8
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
以下是基于海康相机jaka zu 3机械臂实现相机标定和手眼标定的Python代码: 相机标定: ```python import cv2 import numpy as np # 定义标定板的规格 pattern_size = (7, 5) square_size = 25 # mm # 获取标定板角点的坐标 object_points = np.zeros((np.prod(pattern_size), 3), dtype=np.float32) object_points[:, :2] = np.indices(pattern_size).T.reshape(-1, 2) object_points *= square_size # 设置摄像头参数 camera_matrix = np.eye(3) dist_coeffs = np.zeros((4, 1)) # 获取标定板图像 image_files = ['image_1.jpg', 'image_2.jpg', 'image_3.jpg'] image_points = [] for file in image_files: img = cv2.imread(file) gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY) # 检测标定板角点 ret, corners = cv2.findChessboardCorners(gray, pattern_size, None) # 如果检测成功,添加角点坐标 if ret: image_points.append(corners) cv2.drawChessboardCorners(img, pattern_size, corners, ret) cv2.imshow('image', img) cv2.waitKey(500) # 进行相机标定 ret, camera_matrix, dist_coeffs, rvecs, tvecs = cv2.calibrateCamera( object_points, image_points, gray.shape[::-1], None, None) print('相机内参矩阵:\n', camera_matrix) print('畸变系数:\n', dist_coeffs) ``` 手眼标定: ```python import numpy as np import cv2 from jaka_sdk import * # 定义标定板的规格 pattern_size = (7, 5) square_size = 25 # mm # 获取标定板角点的坐标 object_points = np.zeros((np.prod(pattern_size), 3), dtype=np.float32) object_points[:, :2] = np.indices(pattern_size).T.reshape(-1, 2) object_points *= square_size # 设置相机和机械臂的变换关系 camera_to_base = np.array([ [0.707, 0.000, 0.707, 100], [0.000, 1.000, 0.000, 200], [-0.707, 0.000, 0.707, 300], [0.000, 0.000, 0.000, 1.000] ]) tool_to_flange = np.array([ [0.000, -1.000, 0.000, 0], [0.000, 0.000, -1.000, 0], [1.000, 0.000, 0.000, 100], [0.000, 0.000, 0.000, 1.000] ]) # 获取标定板图像和机械臂末端位置 image_files = ['image_1.jpg', 'image_2.jpg', 'image_3.jpg'] end_effector_poses = [] for file in image_files: img = cv2.imread(file) gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY) # 检测标定板角点 ret, corners = cv2.findChessboardCorners(gray, pattern_size, None) # 如果检测成功,添加角点坐标和机械臂末端位置 if ret: rvec, tvec = cv2.solvePnP(object_points, corners, camera_matrix, dist_coeffs) end_effector_poses.append(JakaRobot.get_forward_kinematics(tool_to_flange, rvec, tvec)) # 进行手眼标定 camera_to_end_effector = np.zeros((4, 4)) for i in range(len(end_effector_poses) - 1): A = np.linalg.inv(end_effector_poses[i]) B = end_effector_poses[i + 1] C = np.linalg.inv(camera_to_base) camera_to_end_effector += np.dot(np.dot(C, B), A) camera_to_end_effector /= len(end_effector_poses) - 1 print('相机到机械臂末端的变换矩阵:\n', camera_to_end_effector) ```
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值