Skip to content

[Proposal] (Viewer) Camera Manager #179

Closed

Description

@btx0424

Proposal

It would be useful to have control over the default camera ("/OmniverseKit_Persp") for video recording during RL training, e.g., following a quadruped to traverse rough terrains. A simple solution would be adding a function that computes eye and lookat each time render is called.

A rough sketch of its implementation:

@configclass
class ViewerCfg:
    """Configuration of the scene viewport camera."""
    ...
    func: Callable = None
    """

class RLTaskEnv(BaseEnv):
    ...
    def render(self):
        if self.cfg.viewer.func is not None:
            eye, lookat = self.cfg.viewer.func(self)
            self.sim.set_camera_view(eye, lookat)
        ...

and we can therefore provide some functions to start with. For example, a position-following camera is like:

class FollowCameraFunc:
    def __init__(self, ...):
        self.asset_name = ...
        self.asset_id = ...

    def __call__(self, env):
        asset = env.scene[self.asset_name]
        pos = asset.data.root_pos_w[self.asset_index].cpu()
        return torch.as_tensor(env.cfg.viewer.eye) + pos, pos

I am glad to give a PR.

Checklist

  • I have checked that there is no similar issue in the repo (required)

Activity

  1. Mayankm96 commented on Dec 21, 2023

    @Mayankm96
    Contributor

    Nice idea! I had implemented something like this for the UI version:

    https://github.com/NVIDIA-Omniverse/Orbit/blob/devel/source/extensions/omni.isaac.orbit/omni/isaac/orbit/envs/ui/base_env_window.py#L156-L165

    We need to think of a smart way not to repeat this (and other UI-related code) twice. Let's discuss this in January when I'm back from vacation :)

  2. added
    enhancement
    on Dec 21, 2023
  3. Mayankm96 commented on Feb 27, 2024

    @Mayankm96
    Contributor

    We implemented a first version of this idea in the commit: 59e6c68

    It doesn't have a viewer function itself but does a fixed transform with the operation you mentioned above. If this doesn't complete your use case we can expose the operation as a function too.

    Please feel free to open this issue or create a new one.

  4. self-assigned this
    on Feb 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

enhancement

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions