Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add camera follow entity feature #554

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Likhithsai2580
Copy link
Contributor

Fixes #538

Add functionality for the camera to follow an entity.

  • Camera Class (genesis/vis/camera.py)

    • Add _follow_entity, _follow_height, and _follow_smoothing attributes.
    • Add follow_entity method to set the camera to follow a specified entity.
    • Update render method to call follow_entity if enabled.
  • Scene Class (genesis/engine/scene.py)

    • Add set_camera_follow_entity method to set the camera to follow a specified entity.
    • Update step method to call set_camera_follow_entity if enabled.
  • Drone Example (examples/drone/interactive_drone.py)

    • Add --follow argument to enable camera follow.
    • Update main function to use follow_entity method if --follow argument is provided.

Fixes Genesis-Embodied-AI#538

Add functionality for the camera to follow an entity.

* **Camera Class (`genesis/vis/camera.py`)**
  - Add `_follow_entity`, `_follow_height`, and `_follow_smoothing` attributes.
  - Add `follow_entity` method to set the camera to follow a specified entity.
  - Update `render` method to call `follow_entity` if enabled.

* **Scene Class (`genesis/engine/scene.py`)**
  - Add `set_camera_follow_entity` method to set the camera to follow a specified entity.
  - Update `step` method to call `set_camera_follow_entity` if enabled.

* **Drone Example (`examples/drone/interactive_drone.py`)**
  - Add `--follow` argument to enable camera follow.
  - Update `main` function to use `follow_entity` method if `--follow` argument is provided.
@CarlosMagni
Copy link

CarlosMagni commented Jan 13, 2025

I had an error while running the Drone Example with --follow, it says :
gs.raise_exception("Scene is already built.")
[Genesis] [23:33:32] [ERROR] Scene is already built.

Actually it seems logical as you're trying to add a cam to the scene after the build()
However when I tried to move the build function after adding the new cam I got another error

.pyenv/versions/3.10.10/lib/python3.10/site-packages/genesis/engine/scene.py", line 935, in set_camera_follow_entity
camera.follow_entity(entity, height, smoothing)
TypeError: Camera.follow_entity() takes 1 positional argument but 4 were given

Hope this help

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Feature request : Camera able to follow an entity
2 participants