• 欢迎访问开心洋葱网站,在线教程,推荐使用最新版火狐浏览器和Chrome浏览器访问本网站,欢迎加入开心洋葱 QQ群
  • 为方便开心洋葱网用户,开心洋葱官网已经开启复制功能!
  • 欢迎访问开心洋葱网站,手机也能访问哦~欢迎加入开心洋葱多维思维学习平台 QQ群
  • 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏开心洋葱吧~~~~~~~~~~~~~!
  • 由于近期流量激增,小站的ECS没能经的起亲们的访问,本站依然没有盈利,如果各位看如果觉着文字不错,还请看官给小站打个赏~~~~~~~~~~~~~!

ROS进阶——运动规划分析

人工智能 white_Learner 2021次浏览 0个评论

一、运动规划算法简述

实现流程 通过给定的轨迹点,根据设定的最大速度和加速度计算每个点的速度,加速度和时间帧。

  • 轨迹点:可通过插补获得,数据类型为moveit_msgs::RobotTrajectory
  • 设定的最大速度和加速度:为URDF文件中设定参数

规划器 当前ROS提供三种规划器:

  • Time-optimal Trajectory Parameterization
  • Iterative Spline Parameterization
  • Iterative Parabolic Time Parameterization

分析 在规划固定轨迹时(直线,圆弧),规划获得速度和加速度一般会有抖动,特别是在精确的规划下,因此在对轨迹要求不高的情况下,使用样条曲线(Spline Curves)拟合轨迹可以获得较好的运动规划结果,若需要精确的固定轨迹规划,建议降低速度。 应用

  • 通过planning_adapters调用

ompl_planning_pipeline.launch中修改default_planner_request_adapters/AddTimeParameterization,若使用其他规划器,修改对应planning_pipeline.launch。(可将不支持算法制作成plugin再调用,详细参考ROS进阶——MoveIt Planning Request Adapters)  
ROS进阶——运动规划分析  

  • 手动调用

当使用自定义规划算法(按照默认算法编写接口)或者新的算法(旧ros版本不支持)时,可以直接通过类调用,但注意在moveit通过plan规划时,会调用planning_adapters设置的规划算法,因此手动调用需要在plan之后。

参考:Add better functionality for adding Time Parametrization to a Cartesian Trajectory

// First to create a RobotTrajectory object
robot_trajectory::RobotTrajectory rt(group->getCurrentState()->getRobotModel(), "hand");

// Second get a RobotTrajectory from trajectory
rt.setRobotTrajectoryMsg(*group->getCurrentState(), trajectory_msg);

// Thrid create a iterative time
trajectory_processing::IterativeParabolicTimeParameterization iptp;// 五次样条曲线插补

trajectory_processing::IterativeSplineParameterization isp;// 三次样条曲线

trajectory_processing::TimeOptimalTrajectoryGeneration totg;//时间优化
      
// Fourth compute computeTimeStamps
// bool ItSuccess = iptp.computeTimeStamps(rt);
// bool ItSuccess = isp.computeTimeStamps(rt);
bool ItSuccess = totg.computeTimeStamps(rt);
OS_INFO("Computed time stamp %s", ItSuccess ? "SUCCEDED" : "FAILED");

// Get RobotTrajectory_msg from RobotTrajectory
rt.getRobotTrajectoryMsg(trajectory_msg);

    computeTimeStamps函数定义(三个规划器一样)  

bool trajectory_processing::IterativeParabolicTimeParameterization::computeTimeStamps(
robot_trajectory::RobotTrajectory & trajectory, //轨迹数据
const double max_velocity_scaling_factor = 1.0, //速度比例
const double max_acceleration_scaling_factor = 1.0 //加速度比例
)

    速度比例和加速度比例是对关节最大速度和加速度的约束,值范围为0-1,最大值的设置值在joint_limits.yaml文件中定义。

二、Time-optimal Trajectory Parameterization

算法原理:Time-Optimal Path Following (July 2012) 注意:该规划算法在melodic版本以上才整合到moveit中 分析

  1. 该规划器输出轨迹为等时间间距(其余为等距)
  2. 该规划器在小间距下规划的速度和加速度较其余两种优化算法更加合理与平滑,在较大间距下三种规划算法效果差距不大,良好的规划间距会因机械臂参数的不同而有所不同。
  3. 在过小间距下(0.001s)插补,会出现运动规划不恒定,规划速度不平滑的现象,经测试在0.005s(不同机械臂不一致,同时需要根据控制器输出频率等确定)的规划间距下可以有较为稳定和理想的规划效果。

参数设置  

TimeOptimalTrajectoryGeneration(const double path_tolerance = 0.1, 
                                const double resample_dt = 0.1);

   

  • path_tolerance,轨迹宽容度,允许轨迹相对实际轨迹的误差量,单位m。
  • resample_dt,输出轨迹时间间距,单位s。

减少轨迹宽容度和时间间隔会导致速度和加速度出现抖动,应根据实际情况调整。 低版本(kinetic)使用 下载time_optimal_trajectory_generation.htime_optimal_trajectory_generation.cpp放到workspcae中手动调用或制作为插件调用,程序采用c++14标准编写,使用低标准需要进行修改。 修改  

std::make_unique<LinearPathSegment>(start_config, end_config)//c++14

  为  

std::unique_ptr<LinearPathSegment>(new LinearPathSegment(start_config, end_config))//c++11

若编译器支持c++14无需修改 实现效果
ROS进阶——运动规划分析  

  1. 直线插补-时间间距0.001s,精度1mm

注意:该间距下规划所得结果不恒定

  • 操作空间

ROS进阶——运动规划分析   关节空间  
ROS进阶——运动规划分析  
ROS进阶——运动规划分析  

  1. 直线插补-时间间距0.01s,精度10mm
  • 操作空间

 
ROS进阶——运动规划分析   关节空间  
ROS进阶——运动规划分析
ROS进阶——运动规划分析  

  1. 直线插补-时间间距0.1s,精度100mm
  • 操作空间

 
ROS进阶——运动规划分析   关节空间  
ROS进阶——运动规划分析  
ROS进阶——运动规划分析  

三、Iterative Spline Parameterization

实现效果  
ROS进阶——运动规划分析  

  1. 直线插补-1mm
  • 操作空间

ROS进阶——运动规划分析   关节空间  
ROS进阶——运动规划分析  
ROS进阶——运动规划分析  

  1. 直线插补-10mm
  • 操作空间

ROS进阶——运动规划分析 关节空间   ROS进阶——运动规划分析  
ROS进阶——运动规划分析  

  1. 直线插补-100mm
  • 操作空间

ROS进阶——运动规划分析  
ROS进阶——运动规划分析
ROS进阶——运动规划分析

四、Iterative Parabolic Time Parameterization

算法原理:TOPP(改进TOPP-RA) 分析

  1. 该运动规划器为moveit默认使用规划器,可以实现速度和加速度平滑,但无法避免加速度的抖动。
  2. 该规划器等间距插补,平滑速度和加速度,适合用在低速精确轨迹控制下。

实现效果  
ROS进阶——运动规划分析  

  1. 直线插补-1mm
  • 操作空间

ROS进阶——运动规划分析   关节空间 ROS进阶——运动规划分析   ROS进阶——运动规划分析  

  1. 直线插补-10mm
  • 操作空间

ROS进阶——运动规划分析

  • 关节空间

  ROS进阶——运动规划分析   ROS进阶——运动规划分析  

  1. 直线插补-100mm
  • 操作空间

ROS进阶——运动规划分析   关节空间  
ROS进阶——运动规划分析  
ROS进阶——运动规划分析  

参考

https://github.com/ros-planning/moveit/pull/1365 https://github.com/ros-planning/moveit/tree/melodic-devel/moveit_core/trajectory_processing/include/moveit/trajectory_processing libmoveit_default_planning_request_adapter_plugins  


开心洋葱 , 版权所有丨如未注明 , 均为原创丨未经授权请勿修改 , 转载请注明ROS进阶——运动规划分析
喜欢 (0)

您必须 登录 才能发表评论!

加载中……