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的学习笔记.原理分析.使用例程等相关的博文.排序不分先后,随机整理的 ...
随机推荐
- [转]分析MySQL数据类型的长度【mysql数据字段 中length和decimals的作用!熟悉mysql必看】
转载自:http://blog.csdn.net/daydreamingboy/article/details/6310907 分析MySQL数据类型的长度 MySQL有几种数据类型可以限制类型的&q ...
- SQL Server中取汉字拼音的函数
)) ) ) ) ) ), py end return @pinyin END GOSELECT dbo.fn_GetP ...
- go语言之进阶篇创建goroutine协程
1.goroutine是什么 goroutine是Go并行设计的核心.goroutine说到底其实就是协程,但是它比线程更小,十几个goroutine可能体现在底层就是五六个线程,Go语言内部帮你实现 ...
- Libnids读书笔记 (转)
一.当日工作(或学习)内容及进展情况(以条目式陈述,必要时配图说明) Libnids读书笔记: Libnids(Library Network Intusion Detection System)网络 ...
- 检索(retrieval && search )-单目标-多目标跟踪-MTMC Tracking和 ReID
跨摄像头多目标跟踪(Multi-Target Multi-Camera Tracking, MTMC Tracking) 跨摄像头多目标跟踪(Multi-Target Multi-Camera Tra ...
- Rotate Image leetcode java
题目: You are given an n x n 2D matrix representing an image. Rotate the image by 90 degrees (clockwis ...
- 插件化 VirtualAPK 简介 体验 MD
Markdown版本笔记 我的GitHub首页 我的博客 我的微信 我的邮箱 MyAndroidBlogs baiqiantao baiqiantao bqt20094 baiqiantao@sina ...
- Spring Boot Maven Plugin打包异常及三种解决方法:Unable to find main class
[背景]spring-boot项目,打包成可执行jar,项目内有两个带有main方法的类并且都使用了@SpringBootApplication注解(或者另一种情形:你有两个main方法并且所在类都没 ...
- js el jstl list 循环
需要在js中获取从Controller传过来的list集合,通过循环遍历找到对应的值,赋值到指定input框中 刚开始做法: for (var h = 0; h < gradesize; h++ ...
- 技能|三次简化一张图:一招理解LSTM/GRU门控机制
作者 | 张皓 引言 RNN是深度学习中用于处理时序数据的关键技术, 目前已在自然语言处理, 语音识别, 视频识别等领域取得重要突破, 然而梯度消失现象制约着RNN的实际应用.LSTM和GRU是两种目 ...
