实时记录运动轨迹插件_ROS机械臂开发:MoveIt!中的潜规则

本篇文章介绍MoveIt!在实际开发中需要注意的一些潜规则,官方文档未提到但在实际工作中有用的一些技能。

一、圆弧轨迹规划

上一篇中介绍了直线插补,将waypoints用直线连接,而圆弧轨迹插补API是未提供的,实际中比如焊接是需要这样的轨迹的,我们自己需要实现。方法是用很多直线段模拟圆弧,取点越多越接近实际圆弧:

4789e77e8ff3

圆弧生成

直接看代码:

#include

#include

#include

#include

using namespace std;

int main(int argc, char **argv)

{

ros::init(argc, argv, "move_with_circle");

ros::AsyncSpinner spinner(1);

spinner.start();

moveit::planning_interface::MoveGroupInterface ur5("manipulator");

string eef_link = ur5.getEndEffector();

std::string reference_frame = "base_link";

ur5.setPoseReferenceFrame(reference_frame);

ur5.allowReplanning(true);

ur5.setGoalPositionTolerance(0.001);

ur5.setGoalOrientationTolerance(0.01);

ur5.setMaxAccelerationScalingFactor(0.8);

ur5.setMaxVelocityScalingFactor(0.8);

// 控制机械臂先回到初始化位置

ur5.setNamedTarget("home");

ur5.move();

sleep(1);

geometry_msgs::Pose target_pose;

target_pose.orientation.x = 0.70711;

target_pose.orientation.y = 0;

target_pose.orientation.z = 0;

target_pose.orientation.w = 0.70711;

target_pose.position.x = 0.070859;

target_pose.position.y = 0.36739;

target_pose.position.z = 0.84716;

ur5.setPoseTarget(target_pose);

ur5.move();

vector<:pose> waypoints;

waypoints.push_back(target_pose);

//在xy平面内生成一个圆周

double centerA = target_pose.position.x;

double centerB = target_pose.position.y;

double radius = 0.15;

for(double theta = 0.0; theta < M_PI*2; theta += 0.

  • 0
    点赞
  • 15
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值