def get_collection_paths(self,
                             owner='GoogleResearch',
                             collection='Google Scanned Objects',
                             server='https://fuel.ignitionrobotics.org',
                             server_version='1.0') -> List[str]:

        # First check the local cache (for performance)
        # Note: This unfortunately does not check if models belong to the specified collection
        # TODO: Make sure models belong to the collection if sampled from local cache
        model_paths = scenario_gazebo.get_local_cache_model_paths(owner=owner,
                                                                  name='')
        if len(model_paths) > 0:
            return model_paths

        # Else download the models from Fuel and then try again
        collection_uri = '%s/%s/%s/collections/%s' % (server, server_version,
                                                      owner, collection)
        download_command = 'ign fuel download -v 3 -t model -j %s -u "%s"' % (
            os.cpu_count(), collection_uri)
        os.system(download_command)

        model_paths = scenario_gazebo.get_local_cache_model_paths(owner=owner,
                                                                  name='')
        if 0 == len(model_paths):
            logger.error(
                'URI "%s" is not valid and does not contain any models that are \
                          owned by the owner of the collection' %
                collection_uri)
            pass

        return model_paths
示例#2
0
    def reset_base_velocity(self, linear_velocity: np.ndarray,
                            angular_velocity: np.ndarray) -> bool:
        assert linear_velocity.size == 3, \
            "Linear velocity should be a list with 3 elements"
        assert angular_velocity.size == 3, \
            "Angular velocity should be a list with 3 elements"

        if not self._is_floating_base:
            logger.error(
                "Changing the velocity of a fixed-base robot is not supported")
            return False

        ok_velocity = self.gympp_robot.resetBaseVelocity(
            linear_velocity.tolist(), angular_velocity.tolist())
        assert ok_velocity, "Failed to reset the base velocity"

        return True
示例#3
0
    def reset_base_pose(self, position: np.ndarray,
                        orientation: np.ndarray) -> bool:

        assert position.size == 3, "Position should be a list with 3 elements"
        assert orientation.size == 4, "Orientation should be a list with 4 elements"

        if not self._is_floating_base:
            logger.error(
                "Changing the pose of a fixed-base robot is not yet supported")
            logger.error("Remove and insert again the robot in the new pose")
            return False

        ok_pose = self.gympp_robot.resetBasePose(position.tolist(),
                                                 orientation.tolist())
        assert ok_pose, "Failed to set base pose"

        return True