Comments (6)
Thanks guys! I just composed a pull request.
One more thing I want to point out is that dm_control's Physics class also supports a scene_callback
keyword argument which can be very handy when rendering (e.g. using this argument to draw out arrows representing force vectors without adding actual arrows in the simulated environment). I can also make a pull request for this :) But do we need it?
from shimmy.
Not familiar with the details of how exactly to do multiple camera angles but we would be happy to accept a PR for this.
I would say to use a separate keyword argument to accomplish this rather than modifying render_mode because thatβs reserved for toggling between human rendering/unrendered envs.
from shimmy.
@realquantumcookie Is it possible in dm-control? If so, could you provide some example code for it?
from shimmy.
@realquantumcookie Is it possible in dm-control? If so, could you provide some example code for it?
What I meant is we compose multiple calls to physics.render() and stich the images together.
def _internal_render(
self,
mode='rgb_array',
height: int = HEIGHT,
width: int = WIDTH,
camera_id: typing.Optional[typing.Union[str, int]] = None,
scene_callback = None
):
assert mode in [
'human', 'rgb_array'
], 'only support rgb_array and human mode, given %s' % mode
if mode == "human":
self._get_viewer().render()
return
else:
physics = self._env.physics
if camera_id is not None:
return physics.render(
camera_id=camera_id,
height=height,
width=width,
)
# If no camera_id is specified, render all cameras in a grid.
num_cameras = physics.model.ncam
num_columns = int(math.ceil(math.sqrt(num_cameras)))
num_rows = int(math.ceil(float(num_cameras) / num_columns))
frame = np.zeros((num_rows * height, num_columns * width, 3), dtype=np.uint8)
for col in range(num_columns):
for row in range(num_rows):
camera_id = row * num_columns + col
if camera_id >= num_cameras:
break
subframe = physics.render(
camera_id=camera_id, height=height, width=width, scene_callback=scene_callback, scene_option=_SCENE_OPTION
)
frame[
row * height : (row + 1) * height, col * width : (col + 1) * width
] = subframe
return frame
from shimmy.
Wow, impressive code.
Yes I think we would be happy to include if you make a PR for the change.
I think we might want an additional render type, multi-camera
maybe specify that this is different from rgb_array
or human
.
from shimmy.
Sure, it is nice to enable all of the fancy dm-control features for the compatibility wrapper
from shimmy.
Related Issues (20)
- Cannot use supersuit color_reduction_v0 with Shimmy HOT 2
- PettingZoo Update breaks Shimmy HOT 1
- meaning of gym v21 HOT 2
- [Bug] incompatible with latest version of Meltingpot HOT 1
- [Bug] Melting pot wrapper fails with newer versions of pettingzoo's tests.
- MeltingPotCompatabilityV0 & supersuit concat_vec_envs HOT 5
- Add support for Melting Pot scenarios HOT 6
- Bug in Shimmy v1.3.0 with DM-Control 1.0.15+: IndexError in 'torch.nn.modules.flatten' HOT 1
- Reasoning for rendering FPS for dm_control environments HOT 1
- API break with gym 26.0
- Options are being ignored HOT 1
- Check when importing gym wrappers
- Add support for dm ai-safety-gridworlds
- Checklist for Maturity HOT 2
- Not import all compatibility wrappers in `__init__.py`
- Import issue: AttributeError: module 'pettingzoo' has no attribute 'AECEnv'
- Add release notes on website
- Dependencies not fixed (pettingzoo issues) HOT 1
- Broken dm_control.viewer HOT 14
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 shimmy.