Code Monkey home page Code Monkey logo

Comments (4)

TheEimer avatar TheEimer commented on June 16, 2024

Thanks for the issue - I suspect a version upgrade in DM we don't cover yet, will investigate!

from carl.

TheEimer avatar TheEimer commented on June 16, 2024

We'll definitely need more information here @sai-prasanna , since we haven't been able to reproduce this issue with your or an older dm_control version:

  • what is the exact gravity value and how do you get it? I'd assume you use 'env.env.env.physics.model.opt' to inspect the physics of the environment?
  • which environments did you try this with specifically? Did you reset them before checking (since instance changing happens in reset)?
  • since you installed carl at a specific commit that doesn't seem to be the latest one: is there a specific reason for that? Does it work on the current main branch?
  • does you environment instantiate at all? MuJoCo gravity is usually an array with x,y and z gravity where we only change z gravity, a single zero value should cause issues here

from carl.

sai-prasanna avatar sai-prasanna commented on June 16, 2024

Sorry for the late reply got tied up with some work and then vacations.

I am using the v1.0.0 tag just to have it in the release version. Here is my sample code.

from carl.envs.dmc.carl_dm_walker import CARLDmcWalkerEnv
import numpy as np
import matplotlib.pyplot as plt
import imageio
from carl.context.selection import StaticSelector
from carl.envs.dmc import CARLDmcWalkerEnv
contexts = None
frames = []
env = CARLDmcWalkerEnv(contexts={0: CARLDmcWalkerEnv.get_default_context()})
env.reset()
for i in range(1000):
    action = env.action_space.sample()
    state, reward, terminated, truncated, info = env.step(action=action)
    frames.append(env.render())
imageio.mimsave('video.mp4', frames, fps=30)

This answers some of your questions (1, 2, 3). The environment does instantiate (4).

With random actions, I would assume the walker would writhe on the ground unable to walk, but inspecting the video, it's floating. Am I wrong in assuming this?

video.mp4

env.env.env.physics.model.opt has the following value

<MjOption
  apirate: 100.0
  cone: 0
  density: 0.0
  disableactuator: 0
  disableflags: 0
  enableflags: 0
  gravity: array([0.  , 0.  , 9.81])
  impratio: 1.0
  integrator: 0
  iterations: 100
  jacobian: 2
  ls_iterations: 50
  ls_tolerance: 0.01
  magnetic: array([ 0. , -0.5,  0. ])
  mpr_iterations: 50
  mpr_tolerance: 1e-06
  noslip_iterations: 0
  noslip_tolerance: 1e-06
  o_friction: array([1.e+00, 1.e+00, 5.e-03, 1.e-04, 1.e-04])
  o_margin: 0.0
  o_solimp: array([9.0e-01, 9.5e-01, 1.0e-03, 5.0e-01, 2.0e+00])
  o_solref: array([0.02, 1.  ])
  sdf_initpoints: 40
  sdf_iterations: 10
  solver: 2
  timestep: 0.0025
  tolerance: 1e-08
  viscosity: 0.0
  wind: array([0., 0., 0.])
>

Now I tried directly loading vanilla dm control environment (used this wrapper to convert it to gymnasium). It works properly. So I think the bug is isolated to CARL rather than my dmcontrol setup being wacky.

video.mp4

from carl.

TheEimer avatar TheEimer commented on June 16, 2024

Found the issue! We refactored these recently and added the sins of the bounds in the wrong order. I pushed a fix on development, locally your example now gives me the video below. Let me know if it works for you!

video.mp4

from carl.

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.