ravens/tasks/defs_bags.py
def add_block(self, env, block_name, max_total_dims):
        """Generate randomly shaped block for the goal based task.

        Similar to the random block method used for bag-items-hard.
        env uses a box with mass 0.1, but we can make ours lighter. But, will
        it cause the block to bounce too much when inserted in the bag?

        Also returning the object size, so we can use it for later.
        """
        #min_val = 0.025
        #assert min_val*2 <= max_total_dims, min_val
        #rand_x = np.random.uniform(min_val, max_total_dims - min_val)
        #rand_y = max_total_dims - rand_x
        #box_size = (rand_x, rand_y, 0.03)
        box_size = (0.045, 0.045, 0.030)  # may make it less susceptible to falling out

        box_pose = self.random_pose(env, box_size)
        box_template = 'assets/box/box-template.urdf'
        box_urdf = self.fill_template(box_template, {'DIM': box_size})
        box_id = env.add_object(box_urdf, box_pose)
        os.remove(box_urdf)
        self.color_random_brown(box_id)
        self.object_points[box_id] = np.float32((0, 0, 0)).reshape(3, 1)
        self._IDs[box_id] = block_name
        return (box_id, box_size)
Generate randomly shaped block for the goal based task.

        Similar to the random block method used for bag-items-hard.
        env uses a box with mass 0.1, but we can make ours lighter. But, will
        it cause the block to bounce too much when inserted in the bag?

        Also returning the object size, so we can use it for later.
        
Generate randomly shaped block for the goal based task.
Similar to the random block method used for bag-items-hard.
env uses a box with mass 0.1, but we can make ours lighter.

Also returning the object size, so we can use it for later.
Generate randomly shaped block for the goal based task . Similar to the random block method used for bag - items - hard . env uses a box with mass 0 . 1 but we can make ours lighter . Also returning the object size so we can use it for later .
def add_block(self, env, block_name, max_total_dims):
        box_size = (0.045, 0.045, 0.030)  
        box_pose = self.random_pose(env, box_size)
        box_template = 'assets/box/box-template.urdf'
        box_urdf = self.fill_template(box_template, {'DIM': box_size})
        box_id = env.add_object(box_urdf, box_pose)
        os.remove(box_urdf)
        self.color_random_brown(box_id)
        self.object_points[box_id] = np.float32((0, 0, 0)).reshape(3, 1)
        self._IDs[box_id] = block_name
        return (box_id, box_size)
def add_block ( self , env , block_name , max_total_dims ) : box_size = ( 0.045 , 0.045 , 0.030 ) box_pose = self . random_pose ( env , box_size ) box_template = 'assets/box/box-template.urdf' box_urdf = self . fill_template ( box_template , { 'DIM' : box_size } ) box_id = env . add_object ( box_urdf , box_pose ) os . remove ( box_urdf ) self . color_random_brown ( box_id ) self . object_points [ box_id ] = np . float32 ( ( 0 , 0 , 0 ) ) . reshape ( 3 , 1 ) self . _IDs [ box_id ] = block_name return ( box_id , box_size )
Generate randomly shaped block for the goal based task.
Generate randomly shaped block for the goal based task .
"""Generate randomly shaped block for the goal based task.

        Similar to the random block method used for bag-items-hard.
        env uses a box with mass 0.1, but we can make ours lighter. But, will
        it cause the block to bounce too much when inserted in the bag?

        Also returning the object size, so we can use it for later.
        """ #min_val = 0.025 #assert min_val*2 <= max_total_dims, min_val #rand_x = np.random.uniform(min_val, max_total_dims - min_val) #rand_y = max_total_dims - rand_x #box_size = (rand_x, rand_y, 0.03) # may make it less susceptible to falling out
self
env
block_name
max_total_dims