ompl
ompl copied to clipboard
Trouble benchmarking with custom optimization objetives
I tried to create a benchmark in Python with a custom OptimizationObjective e.g.:
class DummyObjective(ob.OptimizationObjective):
def __init__(self, si):
super(DummyObjective, self).__init__(si)
self.si_ = si
def motionCost(self, s1, s2):
return ob.Cost(self.si_.distance(s1, s2))
I then added it using simple setup: ss.setOptimizationObjective(DummyObjective(si)) but I get a TypeError: 'NoneType' object is not callable error when running the benchmark.
The optimisation works when doing path planning without benchmarking.
Also, using regular pathlength for the optimization objective works as does the clearance objective mentioned in the demos:
class ClearanceObjective(ob.StateCostIntegralObjective):
def __init__(self, si):
super(ClearanceObjective, self).__init__(si, True)
self.si_ = si
def stateCost(self, s):
return ob.Cost(1 / (self.si_.getStateValidityChecker().clearance(s) +
sys.float_info.min))
Any idea what I'm doing wrong? Thanks!
stateCost needs to be implemented in your optimization objective.