注册 登录
电子工程世界-论坛 返回首页 EEWORLD首页 频道 EE大学堂 下载中心 Datasheet 专题
LitchiCheng的个人空间 https://home.eeworld.com.cn/space-uid-1003127.html [收藏] [复制] [分享] [RSS]
日志

Panda换成SO-Arm100机械臂,代码仅换一行,末端固定位姿一样控制

已有 66 次阅读2025-3-13 23:03 |个人分类:ROS2

 

 

视频链接:

仓库代码:GitHub - LitchiCheng/ros2_package

就换一行,我们打开《一文搞定!ROS2 中用 MoveIt2 精准操控 Panda 机械臂末端至固定位姿》中写的Package,将原来的这行

moveit::planning_interface::MoveGroupInterface move_group(node, "panda-arms");

改成如下即可

moveit::planning_interface::MoveGroupInterface move_group(node, "so-arm100-groups");

控也能控,但Z的位置反转了,增加一个变换矩阵进行反转即可

 

    // 定义转换矩阵
    Eigen::Matrix3d transform_matrix;
    transform_matrix << 1, 0, 0,
                        0, 1, 0,
                        0, 0, -1;
    // 将位置向量转换为Eigen向量
    Eigen::Vector3d original_position(target_pose.position.x, target_pose.position.y, target_pose.position.z);
    // 进行矩阵乘法
    Eigen::Vector3d new_position = transform_matrix * original_position;
    // 更新目标位置
    target_pose.position.x = new_position(0);
    target_pose.position.y = new_position(1);
    target_pose.position.z = new_position(2);

先运行so-arm100的moveit场景

source install/setup.bash 
ros2 launch so_arm100_moveit demo.lanuch.py

在运行控制位姿的程序,这里我们Package名称不变,还是之前的Panda,固定位姿

target_pose.position.x = 0.2;
target_pose.position.y = 0.1;
target_pose.position.z = 0.1;
source install/setup.bash 
ros2 run panda_moveit_controller panda_moveit_control

 

 

 

 

 

 

 

本文来自论坛,点击查看完整帖子内容。

评论 (0 个评论)

facelist doodle 涂鸦板

您需要登录后才可以评论 登录 | 注册

热门文章