Skip to content

Commit a420d72

Browse files
committed
Planning fix when path touches invalid state during simplifying.
1 parent 10cb690 commit a420d72

File tree

1 file changed

+22
-4
lines changed

1 file changed

+22
-4
lines changed

pyrep/backend/simAddOnScript_PyRep.lua

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -108,11 +108,29 @@ _findPath=function(goalConfigs,cnt,jointHandles,algorithm,collisionPairs)
108108
for i=1,cnt,1 do
109109
search_time = 4
110110
local res,_path=simOMPL.compute(task,search_time,-1,300)
111+
112+
-- Path can sometimes touch on invalid state during simplifying
111113
if res and _path then
112-
local _l=_getPathLength(_path, jointHandles)
113-
if _l<l then
114-
l=_l
115-
path=_path
114+
local is_valid=true
115+
local jhl=#jointHandles
116+
local pc=#_path/jhl
117+
for i=1,pc-1,1 do
118+
local config={}
119+
for j=1,jhl,1 do
120+
config[j]=_path[(i-1)*jhl+j]
121+
end
122+
is_valid=simOMPL.isStateValid(task, config)
123+
if not is_valid then
124+
break
125+
end
126+
end
127+
128+
if is_valid then
129+
local _l=_getPathLength(_path, jointHandles)
130+
if _l<l then
131+
l=_l
132+
path=_path
133+
end
116134
end
117135
end
118136
end

0 commit comments

Comments
 (0)