其他分享
首页 > 其他分享> > ROS进阶——笛卡尔轨迹规划descartes

ROS进阶——笛卡尔轨迹规划descartes

作者:互联网

一、配置

在kinetic版本无法直接通过apt-get安装descartes,因此直接下载源码到工作空间内编译使用(可去掉descartes_tests)。

git clone https://github.com/ros-industrial-consortium/descartes.git

二、解析

2.1 descartes简介

  1. 官方说明
  1. 使用场景
  1. 测试说明

2.2 接口说明

  1. descartes_core
接口类说明
descartes_core::TrajectoryPt笛卡尔轨迹点
descartes_core::RobotModel笛卡尔规划机器人模型
descartes_core::PathPlannerBase笛卡尔规划器
  1. descartes_moveit
接口类说明
descartes_moveit::MoveitStateAdapter结合descartes和moveit
  1. descartes_planner
接口类说明
descartes_planner::DensePlanner dense_planner稠密求解器,DensePlanner takes a brute force approach to finding a sequence of joint solutions that defines an “optimum” path through a sequence of input descartes_core::TrajectoryPt’s. Optimum is defined as the path with minimal joint changes. It works by expanding all of the valid inverse kinematic solutions for every trajectory point passed in. Edges are added between every possible pair of solutions from contigous user trajectory points. Dijkstra’s algorithm is then used to find a path with minimal joint motion through the graph.
descartes_planner::SparsePlanner sparse_planner稀疏规划器,SparsePlanner attempts to optimize the process used by DensePlanner by not expanding every point. Instead a subset of the points are expanded and the planner attempts to use joint interpolation to find a satisfactory solution to the not-expanded points (thereby reducing the number of IK solutions required).
  1. descartes_trajectory
接口类说明
descartes_trajectory::JointTrajectoryPtRepresents a robot joint pose. It can accept tolerances for each joint
descartes_trajectory::CartTrajectoryPtDefines the position and orientation of the tool relative to a world coordinate frame. It can also apply tolerances for the relevant variables that determine the tool pose
descartes_trajectory::AxialSymmetricPExtends the CartTrajectoryPt by specifying a free axis of rotation for the tool. Useful whenever the orientation about the tool’s approach vector doesn’t have to be defined
  1. descartes_utilities
接口类说明
descartes_utilities::toRosJointPoints笛卡尔规划结果转化为标准ROS关节信息

三、应用

3.1 实现流程

初始化planner 生成轨迹 设置初始姿态并加载数据到descartes_trajectory 加载数据到descartes_core::TrajectoryPt 调用planner规划 获取数据并转换到ROS数据格式

3.2 相关函数

descartes_core::TrajectoryPtPtr makeCartesianPoint(const Eigen::Isometry3d &pose) {
  using namespace descartes_core;
  using namespace descartes_trajectory;
  return TrajectoryPtPtr(new CartTrajectoryPt(TolerancedFrame(pose)));
}
trajectory_msgs::JointTrajectory toROSJointTrajectory(
    const TrajectoryVec &trajectory, const descartes_core::RobotModel &model,
    const std::vector<std::string> &joint_names, double time_delay) {

  // Fill out information about our trajectory
  trajectory_msgs::JointTrajectory result;
  result.header.stamp = ros::Time::now();
  result.header.frame_id = "base_link";
  result.joint_names = joint_names;

  // For keeping track of time-so-far in the trajectory
  double time_offset = 0.0;
  // Loop through the trajectory
  int len = trajectory.size();
  for (int i = 0; i < len; i++) {
    // Find nominal joint solution at this point
    std::vector<double> joints;
    trajectory[i].get()->getNominalJointPose(std::vector<double>(), model,
                                             joints);

    // Fill out a ROS trajectory point
    trajectory_msgs::JointTrajectoryPoint pt;
    pt.positions = joints;
    // velocity, acceleration, and effort are given dummy values
    // we'll let the controller figure them out
    pt.velocities.resize(joints.size(), 0.0);
    pt.accelerations.resize(joints.size(), 0.0);
    pt.effort.resize(joints.size(), 0.0);
    // set the time into the trajectory
    pt.time_from_start = ros::Duration(time_offset);
    // increment time
    time_offset += time_delay;

    result.points.push_back(pt);
  }

  return result;
}

参考

ros-descartes

ros-industrial-consortium-descartes

descartes_node

ROS 教程6 工业机器人实战 UR5机械臂 movieit仿真 轨迹规划 Descartes 笛卡尔 轨迹规划

descartes_tutorials

moveit_cartesian_plan_plugin(基于descartes构建的rviz规划插件)

标签:descartes,进阶,trajectory,joint,轨迹,time,ROS,规划
来源: https://blog.csdn.net/Kalenee/article/details/103755381