OMPL plugin

Typically: "How do I... ", "How can I... " questions
yokhesh
Posts: 8
Joined: 04 Apr 2017, 19:43

OMPL plugin

Postby yokhesh » 09 Apr 2017, 00:55

Hi,

I am using OMPL plugin in V-rep for my path planning simulation.
I have added my obstacles in a collection and specified it in the program using the following command

v = simGetCollectionHandle('obstacles')
simExtOMPL_setCollisionPairs(t,{simGetObjectHandle('l_start'),v})

l_start is my object in the starting position. v is my collection handle.
But still, the path created for my robot collides with one of the obstacles in the collection and my robot goes through the obstacle.
I tried finding out any mistake but I was unable to do it.
Please let me know any possible mistake I could have made. If required, I can send my entire code.

Thank you

coppelia
Site Admin
Posts: 6133
Joined: 14 Dec 2012, 00:25

Re: OMPL plugin

Postby coppelia » 10 Apr 2017, 08:35

Please post your scene.

Cheers

yokhesh
Posts: 8
Joined: 04 Apr 2017, 19:43

Re: OMPL plugin

Postby yokhesh » 11 Apr 2017, 03:15

Hi,

I am posting the code that I used. I took the demo program as an example and made the certain modification.
Please let me know what is wrong with my code.
The code is as follows:
visualizePath=function(path)
if not _lineContainer then
_lineContainer=simAddDrawingObject(sim_drawing_lines,3,0,-1,99999,{0.2,0.2,0.2})
end
simAddDrawingObjectItem(_lineContainer,nil)
if path then
local pc=#path/3
for i=1,pc-1,1 do
lineDat={path[(i-1)*3+1],path[(i-1)*3+2],initPos[3],path[i*3+1],path[i*3+2],initPos[3]}
simAddDrawingObjectItem(_lineContainer,lineDat)
end
end
end


robotHandle=simGetObjectHandle('start')
targetHandle=simGetObjectHandle('final_target')
v = simGetCollectionHandle('obstacles')
initPos=simGetObjectPosition(robotHandle,-1)
initOrient=simGetObjectOrientation(robotHandle,-1)
t=simExtOMPL_createTask('t')
ss={simExtOMPL_createStateSpace('2d',sim_ompl_statespacetype_pose2d,robotHandle,{-0.5,-0.5},{0.5,0.5},1)}
simExtOMPL_setStateSpace(t,ss)
simExtOMPL_setAlgorithm(t,sim_ompl_algorithm_RRTConnect)
simExtOMPL_setCollisionPairs(t,{simGetObjectHandle('l_start'),v})
startpos=simGetObjectPosition(robotHandle,-1)
startorient=simGetObjectOrientation(robotHandle,-1)
startpose={startpos[1],startpos[2],startorient[3]}
simExtOMPL_setStartState(t,startpose)
goalpos=simGetObjectPosition(targetHandle,-1)
goalorient=simGetObjectOrientation(targetHandle,-1)
goalpose={goalpos[1],goalpos[2],goalorient[3]}
simExtOMPL_setGoalState(t,goalpose)
r,path=simExtOMPL_compute(t,4,-1,800)
while path do
visualizePath(path)
-- Simply jump through the path points, no interpolation here:
for i=1,#path-3,3 do
pos={path[i],path[i+1],initPos[3]}
orient={initOrient[1],initOrient[2],path[i+2]}
simSetObjectPosition(robotHandle,-1,pos)
simSetObjectOrientation(robotHandle,-1,orient)
simSwitchThread()
end
end

coppelia
Site Admin
Posts: 6133
Joined: 14 Dec 2012, 00:25

Re: OMPL plugin

Postby coppelia » 12 Apr 2017, 08:11

It is impossible to debug code without looking at the scene unfortunately. Please post the scene file (i.e. *.ttt file).

Cheers

yokhesh
Posts: 8
Joined: 04 Apr 2017, 19:43

Re: OMPL plugin

Postby yokhesh » 12 Apr 2017, 13:01

Hi,

I tried attaching the V-rep file (.ttt file).
But I could not find any option for attaching the file to the message.
Please let me know how do I attach the file.

Regards,
Yokhesh

coppelia
Site Admin
Posts: 6133
Joined: 14 Dec 2012, 00:25

Re: OMPL plugin

Postby coppelia » 12 Apr 2017, 13:03

Please share your file via dropbox, google drive, etc.

Cheers

yokhesh
Posts: 8
Joined: 04 Apr 2017, 19:43

Re: OMPL plugin

Postby yokhesh » 12 Apr 2017, 13:22

Hi,

Thank you.
I have uploaded the file on the google drive. I have mentioned the link below. Please have a look at it and let me know the mistake.
https://drive.google.com/file/d/0B_Tm2k ... sp=sharing

Regards,
Yokhesh

coppelia
Site Admin
Posts: 6133
Joined: 14 Dec 2012, 00:25

Re: OMPL plugin

Postby coppelia » 13 Apr 2017, 13:16

Your have following for your collision pairs:

shape vs (shape + dummy + dummy + dummy + dummy + dummy + dummy)

But you cannot detect collision between a shape and a dummy, since a shape does not have a volume (only octrees have volume). See details about collidable object.

Cheers


Return to “General questions”

Who is online

Users browsing this forum: DavideIng, Google [Bot], Yahoo [Bot] and 28 guests