I'm using the OMPL plugin of CoppeliaSim to plan a path for a diferential robot (Pioneer 3dx) based on RRTstar Algorithm. I refered to the scenes/3DoFHolonomicPathPlanning.ttt and adapted it to my scene, but it doesn't works.
This is part of my code :
Code: Select all
robotHandle=sim.getObjectHandle('StartConfiguration')
targetHandle=sim.getObjectHandle('GoalConfiguration')
initPosit=sim.getObjectPosition(robotHandle,-1)
initOrient=sim.getObjectOrientation(robotHandle,-1)
t=simOMPL.createTask('t')
ss={simOMPL.createStateSpace('2d',simOMPL.StateSpaceType.pose2d,robotHandle,{-2.5,-2.5},
{2.5,2.5},1)}
simOMPL.setStateSpace(t,ss)
simOMPL.setAlgorithm(t,simOMPL.Algorithm.RRTstar)
simOMPL.setCollisionPairs(t,{sim.getObjectHandle('Pioneer_p3dx'),sim.handle_all})
startposit=sim.getObjectPosition(robotHandle,-1)
startorient=sim.getObjectOrientation(robotHandle,-1)
startpose={startposit[1],startposit[2],startorient[3]}
simOMPL.setStartState(t,startpose)
goalposit=sim.getObjectPosition(targetHandle,-1)
goalorient=sim.getObjectOrientation(targetHandle,-1)
goalpose={goalposit[1],goalposit[2],goalorient[3]}
simOMPL.setGoalState(t,goalpose)
ifSolved,path=simOMPL.compute(t,4,-1,800)
[simExtOMPL:warning] OMPL: e:\ompl-1.4.1-source\src\ompl\base\src\planner.cpp:248: RRTstar: Skipping invalid start state (invalid state)
[simExtOMPL:error] OMPL: e:\ompl-1.4.1-source\src\ompl\geometric\planners\rrt\src\rrtstar.cpp:193: RRTstar: There are no valid initial states!
I checked my Lua script many times, but I can't find any reasons about the returned error.
So I hope to get some suggestions. Please help me!
Thank you!