Code Monkey home page Code Monkey logo

Comments (5)

kaixindelele avatar kaixindelele commented on May 31, 2024

the code:

import numpy as np
import robosuite as suite
import cv2

if __name__ == "__main__":

    # get the list of all environments
    a = suite.environments
    b = suite.environments.ALL_ENVS
    envs = sorted(suite.environments.ALL_ENVS)

    # print info and select an environment
    print("Welcome to Surreal Robotics Suite v{}!".format(suite.__version__))
    print(suite.__logo__)
    print("Here is a list of environments in the suite:\n")

    for k, env in enumerate(envs):
        print("[{}] {}".format(k, env))
    print()
    try:
        s = input(
            "Choose an environment to run "
            + "(enter a number from 0 to {}): ".format(len(envs) - 1)
        )
        # parse input into a number within range
        k = min(max(int(s), 0), len(envs))
    except:
        print("Input is not valid. Use 0 by default.")
        k = 0

    # initialize the task
    env = suite.make(
        envs[k],
        has_renderer=True,
        ignore_done=True,
        use_camera_obs=True,
        render_visual_mesh=True,
        control_freq=10,
    )
    env.reset()
    env.viewer.set_camera(camera_id=0)

    # do visualization
    for i in range(100):
        action = np.random.randn(env.dof)
        obs, reward, done, _ = env.step(action)

        image = obs['image']
        image = cv2.flip(image, 0)
        fileName = 'image_'+str(i)+'.jpg'
        cv2.imwrite(fileName, image)

        env.render()

from robosuite.

amandlek avatar amandlek commented on May 31, 2024

I just tried running your script on my Macbook, and it seems to work just fine. Can you give further details of what machine you're running on and how I might reproduce the error?

from robosuite.

kaixindelele avatar kaixindelele commented on May 31, 2024

I just tried running your script on my Macbook, and it seems to work just fine. Can you give further details of what machine you're running on and how I might reproduce the error?

thanks.
I run this script in ubuntu16.04.
when I remove the
env.render()
I will work fine.

if I add it after env.step(action), and save the image from obs["image"] can be randomly dark.

Now, when I found a way to avoid it just remove env.render(), so it may be not necessary rush to deal with it~

from robosuite.

amandlek avatar amandlek commented on May 31, 2024

Ah I see - we've also seen similar problems on Ubuntu when trying to render on screen and off screen simultaneously. This could be a problem with mujoco-py, we're not positive.

from robosuite.

kaixindelele avatar kaixindelele commented on May 31, 2024

may be a problem with mujoco-py and existed in ubuntu~
just remove env.render() may work well~

from robosuite.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.