Hi,
My problem requires the path solved by motion planning to satisfy position and orientation constraints. I went through OMPL API and an example code of motion planning, it seems I need to write my custom isStateValidCallback function to overwrite the default one that only does collision checking. My question is, if I overwrite that, do I need to explicitly call collsiion checking along with constraint checking in this callback function? If so, which API should I use?
Add other constraint in OMPL task solver
Re: Add other constraint in OMPL task solver
Hello,
if you set-up a custom state validation routine with simOMPL.setStateValidationCallback, then you can do anything you want inside of the callback function: you can check for collision, you can check for joint angles, etc. The only important thing is to return a boolean value: if false or nil, the state is invalid, otherwise it is valid. So e.g. with:
all states would be valid.
See also the example scene in scenes/pathPlanning/state_validation_callback.ttt
Cheers
if you set-up a custom state validation routine with simOMPL.setStateValidationCallback, then you can do anything you want inside of the callback function: you can check for collision, you can check for joint angles, etc. The only important thing is to return a boolean value: if false or nil, the state is invalid, otherwise it is valid. So e.g. with:
Code: Select all
function stateValidation(state)
return true
end
See also the example scene in scenes/pathPlanning/state_validation_callback.ttt
Cheers
Re: Add other constraint in OMPL task solver
Yes.
The default state validity checking uses sim.checkCollision to determine validity of a state.
If a custom state validity checking function is set, the default state validity checking will not be used, therefore if you also want to check for collision, you need to replicate that behavior, by using simOMPL.readState, simOMPL.writeState, sim.checkCollision, etc...