Giter Site home page Giter Site logo

New Planner in Python about ompl HOT 2 CLOSED

sadiq26 avatar sadiq26 commented on June 16, 2024
New Planner in Python

from ompl.

Comments (2)

joao-pm-santos96 avatar joao-pm-santos96 commented on June 16, 2024

like this?

class RandomWalkPlanner(ob.Planner):
def __init__(self, si):
super(RandomWalkPlanner, self).__init__(si, "RandomWalkPlanner")
self.states_ = []
self.sampler_ = si.allocStateSampler()
def solve(self, ptc):
pdef = self.getProblemDefinition()
goal = pdef.getGoal()
si = self.getSpaceInformation()
pi = self.getPlannerInputStates()
st = pi.nextStart()
while st:
self.states_.append(st)
st = pi.nextStart()
solution = None
approxsol = 0
approxdif = 1e6
while not ptc():
rstate = si.allocState()
# pick a random state in the state space
self.sampler_.sampleUniform(rstate)
# check motion
if si.checkMotion(self.states_[-1], rstate):
self.states_.append(rstate)
sat = goal.isSatisfied(rstate)
dist = goal.distanceGoal(rstate)
if sat:
approxdif = dist
solution = len(self.states_)
break
if dist < approxdif:
approxdif = dist
approxsol = len(self.states_)
solved = False
approximate = False
if not solution:
solution = approxsol
approximate = True
if solution:
path = og.PathGeometric(si)
for s in self.states_[:solution]:
path.append(s)
pdef.addSolutionPath(path)
solved = True
return ob.PlannerStatus(solved, approximate)
def clear(self):
super(RandomWalkPlanner, self).clear()
self.states_ = []

from ompl.

zkingston avatar zkingston commented on June 16, 2024

This is correct!

from ompl.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.