ravens/tasks/defs_bags.py
def add_bag(self, env, base_pos, base_orn, bag_color='yellow'):
        """Adding a bag from an .obj file."""
        bag_id = p.loadSoftBody(
                fileName=self._f_bag,
                basePosition=base_pos,
                baseOrientation=base_orn,
                collisionMargin=self._collisionMargin,
                scale=self._bag_scale,
                mass=self._mass,
                useNeoHookean=0,
                useBendingSprings=1,
                useMassSpring=1,
                springElasticStiffness=40,
                springDampingStiffness=0.1,
                springDampingAllDirections=0,
                useSelfCollision=1,
                frictionCoeff=1.0,
                useFaceContact=1,)

        # Only if using more recent PyBullet versions.
        p_version = pkg_resources.get_distribution('pybullet').version
        if p_version == '3.0.4':
            color = U.COLORS[bag_color] + [1]
            p.changeVisualShape(bag_id, -1, flags=p.VISUAL_SHAPE_DOUBLE_SIDED,
                                rgbaColor=color)
        else:
            raise ValueError(p_version)

        # For tracking IDs and consistency with existing ravens code.
        self._IDs[bag_id] = 'bag'
        self.object_points[bag_id] = np.float32((0, 0, 0)).reshape(3, 1)
        env.objects.append(bag_id)

        # To help environment pick-place method track all deformables.
        self.def_IDs.append(bag_id)

        return bag_id
Adding a bag from an .obj file.
Adding a bag from an .obj file.
Adding a bag from an . obj file .
def add_bag(self, env, base_pos, base_orn, bag_color='yellow'):
        bag_id = p.loadSoftBody(
                fileName=self._f_bag,
                basePosition=base_pos,
                baseOrientation=base_orn,
                collisionMargin=self._collisionMargin,
                scale=self._bag_scale,
                mass=self._mass,
                useNeoHookean=0,
                useBendingSprings=1,
                useMassSpring=1,
                springElasticStiffness=40,
                springDampingStiffness=0.1,
                springDampingAllDirections=0,
                useSelfCollision=1,
                frictionCoeff=1.0,
                useFaceContact=1,)
        p_version = pkg_resources.get_distribution('pybullet').version
        if p_version == '3.0.4':
            color = U.COLORS[bag_color] + [1]
            p.changeVisualShape(bag_id, -1, flags=p.VISUAL_SHAPE_DOUBLE_SIDED,
                                rgbaColor=color)
        else:
            raise ValueError(p_version)
        self._IDs[bag_id] = 'bag'
        self.object_points[bag_id] = np.float32((0, 0, 0)).reshape(3, 1)
        env.objects.append(bag_id)
        self.def_IDs.append(bag_id)
        return bag_id
def add_bag ( self , env , base_pos , base_orn , bag_color = 'yellow' ) : bag_id = p . loadSoftBody ( fileName = self . _f_bag , basePosition = base_pos , baseOrientation = base_orn , collisionMargin = self . _collisionMargin , scale = self . _bag_scale , mass = self . _mass , useNeoHookean = 0 , useBendingSprings = 1 , useMassSpring = 1 , springElasticStiffness = 40 , springDampingStiffness = 0.1 , springDampingAllDirections = 0 , useSelfCollision = 1 , frictionCoeff = 1.0 , useFaceContact = 1 , ) p_version = pkg_resources . get_distribution ( 'pybullet' ) . version if p_version == '3.0.4' : color = U . COLORS [ bag_color ] + [ 1 ] p . changeVisualShape ( bag_id , - 1 , flags = p . VISUAL_SHAPE_DOUBLE_SIDED , rgbaColor = color ) else : raise ValueError ( p_version ) self . _IDs [ bag_id ] = 'bag' self . object_points [ bag_id ] = np . float32 ( ( 0 , 0 , 0 ) ) . reshape ( 3 , 1 ) env . objects . append ( bag_id ) self . def_IDs . append ( bag_id ) return bag_id
Adding a bag from an .obj file.
Adding a bag from an . obj file .
"""Adding a bag from an .obj file.""" # Only if using more recent PyBullet versions. # For tracking IDs and consistency with existing ravens code. # To help environment pick-place method track all deformables.
self
env
base_pos
base_orn
bag_color