V-rep学习笔记:Reflexxes Motion Library 2
VREP中的simRMLMoveToPosition函数可以将静态物体按照设定的运动规律移动到指定的目标位置/姿态。If your object is dynamically enabled, it will not work (since in that case the position of the object is dictated by the physics engine). In that case, make sure to uncheck the Body is dynamic checkbox.
下面在原点处创建一个Dummy,为其添加threaded child script(The simRMLMoveToPosition function can only be called from child scripts running in a thread (since this is a blocking operation) ),并使用Graph记录其位置-速度-加速度信息。
local h=simGetObjectAssociatedWithScript(sim_handle_self)
local currentVel={,,,}
local currentAccel={,,,}
local maxVel={0.2,0.2,0.2,0.2}
local maxAccel={0.1,0.1,0.1,0.1}
local maxJerk={0.1,0.1,0.1,0.1}
local targetPos={,,}
local targetVel={,,,}
simRMLMoveToPosition(h,-,-,currentVel,currentAccel,maxVel,maxAccel,maxJerk,targetPos,nil,targetVel)
simWait()
simStopSimulation()
Graph的Data stream type中没有加速度的选项,但是注意下面有个Data transformation(determines how the selected data stream is transformed)选项框可以对原始数据进行微分、积分、缩放、平移等变换。
Raw uses the original data stream, Derivative uses the time derivative of the data stream (e.g. if the raw data stream is the position of an object, then data will be its velocity), Integral uses the time integral of the data stream (e.g. if the raw data is the velocity of an object, then data will be its position) and Cumulative uses the cumulative value of the data stream (e.g. if the raw data is the surface cut by a mill, then data will be the total surface cut by that mill during the simulation). Additionally, the data can be scaled, shifted, and a moving average period specified.
选择记录Dummy的X方向绝对速度,然后在Data transformations选项框中选择Derivative对数据进行微分,得到X方向加速度:
下图记录了Dummy沿X轴运动1m时的位置、速度、加速度随时间的变化曲线。可以看出在开始的加速阶段,加速度在加加速度(Jerk)限制下以梯形曲线达到最大值0.1m/s2,此后进行一段匀加速直线运动,速度曲线为直线段,位置曲线为二次曲线;达到最大速度0.2m/s时进行匀速直线运动,此时加速度为0,位置曲线为直线段。

另外需要注意的是simRMLMoveToPosition是一个阻塞模式(blocking operation)的函数,前一个函数执行完后才会继续执行下一个。下面连续两行代码让dummy先按规律运动到(1,0,0)处然后再返回远点:
simRMLMoveToPosition(h,-,-,currentVel,currentAccel,maxVel,maxAccel,maxJerk,targetPos,nil,targetVel)
simRMLMoveToPosition(h,-,-,currentVel,currentAccel,maxVel,maxAccel,maxJerk,{,,},nil,targetVel)
使用simRMLMoveToPosition并配合逆运动学可以实现机器人的路径控制:控制Target的目标位置/姿态和运动规律,VREP的运动学逆解解算器会自动让Tip跟随Target运动。下面在场景中拖入ABB IRB4600机器人模型,创建4个路径点pos1~pos4,使机器人按照指定的运动规律依次经过这4个路径点。
-- This is a threaded script! getTargetPosVectorFromObjectPose=function(objectHandle)
local p=simGetObjectPosition(objectHandle,targetBase)
local o=simGetObjectQuaternion(objectHandle,targetBase)
return p,o
end threadFunction=function()
while simGetSimulationState()~=sim_simulation_advancing_abouttostop do -- target is the object that the robot's tooltip will try to follow via IK, which means that
-- if you change the position/orientation of target, then the robot's tooltip will try to follow
-- target is used so that all position and orientation values are always relative to the robot base
-- (e.g. so that if you move the robot to another position, you will not have to rewrite this code!) -- Go to pos1:
targetP,targetO=getTargetPosVectorFromObjectPose(pos1_handle)
simRMLMoveToPosition(target,targetBase,-,nil,nil,maxVel,maxAccel,maxJerk,targetP,targetO,nil)
-- Go to pos2:
targetP,targetO=getTargetPosVectorFromObjectPose(pos2_handle)
simRMLMoveToPosition(target,targetBase,-,nil,nil,maxVel,maxAccel,maxJerk,targetP,targetO,nil)
-- Go to pos3:
targetP,targetO=getTargetPosVectorFromObjectPose(pos3_handle)
simRMLMoveToPosition(target,targetBase,-,nil,nil,maxVel,maxAccel,maxJerk,targetP,targetO,nil)
-- Go to pos4:
targetP,targetO=getTargetPosVectorFromObjectPose(pos4_handle)
simRMLMoveToPosition(target,targetBase,-,nil,nil,maxVel,maxAccel,maxJerk,targetP,targetO,nil)
end
end -- Initialization:
simSetThreadSwitchTiming() target=simGetObjectHandle('IRB4600_IkTarget')
targetBase=simGetObjectHandle('IRB4600') pos1_handle=simGetObjectHandle('pos1')
pos2_handle=simGetObjectHandle('pos2')
pos3_handle=simGetObjectHandle('pos3')
pos4_handle=simGetObjectHandle('pos4') -- Set-up some of the RML vectors:
maxVel={0.4,0.4,0.4,1.8}
maxAccel={0.3,0.3,0.3,0.9}
maxJerk={0.2,0.2,0.2,0.8} -- Here we execute the regular thread code:
res,err=xpcall(threadFunction,function(err) return debug.traceback(err) end)
if not res then
simAddStatusbarMessage('Lua runtime error: '..err)
end
参考:
Reflexxes Motion LibrariesManual and Documentation
V-REP: Reflexxes Motion Library Demonstration
V-rep学习笔记:Reflexxes Motion Library 1
V-rep学习笔记:Reflexxes Motion Library 2的更多相关文章
- V-rep学习笔记:Reflexxes Motion Library 3
路径规划 VS 轨迹规划 轨迹规划的目的是将输入的简单任务描述变为详细的运动轨迹描述.注意轨迹和路径的区别:Trajectory refers to a time history of positio ...
- V-rep学习笔记:Reflexxes Motion Library 1
V-REP中集成了在线运动轨迹生成库Reflexxes Motion Library Type IV,目前Reflexxes公司已经被谷歌收购.(The Reflexxes Motion Librar ...
- 【HLSL学习笔记】WPF Shader Effect Library算法解读之[DirectionalBlur]
原文:[HLSL学习笔记]WPF Shader Effect Library算法解读之[DirectionalBlur] 方位模糊是一个按照指定角度循环位移并叠加纹理,最后平均颜色值并输出的一种特效. ...
- 【HLSL学习笔记】WPF Shader Effect Library算法解读之[Embossed]
原文:[HLSL学习笔记]WPF Shader Effect Library算法解读之[Embossed] Embossed(浮雕效果) 浮雕效果主要有两个参数:Amount和Wid ...
- 【HLSL学习笔记】WPF Shader Effect Library算法解读之[BandedSwirl]
原文:[HLSL学习笔记]WPF Shader Effect Library算法解读之[BandedSwirl] 因工作原因,需要在Silverlight中使用Pixel Shader技术,这对于我来 ...
- R语言与机器学习学习笔记
人工神经网络(ANN),简称神经网络,是一种模仿生物神经网络的结构和功能的数学模型或计算模型.神经网络由大量的人工神经元联结进行计算.大多数情况下人工神经网络能在外界信息的基础上改变内部结构,是一种自 ...
- DirectX Graphics Infrastructure(DXGI):最佳范例 学习笔记
今天要学习的这篇文章写的算是比较早的了,大概在DX11时代就写好了,当时龙书11版看得很潦草,并没有注意这篇文章,现在看12,觉得是跳不过去的一篇文章,地址如下: https://msdn.micro ...
- <老友记>学习笔记
这是六个人的故事,从不服输而又有强烈控制欲的monica,未经世事的千金大小姐rachel,正直又专情的ross,幽默风趣的chandle,古怪迷人的phoebe,花心天真的joey——六个好友之间的 ...
- (转) OpenCV学习笔记大集锦 与 图像视觉博客资源2之MIT斯坦福CMU
首页 视界智尚 算法技术 每日技术 来打我呀 注册 OpenCV学习笔记大集锦 整理了我所了解的有关OpenCV的学习笔记.原理分析.使用例程等相关的博文.排序不分先后,随机整理的 ...
随机推荐
- SVG.js 元素操作整理(二)-Transform
一.transform()获取或设置矩阵变换 var draw = SVG('svg1').size(300, 300); //Transforming SVG元素矩阵变换 var rect = dr ...
- arcgis server 10 for java 8399根目录是404的提示取消,并跳转到 地图目录 /arcgis/rest/services下
看了Howto: 取消ArcGIS Server 9.x for Java内置tomcat在8399端口的文件列表 http://support.esrichina-bj.cn/2009/0819/9 ...
- Android实现在线更新的过程案例
一.更新软件的准备 在线更新软件的话需要我们有签名的应用,我们需要把签过名之后的软件放入到服务器中,我的如下: 其中apk是有签名的更新版本! updateinfo.html代码如下: {" ...
- C#邮件发送(最坑爹的邮箱-QQ邮箱)
最近工作挺清闲的,有空的时候陪妹子出去玩玩,自己看看小说,看看电影,日子过的挺欢乐的,这个星期幡然悔悟,代码才是我的最爱,做点小东西,就写个邮件发送程序.说的邮件发送相信工作过基本上都会用到过,用户注 ...
- Android开发Tips(5)
欢迎Follow我的GitHub, 关注我的CSDN. 介绍关于Android的一些有趣的小知识点. 本文是第五篇了, 差点儿一周一篇, 欢迎阅读. 其余第一篇, 第二篇, 第三篇, 第四篇. 1. ...
- android 桌面小工具(Widget)开发教程
刚学做了哥Widget,感觉不错哦,先来秀下效果(用朋友手机截的图) 这个Widget会每隔5秒钟自动切换内容和图片,图片最好使用小图,大图会导致你手机桌面(UI)线程卡顿 教程开始: 1.首先创建一 ...
- 详细解读简单的lstm的实例
http://blog.csdn.net/zjm750617105/article/details/51321889 本文是初学keras这两天来,自己仿照addition_rnn.py,写的一个实例 ...
- 用Python开始机器学习(2:决策树分类算法)
http://blog.csdn.net/lsldd/article/details/41223147 从这一章开始进入正式的算法学习. 首先我们学习经典而有效的分类算法:决策树分类算法. 1.决策树 ...
- 基于CRF的中文分词
http://biancheng.dnbcw.info/java/341268.html CRF简介 Conditional Random Field:条件随机场,一种机器学习技术(模型) CRF由J ...
- Eclipse里选一个变量后,这个类里的该变量不变色了
使用“Alt+Shift+O”对该提示功能的开/关切换
