Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

get_model StringIO usage #11

Closed
suraj-nair-1 opened this issue Dec 1, 2018 · 0 comments
Closed

get_model StringIO usage #11

suraj-nair-1 opened this issue Dec 1, 2018 · 0 comments

Comments

@suraj-nair-1
Copy link

In robosuite/models/base.py, why does the get_model() function use StringIO? Can't load_model_from_xml directly take a string? The current way appears to create a new .xml file under /tmp/ every time it is called.

def get_model(self, mode="mujoco_py"):
        """
        Returns a MjModel instance from the current xml tree.
        """

        available_modes = ["mujoco_py"]
        with io.StringIO() as string:
            string.write(ET.tostring(self.root, encoding="unicode"))
            if mode == "mujoco_py":
                from mujoco_py import load_model_from_xml

                model = load_model_from_xml(string.getvalue())
                return model
            raise ValueError(
                "Unkown model mode: {}. Available options are: {}".format(
                    mode, ",".join(available_modes)
                )
            )
anchit pushed a commit that referenced this issue Apr 15, 2019
@yukezhu yukezhu closed this as completed May 22, 2020
yukezhu added a commit that referenced this issue Sep 27, 2020
functionality to get other sensor signals and the ft sensor
yukezhu pushed a commit that referenced this issue Sep 29, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants