V-REP中集成了在线运动轨迹生成库Reflexxes Motion Library Type IV,目前Reflexxes公司已经被谷歌收购。(The Reflexxes Motion Libraries provide instantaneous trajectory generation capabilities for motion control systems.  Reflexxes Motion Library contains a set of On-Line Trajectory Generation (OTG) algorithms that are designed to control robots and mechanical systems.) Reflexxes的众多优点使其可以应用于机器人、数控机床和伺服驱动系统等领域。

  随着计算机技术的发展,数控系统已经从最初的由数字逻辑电路构成的硬线数控系统发展到了以计算机为核心的计算机数控(Computer Numerical Control,CNC)系统。相对于硬线数控系统而言,CNC系统的控制功能主要由软件实现,并可处理逻辑电路难以处理的复杂信息,因而具有较高的柔性和更高的性能。高速加工对CNC的最基本要求:以足够快的速度处理数据、为各进给轴加减速产生无冲击的理论值。高速加工CNC的核心技术是样条实时插补和无冲击的加速器。如果jerk(加加速读/突变)过大,可在短时间内实现加速,但同时会造成机床的振动,从而使所加工表面出现条纹,降低了表面质量。如果加加速过小,可以实现高的表面质量,但很难实现快加速功能。因此,为了保证在高速情况下加工出高质量表面,合理的机床加加速非常重要。

  在基于位置的在线轨迹生成算法中输入、输出如下图所示。输入端:当前状态包括当前位置/姿态向量以及当前速度向量;运动约束包括最大速度和最大加速度(在Type IV库中还可以支持加加速度);目标状态包括目标位置/姿态以及目标速度。为了保证算法的可行性和数值稳定性,输入参数需要满足以下几点要求:

  (1)最大速度和最大加速度必须大于0;

  (2)在位置模式下(for the position-based algorithm),最大速度必须大于或等于目标速度;

  (3)所有输入参数的数值必须在一定的范围内。 For the position-based algorithm this is range is specified by

    and for the velocity-based algorithm

Input and output values of the position-based Type II On-Line Trajectory Generation algorithm of the Reflexxes Motion Libraries

  提供合理的输入参数后,可以从输出端获取数据,用于底层控制。下面是一个生成三自由度关节轨迹的简单例子。The position-based On-Line Trajectory Generation algorithm of the Type II Reflexxes Motion Library is called by the method ReflexxesAPI::RMLPosition(). In this example (cf. Example 1 — Introduction to the Position-based algorithm), we assume to control a simple Cartesian robot with three translational degrees of freedom, and we apply the following input values at time instant .

  三个轴的输入参数如下:

  下载Reflexxes Motion Libraries Type II后将其解压,用Visual Studio打开工程文件生成TypeIIRML.lib(参考Download and Build Instructions for the Type II Reflexxes Motion Library)。将01_RMLPositionSampleApplication中的源文件代码进行修改,添加写文件操作,将生成的输出数据记录在文本文件中:

#include <stdio.h>
#include <stdlib.h>
#include <fstream>
#include <iostream> #include <ReflexxesAPI.h>
#include <RMLPositionFlags.h>
#include <RMLPositionInputParameters.h>
#include <RMLPositionOutputParameters.h> //*************************************************************************
// defines #define CYCLE_TIME_IN_SECONDS 0.001 //one millisecond
#define NUMBER_OF_DOFS 3 int main()
{
// ********************************************************************
// Variable declarations and definitions int ResultValue = ; ReflexxesAPI *RML = NULL; RMLPositionInputParameters *IP = NULL; RMLPositionOutputParameters *OP = NULL; RMLPositionFlags Flags; // ********************************************************************
// Creating all relevant objects of the Type II Reflexxes Motion Library RML = new ReflexxesAPI(NUMBER_OF_DOFS, CYCLE_TIME_IN_SECONDS); IP = new RMLPositionInputParameters(NUMBER_OF_DOFS); OP = new RMLPositionOutputParameters(NUMBER_OF_DOFS); // ********************************************************************
// Set-up the input parameters // In this test program, arbitrary values are chosen. If executed on a
// real robot or mechanical system, the position is read and stored in
// an RMLPositionInputParameters::CurrentPositionVector vector object.
// For the very first motion after starting the controller, velocities
// and acceleration are commonly set to zero. The desired target state
// of motion and the motion constraints depend on the robot and the
// current task/application.
// The internal data structures make use of native C data types
// (e.g., IP->CurrentPositionVector->VecData is a pointer to
// an array of NUMBER_OF_DOFS double values), such that the Reflexxes
// Library can be used in a universal way. IP->CurrentPositionVector->VecData[] = 100.0;
IP->CurrentPositionVector->VecData[] = 0.0;
IP->CurrentPositionVector->VecData[] = 50.0; IP->CurrentVelocityVector->VecData[] = 100.0;
IP->CurrentVelocityVector->VecData[] = -220.0;
IP->CurrentVelocityVector->VecData[] = -50.0; IP->CurrentAccelerationVector->VecData[] = -150.0;
IP->CurrentAccelerationVector->VecData[] = 250.0;
IP->CurrentAccelerationVector->VecData[] = -50.0; IP->MaxVelocityVector->VecData[] = 300.0;
IP->MaxVelocityVector->VecData[] = 100.0;
IP->MaxVelocityVector->VecData[] = 300.0; IP->MaxAccelerationVector->VecData[] = 300.0;
IP->MaxAccelerationVector->VecData[] = 200.0;
IP->MaxAccelerationVector->VecData[] = 100.0; IP->TargetPositionVector->VecData[] = -600.0;
IP->TargetPositionVector->VecData[] = -200.0;
IP->TargetPositionVector->VecData[] = -350.0; IP->TargetVelocityVector->VecData[] = 50.0;
IP->TargetVelocityVector->VecData[] = -50.0;
IP->TargetVelocityVector->VecData[] = -200.0; IP->SelectionVector->VecData[] = true;
IP->SelectionVector->VecData[] = true;
IP->SelectionVector->VecData[] = true; std::ofstream out("out.txt", std::ios::app);
// ********************************************************************
// Starting the control loop while (ResultValue != ReflexxesAPI::RML_FINAL_STATE_REACHED)
{
// Calling the Reflexxes OTG algorithm
ResultValue = RML->RMLPosition(*IP, OP, Flags); if (ResultValue < )
{
printf("An error occurred (%d).\n", ResultValue);
break;
} // ****************************************************************
// Here, the new state of motion, that is
//
// - OP->NewPositionVector
// - OP->NewVelocityVector
// - OP->NewAccelerationVector
//
// can be used as input values for lower level controllers. In the
// most simple case, a position controller in actuator space is
// used, but the computed state can be applied to many other
// controllers (e.g., Cartesian impedance controllers,
// operational space controllers).
// ****************************************************************
for (int i = ; i < ; i++)
out << OP->NewPositionVector->VecData[i] << ",";
out << std::endl;
// ****************************************************************
// Feed the output values of the current control cycle back to
// input values of the next control cycle *IP->CurrentPositionVector = *OP->NewPositionVector;
*IP->CurrentVelocityVector = *OP->NewVelocityVector;
*IP->CurrentAccelerationVector = *OP->NewAccelerationVector;
} // ********************************************************************
// Deleting the objects of the Reflexxes Motion Library end terminating
// the process delete RML;
delete IP;
delete OP; out.close(); exit(EXIT_SUCCESS);
}

  while循环中调用RMLPosition函数(This is the central method of each Reflexxes Type Motion Library)单步执行轨迹生成算法。如果还没达到目标状态,该函数返回ReflexxesAPI::RML_WORKING;如果已达到设定的运动状态则返回ReflexxesAPI::RML_FINAL_STATE_REACHED,其它返回值可以参见API手册。

  将记录的三个轴的位置数据在Excel中用折线图显示出来(速度和加速度信息也可以按照同样方式操作):

  可以看出达到设定的目标位置。Reflexxes Motion Library有更复杂和强大的用法,这里只是先作一个简单的介绍。


  在V-REP中集成了Reflexxes Motion Library type IV C++库,目前在lua API中有如下几个函数可以使用:

  将UR5机器人从模型库拖到新建的场景里中,与其关联的代码里设置了当前关节速度、加速度以及运动过程中的最大速度、加速度、目标速度以及目标位置。然后调用simRMLMoveToJointPositions同时移动UR机器人的6个关节使其按照运动规律达到目标位置。

-- This is a threaded script, and is just an example!

jointHandles={-,-,-,-,-,-}
for i=,, do
jointHandles[i]=simGetObjectHandle('UR5_joint'..i)
end -- Set-up some of the RML vectors:
vel=
accel=
jerk=
currentVel={,,,,,,}
currentAccel={,,,,,,}
maxVel={vel*math.pi/,vel*math.pi/,vel*math.pi/,vel*math.pi/,vel*math.pi/,vel*math.pi/}
maxAccel={accel*math.pi/,accel*math.pi/,accel*math.pi/,accel*math.pi/,accel*math.pi/,accel*math.pi/}
maxJerk={jerk*math.pi/,jerk*math.pi/,jerk*math.pi/,jerk*math.pi/,jerk*math.pi/,jerk*math.pi/}
targetVel={,,,,,} targetPos1={*math.pi/,*math.pi/,-*math.pi/,*math.pi/,*math.pi/,*math.pi/} -- simRMLMoveToJointPositions: Moves (actuates) several joints at the same time using the Reflexxes Motion Library.
-- This function can only be called from child scripts running in a thread
--[[
number result,table newPos,table newVel,table newAccel,number timeLeft=simRMLMoveToJointPositions(table jointHandles,
number flags,table currentVel,table currentAccel,table maxVel,
table maxAccel,table maxJerk,table targetPos,table targetVel,table direction)
--]]
simRMLMoveToJointPositions(jointHandles,-,currentVel,currentAccel,maxVel,maxAccel,maxJerk,targetPos1,targetVel) targetPos2={-*math.pi/,*math.pi/,*math.pi/,*math.pi/,*math.pi/,*math.pi/}
simRMLMoveToJointPositions(jointHandles,-,currentVel,currentAccel,maxVel,maxAccel,maxJerk,targetPos2,targetVel) targetPos3={,,,,,}
simRMLMoveToJointPositions(jointHandles,-,currentVel,currentAccel,maxVel,maxAccel,maxJerk,targetPos3,targetVel)

  添加一个Graph记录基座转动关节的角位移,可以看出确实符合程序中的设置:0°→90°→-90°→0°

参考:

Reflexxes Motion LibrariesManual and Documentation

V-REP: Reflexxes Motion Library Demonstration

V-rep学习笔记:Reflexxes Motion Library 1的更多相关文章

  1. V-rep学习笔记:Reflexxes Motion Library 3

    路径规划 VS 轨迹规划 轨迹规划的目的是将输入的简单任务描述变为详细的运动轨迹描述.注意轨迹和路径的区别:Trajectory refers to a time history of positio ...

  2. V-rep学习笔记:Reflexxes Motion Library 2

    VREP中的simRMLMoveToPosition函数可以将静态物体按照设定的运动规律移动到指定的目标位置/姿态.If your object is dynamically enabled, it ...

  3. 【HLSL学习笔记】WPF Shader Effect Library算法解读之[DirectionalBlur]

    原文:[HLSL学习笔记]WPF Shader Effect Library算法解读之[DirectionalBlur] 方位模糊是一个按照指定角度循环位移并叠加纹理,最后平均颜色值并输出的一种特效. ...

  4. 【HLSL学习笔记】WPF Shader Effect Library算法解读之[Embossed]

    原文:[HLSL学习笔记]WPF Shader Effect Library算法解读之[Embossed] Embossed(浮雕效果)          浮雕效果主要有两个参数:Amount和Wid ...

  5. 【HLSL学习笔记】WPF Shader Effect Library算法解读之[BandedSwirl]

    原文:[HLSL学习笔记]WPF Shader Effect Library算法解读之[BandedSwirl] 因工作原因,需要在Silverlight中使用Pixel Shader技术,这对于我来 ...

  6. R语言与机器学习学习笔记

    人工神经网络(ANN),简称神经网络,是一种模仿生物神经网络的结构和功能的数学模型或计算模型.神经网络由大量的人工神经元联结进行计算.大多数情况下人工神经网络能在外界信息的基础上改变内部结构,是一种自 ...

  7. DirectX Graphics Infrastructure(DXGI):最佳范例 学习笔记

    今天要学习的这篇文章写的算是比较早的了,大概在DX11时代就写好了,当时龙书11版看得很潦草,并没有注意这篇文章,现在看12,觉得是跳不过去的一篇文章,地址如下: https://msdn.micro ...

  8. <老友记>学习笔记

    这是六个人的故事,从不服输而又有强烈控制欲的monica,未经世事的千金大小姐rachel,正直又专情的ross,幽默风趣的chandle,古怪迷人的phoebe,花心天真的joey——六个好友之间的 ...

  9. (转) OpenCV学习笔记大集锦 与 图像视觉博客资源2之MIT斯坦福CMU

          首页 视界智尚 算法技术 每日技术 来打我呀 注册     OpenCV学习笔记大集锦 整理了我所了解的有关OpenCV的学习笔记.原理分析.使用例程等相关的博文.排序不分先后,随机整理的 ...

随机推荐

  1. Mysql 编译安装并使用自定义用户启动

    本文基于 Redhat Linux 6.7 的环境,Mysql 版本为 5.5.37 安装前的检查 必备的组件,如果没有使用 yum 进行安装,可以使用网上的源,也可以使用本地光盘作为 Yum 源. ...

  2. SVG.js 基础图形绘制整理(二)

    一.折线 var draw = SVG('svg1').size(300, 300); //画折线 //使用字符串点 // var polyline=draw.polyline('0,0 100,50 ...

  3. DPI (Deep Packet Inspection) 深度包检测技术

    详解DPI与网络回溯分析技术 随着网络通讯技术进步与发展,网络通讯已跨入大数据时代,如何监控各类业务系统的通讯数据在大数据流量中传输质量,以及针对海量的网络通讯数据的范畴中存在少量的恶意流量的检测,避 ...

  4. RV32A指令集

    RV32A指令包括两类:AMO(atomic memory operation)指令,Load-Reserved/Store-Conditional指令 Category Fmt RV32I base ...

  5. 如何使用chrome自带的Javascript调试工具 【转】

    http://zhangyongbluesky.blog.163.com/blog/static/1831941620113155739840/ 将写好的Javascript代码用chrome打开. ...

  6. JQuery-Dialog(弹出窗口,遮蔽窗口)

    在Ajax中经常用到的弹出窗口和遮蔽窗口.自己写肯定是一个最佳方案,但时间和成本上,还是决定了寻找现成的吧.大概罗列一下.需要我满足我几个条件 一定要简洁方便 拥有遮蔽功能,Model Dialog ...

  7. Android -- Canvas java.lang.UnsupportedOperationException

    干货 java.lang.UnsupportedOperationException at android.view.GLES20Canvas.clipPath(GLES20Canvas.java:2 ...

  8. Maven hive-jdbc教程

    由于项目中需要用到hive-jdbc从数据仓库拉数据下来,所以简单的学一下hive,hive数据仓库建构在hadoop集群之上,数据存在hdfs文件系统中,hive中执行的操作会装换成mapreduc ...

  9. javascript中的关联数组

    所谓关联数组(associative array), 就是指javascript中的对象. 因为javascript中的属性就是一个个的键值对,可以通过obj[attr]的方式访问,很类似数组. 这种 ...

  10. SliTaz 从入门到精通

    slitaz中文化(linux-pe)项目地址: https://code.google.com/p/linux-pe/ http://bbs.wuyou.com/forum.php?mod=view ...