基本概念
7段S型加减速算法(7 segments S-curve velocity profile),是由T型加速度曲线(Trapezoidal motion profile)演化而来(此外,还有多项式规划(Polynomial Profile),如三次多项式、五次多项式、七次多项式等。虽然五次以上多项式曲线可以让速度加速度都连续变化,但速度曲线没有匀速运动时间,不利于对加减速过程进行优化。),通过在速度曲线的加速段与匀速段之间增加抛物线(parabolic)或者三角函数(triangular)过度,是的加速度平滑(smooth)过渡,从而解决了加区间两端速度不连续(discontinuous)的问题。顾名思义,典型的7段S型加速度曲线包括如下7段:加加速(increase acceleration)、匀加速(constant acceleration)、减加速(decrease acceleration)、匀速、加减速(increase deceleration)、匀减速(constant deceleration)、减减速(decrease deceleration)。通过指定始末位移量(displacement),最大允许转速(Vel)、最大允许加速度(acc)、以及加加速度(jerk),在减少对系统冲击与振动的前提下,充分利用电机伺服性能,以最快的速度(时间最短,)完成运动插补。
问题提出
多轴联动必须考虑时间同步(synchronize),这本质上是一个 non-convex optimization 问题 ,Since there are constraints on initial and final velocities which can be non-zero it is necessary to synchronize each DOF in time 。 Suppose DOF ii takes time TT to reach its destination, you need to synchronize other DOFs with time t=Tt=T, because DOF ii cannot go any faster 。
参考资料
链接: robotics.stackexchange.com/generating-double-s-curve-velocity-profiles-with-given-time.
参考一:
解决方案:velocity profile stretching,we stretch the velocity profile such that it has duration as specified earlier。
链接1
看这篇文章,可能要翻一下.
先分别求出每个独立关节的S曲线,以总规划时间最短(或运动距离最远)的关节时间T为优化对象,再对其他关节进行速度优化调整。
链接2
github.com/rdiankov/openrave.
相比上篇,约束条件少一些,并且给出了实现过程以及源码。
必须指出的是, given a duration tt to synchronize a trajectory with, the problem is not always feasible due to inoperative time interval (参考2有提到). Basically, due to velocity and acceleration limits of the robot joints, given a set of boundary conditions (such as initial and final velocities), there might exists some time interval t = [ t0 , t1 ] such that there exists no trajectory which satisfies the boundary conditions and has a duration t.
链接3
Trajectory Planning for Automatic Machines and Robots.
By Long Smith:I have found a solution. Quiet simple actually. To generate minimum time double s-curve profile I used algorithm presented in the wonderful book above. After computing trajectory for the first DOF I perform the same algorithm for the other DOFs but if trajectory is infeasible with given time, it is appeared to be a good idea to make maximum possible acceleration smaller and smaller with some factor(I use 0.95) which leads to longer trajectory execution. Moreover we can do the same with maximum velocity and jerk constraints which will make more trajectories to be feasible. However this will take significantly more time and since all my tests passed with only decreasing acceleration I am satisfied.
参考二
google search key words: s-curve profile synchronize PDF
养成使用Google的好习惯,关键字后面加一个 PDF 。这部分尚未具体展开,大家可以自行调研。
实现方案
对于七段S加减速,这里不再赘述,可以参考一下几篇博文:
CSDN博主–septembernine–S形加减速.
CSDN博主–勤为本–【龙印】步进电机使用七段式抛物线型S曲线加减速和路径规划的理论分析和实现.
这里,主要基于已有的S加减速算法,以及链接2、3(链接2中有S加减速github源码),增加多轴时间约束,达到多轴时间同步的目的。
后续
后续会持续跟进,后期会更新处理结果以及相关资源。感兴趣的同学欢迎私我进行沟通。
更新于20210129:鉴于私下很多人联系我讨论多轴同步与指定时间规划的问题,这里补充说明一下:本人近期打算开始对这一块对相关C代码进行测试整理,到时会分享源码,欢迎做机械臂轨迹插补的同行一起交流哈