当前位置:网站首页>【coppeliasim】6自由度路径规划
【coppeliasim】6自由度路径规划
2022-07-06 02:00:00 【十年一梦实验室】
function sysCall_threadmain()
robotHandle=sim.getObjectHandle('Start')--获取dummy:Start的句柄
targetHandle=sim.getObjectHandle('End')--获取目标dummy:End的句柄
t=simOMPL.createTask('t')--创建OMPL规划任务t
ss={simOMPL.createStateSpace('6d',simOMPL.StateSpaceType.pose3d,robotHandle,{-1,-0.5,0},{1,0.5,1},1)}--创建状态空间:6d,状态空间类型-姿态3d,Start的句柄,边界{x,y,z}->{X,Y,Z},权重1
simOMPL.setStateSpace(t,ss)--设置任务t的状态空间ss
simOMPL.setAlgorithm(t,simOMPL.Algorithm.RRTConnect)--设置算法
simOMPL.setCollisionPairs(t,{sim.getObjectHandle('L_start'),sim.handle_all})--设置碰撞er 碰撞ee
startpos=sim.getObjectPosition(robotHandle,-1)--取 起始位置
startorient=sim.getObjectQuaternion(robotHandle,-1)--取起始方向
startpose={startpos[1],startpos[2],startpos[3],startorient[1],startorient[2],startorient[3],startorient[4]}--起始位姿状态:位置和四元数
simOMPL.setStartState(t,startpose)--设置起始位姿状态
goalpos=sim.getObjectPosition(targetHandle,-1)--目标位置
goalorient=sim.getObjectQuaternion(targetHandle,-1)--目标姿态
goalpose={goalpos[1],goalpos[2],goalpos[3],goalorient[1],goalorient[2],goalorient[3],goalorient[4]}--目标位姿状态
simOMPL.setGoalState(t,goalpose)--设置目标位姿状态
r,path=simOMPL.compute(t,20,-1,200)--计算:20——>计算路径查找程序in seconds.最大时间,用于简化路径的最大时间-1表示默认时间,minimum number of states to be returned最少要返回的状态数200
--r=true: true if a solution has been found
--path: a table of states, representing the solution, from start to goal. States are specified linearly.路径状态集合
while true do
-- Simply jump through the path points, no interpolation here:
for i=1,#path-7,7 do--每7状态 动一下
pos={path[i],path[i+1],path[i+2]}--位置
orient={path[i+3],path[i+4],path[i+5],path[i+6]}--姿态四元数
sim.setObjectPosition(robotHandle,-1,pos)--设置移动Start的位置
sim.setObjectQuaternion(robotHandle,-1,orient)--设置姿态
sim.switchThread()--切换线程
end
end
end
边栏推荐
- Genius storage uses documents, a browser caching tool
- RDD creation method of spark
- Use the list component to realize the drop-down list and address list
- MySQL learning notes - subquery exercise
- 729. 我的日程安排表 I / 剑指 Offer II 106. 二分图
- How to use C to copy files on UNIX- How can I copy a file on Unix using C?
- How to improve the level of pinduoduo store? Dianyingtong came to tell you
- dried food! Accelerating sparse neural network through hardware and software co design
- leetcode-2. Palindrome judgment
- Basic operations of databases and tables ----- default constraints
猜你喜欢
Folio. Ink is a free, fast and easy-to-use image sharing tool
Know MySQL database
NLP第四范式:Prompt概述【Pre-train,Prompt(提示),Predict】【刘鹏飞】
Leetcode3, implémenter strstr ()
Using SA token to solve websocket handshake authentication
UE4 unreal engine, editor basic application, usage skills (IV)
dried food! Accelerating sparse neural network through hardware and software co design
selenium 等待方式
Redis list
The ECU of 21 Audi q5l 45tfsi brushes is upgraded to master special adjustment, and the horsepower is safely and stably increased to 305 horsepower
随机推荐
通过PHP 获取身份证相关信息 获取生肖,获取星座,获取年龄,获取性别
[depth first search notes] Abstract DFS
一题多解,ASP.NET Core应用启动初始化的N种方案[上篇]
Jisuanke - t2063_ Missile interception
竞赛题 2022-6-26
Text editing VIM operation, file upload
Initialize MySQL database when docker container starts
Leetcode3. Implement strstr()
Numpy array index slice
Reasonable and sensible
Accelerating spark data access with alluxio in kubernetes
MySQL index
Selenium element positioning (2)
2 power view
Publish your own toolkit notes using NPM
leetcode-2.回文判断
dried food! Accelerating sparse neural network through hardware and software co design
[ssrf-01] principle and utilization examples of server-side Request Forgery vulnerability
Global and Chinese market of wheelchair climbing machines 2022-2028: Research Report on technology, participants, trends, market size and share
[depth first search] Ji Suan Ke: Betsy's trip