Comments (3)
Hello,
According to the python reference, the precedence of the "not" operator is higher than the precedence of the "and" operator which is higher than the precedence of the "or" operator.
Which means that:
done = (not np.isfinite(ob).all()) or (np.abs(ob[1]) > .2)
is equivalent to:
done = not np.isfinite(ob).all() or np.abs(ob[1]) > .2
ie the line of code in the repo.
Also,
notdone = np.isfinite(ob).all() and (np.abs(ob[1]) <= .2)
done = not notdone
is equivalent to:
done = not (np.isfinite(ob).all() and (np.abs(ob[1]) <= .2))
not:
done = not np.isfinite(ob).all() and (np.abs(ob[1]) <= .2)
due to the precedence of "not" over "and", the parenthesis are required.
from pybullet-gym.
Hi, thanks for pointing out.
Yes, I agree on both arguments
1.
Which means that:
done = (not np.isfinite(ob).all()) or (np.abs(ob[1]) > .2)
is equivalent to:
done = not np.isfinite(ob).all() or np.abs(ob[1]) > .2
The reason why I retain the parenthesis in (not np.isfinite(ob).all())
and (np.abs(ob[1]) > .2)
is to make the logic clear with less confusion.
notdone = np.isfinite(ob).all() and (np.abs(ob[1]) <= .2) done = not notdone
is equivalent to:
done = not (np.isfinite(ob).all() and (np.abs(ob[1]) <= .2))
not:
done = not np.isfinite(ob).all() and (np.abs(ob[1]) <= .2)
due to the precedence of "not" over "and", the parenthesis are required.
Thanks for pointing out my previous mistake in step1 but steps from step2 onwards are correct.
done = not (np.isfinite(ob).all() and (np.abs(ob[1]) <= .2))
is the same as my step2.
Thanks!
from pybullet-gym.
To conclude, the logic of
is equivalent to that in the original OpenAI Gym.
from pybullet-gym.
Related Issues (20)
- pybullet build error on macos 10.15.5 HOT 1
- Why are there references to extra "non-existent" links? HOT 2
- The bulit-in texture doesn't load correctly HOT 2
- HopperMuJoCoEnv HOT 7
- Feature request / Would like to contribute: Competitive Environments
- Rendering (mode='rgb_array') error
- How to Cite PyBullet-Gym HOT 2
- How to get the timestep of an environment? HOT 2
- How to set the environment status manually? HOT 2
- Recommended way to change the robot mass HOT 1
- Stopping render - relation between the simulation and rendering HOT 1
- AntMuJoCoEnv-v0 contains many unnecessary states. HOT 13
- robot out of view when using env.render('rgb_array')
- how to connect two arms' end-effectors
- New environment request: OpenAI's Safety Gym
- Python kernal crashing HOT 4
- apparent environment seed issues with ant environment
- Any suggestions on how to lock certain joints?
- AttributeError: 'HopperBulletEnv' object has no attribute '_p'
- Which version of gym does this lib support? HOT 1
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 pybullet-gym.