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

Why I got some dark images? #25

Closed
kaixindelele opened this issue Mar 25, 2019 · 5 comments
Closed

Why I got some dark images? #25

kaixindelele opened this issue Mar 25, 2019 · 5 comments

Comments

@kaixindelele
Copy link

Hi,
When I try to save some images I found there are some black in the normal images.
I want to know how can I avoid it and if I don't render the env, will it exist?
the dark images:
image_10
image_20

the normal image:
image_0

thanks a lot!

@kaixindelele
Copy link
Author

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()

@amandlek
Copy link
Member

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?

@kaixindelele
Copy link
Author

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~

@amandlek
Copy link
Member

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.

@kaixindelele
Copy link
Author

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

cremebrule pushed a commit that referenced this issue Nov 14, 2022
Update Tests and Fix Sawyer IK EEF Bug
@yukezhu yukezhu mentioned this issue Dec 1, 2022
yukezhu added a commit that referenced this issue Dec 1, 2022
# robosuite 1.4.0 Release Notes
- Highlights
- New Features
- Improvements
- Critical Bug Fixes
- Other Bug Fixes

# Highlights
This release of robosuite refactors our backend to leverage DeepMind's new [mujoco](https://github.com/deepmind/mujoco) bindings. Below, we discuss the key details of this refactoring:

## Installation
Now, installation has become much simpler, with mujoco being directly installed on Linux or Mac via `pip install mujoco`. Importing mujoco is now done via `import mujoco` instead of `import mujoco_py`

## Rendering
The new DeepMind mujoco bindings do not ship with an onscreen renderer. As a result, we've implented an [OpenCV renderer](https://github.com/ARISE-Initiative/robosuite/blob/master/robosuite/utils/opencv_renderer.py), which provides most of the core functionality from the original mujoco renderer, but has a few limitations (most significantly, no glfw keyboard callbacks and no ability to move the free camera).

# Improvements
The following briefly describes other changes that improve on the pre-existing structure. This is not an exhaustive list, but a highlighted list of changes.

- Standardize end-effector frame inference (#25). Now, all end-effector frames are correctly inferred from raw robot XMLs and take into account arbitrary relative orientations between robot arm link frames and gripper link frames.

- Improved robot textures (#27). With added support from DeepMind's mujoco bindings for obj texture files, all robots are now natively rendered with more accurate texture maps.

- Revamped macros (#30). Macros now references a single macro file that can be arbitrarily specified by the user.

- Improved method for specifying GPU ID (#29). The new logic is as follows:
  1. If `render_device_gpu_id=-1`, `MUJOCO_EGL_DEVICE_ID` and `CUDA_VISIBLE_DEVICES` are not set, we either choose the first available device (usually `0`) if `macros.MUJOCO_GPU_RENDERING` is `True`, otherwise use CPU;
  2. `CUDA_VISIBLE_DEVICES` or `MUJOCO_EGL_DEVICE_ID` are set, we make sure that they dominate over programmatically defined GPU device id.
  3. If `CUDA_VISIBLE_DEVICES` and `MUJOCO_EGL_DEVICE_ID` are both set, then we use `MUJOCO_EGL_DEVICE_ID` and make sure it is defined in `CUDA_VISIBLE_DEVICES`

- robosuite docs updated

- Add new papers


# Critical Bug Fixes
- Fix Sawyer IK instability bug (#25)


# Other Bug Fixes
- Fix iGibson renderer bug (#21)


-------

## Contributor Spotlight
We would like to introduce the newest members of our robosuite core team, all of whom have contributed significantly to this release!
@awesome-aj0123
@snasiriany
@zhuyifengzju
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