def __init__(self,
                 bounds,
                 robot,
                 collider,
                 lamp,
                 milestones,
                 base_height_link=2,
                 robot_height=1.5,
                 float_height=0.08,
                 linear_dofs=[0, 1],
                 angular_dofs=[4, 5, 6, 7, 8],
                 light_local_position=[0, 0, 0]):
        CSpace.__init__(self)

        self.base_height_link = base_height_link
        #set bounds
        limits = robot.getJointLimits()
        limits[0][0] = 0
        limits[0][1] = 0
        limits[0][self.base_height_link] = 0
        limits[1][0] = bounds[0]
        limits[1][1] = bounds[1]
        limits[1][self.base_height_link] = 2
        # we also set all the joint limits of all joints that are not active to be
        # equal to their current positions:
        cfig = robot.getConfig()
        self.zero_cfig = np.array(cfig)
        tmp = set(linear_dofs + angular_dofs)
        tmp2 = set(list(range(len(cfig))))
        fixed_dofs = list(tmp2.difference(tmp))
        self.fixed_dofs = fixed_dofs
        for fixed_dof in fixed_dofs:
            limits[0][fixed_dof] = cfig[fixed_dof]
            limits[1][fixed_dof] = cfig[fixed_dof]
        robot.setJointLimits(limits[0], limits[1])
        self.lamp = lamp
        self.max_vals = limits[1] + [bounds[0], bounds[1], robot_height]
        self.min_vals = limits[0] + [0, 0, 0]
        bound = []
        for a, b in zip(self.min_vals, self.max_vals):
            bound.append((a, b))
        self.bound = bound
        self.milestones = milestones
        #set collision checking resolution
        self.eps = 0.01
        #setup a robot with radius 0.05
        self.robot = robot
        #set obstacles here
        self.collider = collider
        self.remaining_milestones = self.milestones[:]
        self.fraction = 1
        self.remaining = set(range(self.remaining_milestones.shape[0]))
        self.S = None
        self.clf = None
        self.linear_dofs = linear_dofs
        self.angular_dofs = angular_dofs
        self.local_lamp_coords = light_local_position
        self.counter = 0
Exemple #2
0
 def __init__(self, xRange, yRange, minDistance):
     CSpace.__init__(self)
     #set bounds
     self.bound = [(xRange[0], xRange[1]), (yRange[0], yRange[1])]
     #set collision checking resolution
     self.eps = 1e-3
     #set obstacles here
     self.obstacles = []
     self.minDistance = minDistance  # Sets the distance which a robot needs to exceed from any obstacle
Exemple #3
0
 def __init__(self):
     CSpace.__init__(self)
     #set bounds
     self.bound = [(0.0, 1.0), (0.0, 1.0), (0.0, math.pi * 2)]
     #set collision checking resolution
     self.eps = 1e-3
     #setup a bar with length 0.1
     self.L = 0.1
     #set obstacles here
     self.obstacles = []
Exemple #4
0
 def __init__(self):
     CSpace.__init__(self)
     #set bounds
     self.bound = [(0.0, 1.0), (0.0, 1.0)]
     #set collision checking resolution
     self.eps = 1e-3
     #setup a robot with radius 0.05
     self.robot = Circle(0, 0, 0.05)
     #set obstacles here
     self.obstacles = []
Exemple #5
0
 def __init__(self, x_bound=3.0, y_bound=3.0):
     CSpace.__init__(self)
     #set bounds
     self.bound = [(-2.0, x_bound), (-2.0, y_bound)]
     #set collision checking resolution
     self.eps = 0.025
     #setup a robot with radius 0.05
     self.robot = Circle(0, 0, 0.05)
     #set obstacles here
     self.obstacles = []
     self.fraction = 1
Exemple #6
0
 def __init__(self, globals):
     CSpace.__init__(self)
     self.globals = globals
     self.robot = globals.robot
     #initial whole-body configuratoin
     self.q0 = self.robot.getConfig()
     #setup CSpace sampling range
     qlimits = zip(*self.robot.getJointLimits())
     self.bound = [qlimits[i] for i in range(len(self.q0))]
     #setup CSpace edge checking epsilon
     self.eps = 1e-2
Exemple #7
0
 def __init__(self, world):
     CSpace.__init__(self)
     #set bounds
     self.bound = [(-5, 5), (-5, 5), (0, math.pi * 2)]
     #set collision checking resolution
     self.eps = 1e-1
     #get the robot (a RobotModel instance)
     self.robot = world.robot(0)
     #get obstacles here, these will be TerrainModel instances
     self.obstacles = [
         world.terrain(i) for i in xrange(world.numTerrains())
     ]
Exemple #8
0
 def __init__(self, globals, hand):
     CSpace.__init__(self)
     self.globals = globals
     self.robot = globals.robot
     self.hand = hand
     #initial whole-body configuratoin
     self.q0 = self.robot.getConfig()
     #setup CSpace sampling range
     qlimits = list(zip(*self.robot.getJointLimits()))
     self.bound = [qlimits[i] for i in self.hand.armIndices]
     #setup CSpace edge checking epsilon
     self.eps = 1e-2
Exemple #9
0
 def __init__(self, bounds, milestones):
     CSpace.__init__(self)
     #set bounds
     bound = []
     for a, b in zip(self.min_vals[:2], self.max_vals[:2]):
         bound.append((a, b))
     self.bound = bound
     self.milestones = milestones
     #set collision checking resolution
     self.eps = 0.05
     #setup a robot with radius 0.05
     #set obstacles here
     self.remaining_milestones = self.milestones[:]
     self.fraction = 1
Exemple #10
0
 def __init__(self, globals, hand, object):
     CSpace.__init__(self)
     self.globals = globals
     self.robot = globals.robot
     self.hand = hand
     self.object = object
     #initial whole-body configuratoin
     self.q0 = self.robot.getConfig()
     #setup initial grasp transform
     Tobj0 = object.getTransform()
     self.Tgrasp = graspTransform(self.robot, hand, self.q0, Tobj0)
     #setup CSpace sampling range
     qlimits = zip(*self.robot.getJointLimits())
     self.bound = [qlimits[i] for i in self.hand.armIndices]
     #setup CSpace edge checking epsilon
     self.eps = 1e-2
 def __init__(self):
     CSpace.__init__(self)
     self.bound = [[0, 1], [0, 1]]
     self.bmin = [0, 0]
     self.bmax = [1, 1]
     self.obstacles = []