Comments (3)
Hi @yzhao334 , thank you for reporting this bug.
Can you provide me a minimal code to reproduce this bug? (it's a good practice when you open issues on GitHub)
I tried to reset the environment and the robot comes back to its initial position every time:
import gym
import panda_gym
env=gym.make('PandaReach-v1')
# initial reset
obs = env.reset()
print(obs['observation'])
#[ 3.84396701e-02 -2.19447219e-12 1.97400143e-01 0.00000000e+00 -0.00000000e+00 0.00000000e+00]
# make a litlle move
obs, _, _, _ = env.step([0.5, 0.5, 0.5])
print(obs['observation'])
#[0.05003328 0.0178855 0.21331219 0.25930479 0.34940061 0.3846675 ]
# reset
obs = env.reset()
print(obs['observation'])
# [ 3.84396701e-02 -2.19447219e-12 1.97400143e-01 0.00000000e+00 -0.00000000e+00 0.00000000e+00]
from panda-gym.
Hi @qgallouedec, thanks a lot for replying. I was enabling real time simulation of pybullet for realistic object movement, such as dropping the cube when not grasping properly. I have found that the default setting does not show this issue, but the robot does not return to the default initial position when real time simulation is enabled.
I am attaching the code as below.
import gym
import panda_gym
import pybullet as p
env=gym.make('PandaPickAndPlace-v1',render=True)
# enable real time simulation for more realistic object interaction
p.setRealTimeSimulation(True)
# initial reset
obs = env.reset()
print(obs['observation'])
# make an obvious move
for _ in range(30):
obs, _, _, _ = env.step([0.5, -0.5*5.0/3.0, 0, 0])
print(obs['observation'])
# reset
obs = env.reset()
print(obs['observation'])
from panda-gym.
To make the rendering more realistic, you should not use p.setRealTimeSimulation(True)
but env.render()
after each env.step(action)
:
for _ in range(30):
obs, _, _, _ = env.step([0.5, -0.5*5.0/3.0, 0, 0])
env.render() # waits just the right amount of time to make the render realistic
print(obs['observation'])
Explanation :
By default, pybullet waits for p.stepSimulation()
to step the simulation. I use it in this package. If you run p.setRealTimeSimulation(True)
, pybullet won't wait for p.stepSimulation()
to step the simulation. It will step whenever it wants (see Quickstart guide). And this is not what we want, since it makes the behaviour random (depending on the power of your computer among other things).
Instead, to have a realistic rendering, we simply make a pause that corresponds to the simulation step. This pause is made when you call env.render()
. (See the source code)
from panda-gym.
Related Issues (20)
- When is it panda-gym going to be compatible with python 3.11? HOT 1
- how to realize the sb3 train demo code with panda-gym? HOT 2
- Typo in the `core.py` script HOT 1
- Render screen is out of sync HOT 6
- `NAN` in the training HOT 1
- How to get `predict` data from a saved model? HOT 2
- TypeError: catching classes that do not inherit from BaseException is not allowed HOT 6
- Shape of `achieved_goal` and `desired_goal` HOT 6
- Discussion about the future work HOT 9
- Decreasing Size of Action Space HOT 2
- Compatibility of gym-0.24 branch? HOT 2
- panda-gym v2 error; "TypeError: catching classes that do not inherit from BaseException is not allowed". HOT 2
- Clarification about 'observation', 'achieved_goal' and 'desired_goal' HOT 5
- Flip and Stack question HOT 3
- change the observation and return HOT 1
- reproduce the results HOT 1
- reproduce the results HOT 2
- Set to move in a two-dimensional plane HOT 6
- Clarification about the observation or system state returned by the task class HOT 1
- Can the SAC algorithm without using HER converge in some of the environments in this project?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from panda-gym.