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的学习笔记.原理分析.使用例程等相关的博文.排序不分先后,随机整理的 ...
随机推荐
- AsyncHttpClient的连接池使用逻辑
AsyncHttpClient的连接池结构很简单, NettyConnectionsPool内部重要的几个变量如下 // 连接池, 通过 host 区分不同的池 private final Concu ...
- 【ContestHunter】【弱省胡策】【Round0】(A)&【Round1】(B)
DP+容斥原理or补集转化?/KD-Tree 唔……突然发现最早打的两场(打的最烂的两场)没有写记录……(太烂所以不忍记录了吗... 还是把搞出来了的两道题记录一下吧= =勉强算弥补一下缺憾…… Ro ...
- ConcurrentHashMap和HashMap的区别
(1)ConcurrentHashMap对整个桶数组进行了分段,而HashMap则没有 (2)ConcurrentHashMap在每一个分段上都用锁进行保护,从而让锁的粒度更精细一些,并发性能更好,而 ...
- DevExpress的安装方法与破解教程【转】
DevExpress是一个界面控件套件,提供了一系列的界面控件套件的DotNet界面控件.DevExpress开发的控件有很强的实力,不仅功能丰富,应用简单,而且界面华丽,更可方便订制,对于编程人员来 ...
- 【python3】 enumerate用法总结(转)
http://blog.csdn.net/churximi/article/details/51648388 enumerate()说明 enumerate()是python的内置函数 enumera ...
- THINKPHP 错误:Undefined class constant 'MYSQL_ATTR_INIT_COMMAND'
最近公司同事将我之前使用Thinkphp开发的一个项目从香港迁移到国内阿里云服务器上去,结果网站所有地址打开全部一片空白 跟同事确认了PHP版本,Mysql版本等都是跟迁移前的配置一样的,最终经过我查 ...
- Sql控制反转小尝试
假想用配置Sql语句的方式来完毕一个处理逻辑,而且映射到一个Url,这样当请求这个url的时候,运行前面配置的sql. 以下的一段详细配置,比如 当请求pagerlistdept.do的时候,会传入參 ...
- Flask刷新问题
修改页面中内容,特别是图片后,总是刷新不了.调试时,我常常通过修改端口来解决,从80-99不断改. 服务器部署,也遇到同样问题,重启web服务器,重启计算机都不行,网页已经改过来了,但是图片还是老图片 ...
- MYSQL的服务不见了
多日不用MYSQL数据库,进入突然要用,进入服务列表突然发现...MYSQL服务不见了..不是于是乎..找到命令: F:\www\MySQLServer\bin>mysqld.exe -in ...
- [Algorithm] Reservoir Sampling
Given a stream of elements too large to store in memory, pick a random element from the stream with ...