当前位置:网站首页>【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
边栏推荐
- Numpy array index slice
- PHP campus financial management system for computer graduation design
- 【Flask】静态文件与模板渲染
- GBase 8c数据库升级报错
- Paddle框架:PaddleNLP概述【飛槳自然語言處理開發庫】
- Alibaba canal usage details (pit draining version)_ MySQL and ES data synchronization
- Campus second-hand transaction based on wechat applet
- 2022年PMP项目管理考试敏捷知识点(8)
- Competition question 2022-6-26
- Basic operations of database and table ----- delete data table
猜你喜欢
Computer graduation design PHP campus restaurant online ordering system
Online reservation system of sports venues based on PHP
Redis如何实现多可用区?
PHP campus financial management system for computer graduation design
leetcode-两数之和
MySQL index
[depth first search] Ji Suan Ke: Betsy's trip
国家级非遗传承人高清旺《四大美人》皮影数字藏品惊艳亮相!
使用npm发布自己开发的工具包笔记
Redis-字符串类型
随机推荐
Paddle框架:PaddleNLP概述【飞桨自然语言处理开发库】
Xshell 7 Student Edition
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
Tensorflow customize the whole training process
Use the list component to realize the drop-down list and address list
[flask] official tutorial -part1: project layout, application settings, definition and database access
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
The intelligent material transmission system of the 6th National Games of the Blue Bridge Cup
Reasonable and sensible
Initialize MySQL database when docker container starts
剑指 Offer 12. 矩阵中的路径
阿里测开面试题
Selenium waiting mode
SPI communication protocol
VIM usage guide
02.Go语言开发环境配置
Use Scrollview and tabhost to realize vertical scrollbars and tabs
【Flask】获取请求信息、重定向、错误处理
Derivation of Biot Savart law in College Physics
Basic operations of database and table ----- delete data table