ravens/tasks/defs_bags.py
def add_random_box(self, env, max_total_dims):
        """Generate randomly shaped box, from aligning env.

        Make rand_x and rand_y add up to the max_total. Also, the aligning
        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.

        max_total_dims: Use to control how long we can make boxes. I would
            keep this value at a level making these boxes comparable to the
            cubes, if not smaller, used in bag-items-easy.
        """
        min_val = 0.015
        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_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] = 'random_box'
        return (box_id, box_size)
Generate randomly shaped box, from aligning env.

        Make rand_x and rand_y add up to the max_total. Also, the aligning
        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.

        max_total_dims: Use to control how long we can make boxes. I would
            keep this value at a level making these boxes comparable to the
            cubes, if not smaller, used in bag-items-easy.
        
Generate randomly shaped box, from aligning env.

Also returning the object size, so we can use it for later.

Use to control how long we can make boxes. I would
keep this value at a level making these boxes comparable to the
cubes, if not smaller, used in bag-items-easy.
Generate randomly shaped box from aligning env . Also returning the object size so we can use it for later . Use to control how long we can make boxes . I would keep this value at a level making these boxes comparable to the cubes if not smaller used in bag - items - easy .
def add_random_box(self, env, max_total_dims):
        min_val = 0.015
        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_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] = 'random_box'
        return (box_id, box_size)
def add_random_box ( self , env , max_total_dims ) : min_val = 0.015 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_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 ] = 'random_box' return ( box_id , box_size )
Generate randomly shaped box, from aligning env.
Generate randomly shaped box from aligning env .
"""Generate randomly shaped box, from aligning env.

        Make rand_x and rand_y add up to the max_total. Also, the aligning
        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.

        max_total_dims: Use to control how long we can make boxes. I would
            keep this value at a level making these boxes comparable to the
            cubes, if not smaller, used in bag-items-easy.
        """
self
env
max_total_dims