i have tried to use the OMPL library in order to plan a path for the 'irb360' model.
the path I'm corrently trying to generate shuld overcome an obstacle placed between the robot's platform and the target.
the code used is basically taken from the "simpleManipulatorPathPlanning.ttt" file at the CoppeliaSim scenes directory, with slight modifications.
Code: Select all
setIkMode(info)
local simJointHandles = ikDrivingJoints
local useForProjection = {1, 1, 1, 1}
local config = {-0.4136, -0.0256, -0.0555, 0*math.pi/180}
if configurationValidationCallback(config,info) then
local msg = "'found a collision-free configuration'"
sim.addLog(sim.verbosity_scriptinfos,msg)
-- found a collision-free config that matches the desired pose!
-- Now find a collision-free path (via path planning) that brings us from current config to the found config:
local task = simOMPL.createTask('task')
simOMPL.setAlgorithm(task,simOMPL.Algorithm.RRTConnect)
simOMPL.setStateSpaceForJoints(task,simJointHandles,useForProjection)
simOMPL.setCollisionPairs(task,{robotCollection,sim.handle_all})
simOMPL.setStartState(task,getConfig(info))
simOMPL.setGoalState(task,config)
-- now we could add more goal states with simOMPL.addGoalState, to increase the chance to find a collision-free path.
-- But we won't do it for simplicity's sake
simOMPL.setup(task)
res, path = simOMPL.compute(task,4,-1,300)
if res and path then
msg = "'found a collision-free path'"
sim.addLog(sim.verbosity_scriptinfos,msg)
-- We found a collision-free path
-- Now move along the path in a very simple way:
local sw = sim.setStepping(true)
for i=1,simOMPL.getPathStateCount(task,path) do
local conf = simOMPL.getPathState(task,path,i)
--setConfig(conf,nil,nil,structuralParameters)
moveToConfig(maxAngVel,maxAngAccel,maxAngJerk,conf,info)
sim.step()
end
sim.setStepping(sw)
else
local msg = "'haven't found a collision-free path'"
sim.addLog(sim.verbosity_scriptinfos,msg)
end
simOMPL.destroyTask(task)
else
local msg = "'haven't found a collision-free configuration'"
sim.addLog(sim.verbosity_scriptinfos,msg)
end
1. the robot's objects "linkL(i)"are not collidable.
2. the object is inside the robot's workspace
3. there is a fisible path which doesn't collids within the robot's workspace
as Im new to the program and its API's function, i recon it doesnt as simple as I took it for my first try.
I have wanted to ask whether you would be able to give me a short intoduction regarding what should I configure differently for that task? (if it is not too much)
and/or where can I find information about how I should I use that library?
thanks