Beispiel #1
0
    def __init__(self, ppm_file, obs: list, start=(1, 1), goal=(1000, 1000)):
        self.ppm_ = ou.PPM()
        self.ppm_.loadFile(ppm_file)

        self.width = self.ppm_.getWidth()
        self.height = self.ppm_.getHeight()

        self.space = ob.RealVectorStateSpace()
        self.space.addDimension(0.0, self.width)
        self.space.addDimension(0.0, self.height)

        self.bounds = ob.RealVectorBounds(2)
        self.bounds.setLow(0)
        self.bounds.setHigh(1024)

        self.space.setBounds(self.bounds)
        self.cspace = oc.RealVectorControlSpace(self.space, 2)
        self.cbounds = ob.RealVectorBounds(2)
        self.cbounds.setLow(-1)
        self.cbounds.setHigh(1)
        self.cspace.setBounds(self.cbounds)

        self.setup = oc.SimpleSetup(self.cspace)
        self.obs = obs
        self.start = start
        self.goal = goal
Beispiel #2
0
    def __init__(self, ppm_file):
        self.ppm_ = ou.PPM()
        self.ppm_.loadFile(ppm_file)
        space = ob.RealVectorStateSpace()
        space.addDimension(0.0, self.ppm_.getWidth())
        space.addDimension(0.0, self.ppm_.getHeight())
        self.maxWidth_ = self.ppm_.getWidth() - 1
        self.maxHeight_ = self.ppm_.getHeight() - 1
        self.ss_ = og.SimpleSetup(space)

        # set state validity checking for this space
        self.ss_.setStateValidityChecker(ob.StateValidityCheckerFn(
            partial(Plane2DEnvironment.isStateValid, self)))
        space.setup()
        self.ss_.getSpaceInformation().setStateValidityCheckingResolution( \
            1.0 / space.getMaximumExtent())