[FEATURE] Camera and viewer able to follow and entity#611
[FEATURE] Camera and viewer able to follow and entity#611YilingQiao merged 1 commit intoGenesis-Embodied-AI:mainfrom
Conversation
|
Thanks for your PR. It works great on my side. |
|
I merged this PR, removed the examples on Go2, and kept only the drone example because I do not want to modify the Go2 example. I will also add more documentation about this feature. |
|
Thank you for your effort. I am looking for the same feature for recording robots' action. I followed the instruction above and added a new camera/visualizer that can freely move along all axes for recording. It turns out that the camera never follow the loaded robot. Here is the code for minimal reproduction. Run GS.py, then you will get a video.mp4 of 4 seconds. Based on what I can tell from the video, the camera never moves. Do I miss any point? Thank you in advance. |
|
Thanks for the comment. i found the bug and it's related to the TODO in the end of my first post, your code work if you build multiple env with |
|
A temproal fix: use 'scene.build(n_envs=1)' instead of 'scene.build()'. I think I found the bug. When we do not pass the Here is my idea: use Btw, I feel that the camera is not following my robot the way I expercted. I want it to move and look at somewhere like eyes. Setting |
|
thanks for the insight, I'll look into your change and submit it, concerning your second point you might want to look at #618 wich mount a camera to a link, my code is rather used to follow an entity while looking at it to monitor the locomotion of an agent in training for exemple, not to see the world through its eyes. |
Fixes #538 and #554
Hello !
I made changes to the camera and viewer class so that they can now follow an entity in various ways.
For both the viewer and any camera, once they are created, you can :
In this code both the viewer and follower_camera will follow the entity. The viewer will be rigidly linked to the entity, no smoothing (a bit nauseating if you do locomotion ahah!). The second one will have a smoothed motion on the xy plane and a fixed height of 0.5m.
fixed_axisis used to fix the camera movement on a chosen axis[x, y, z], if set toNonethe camera is able to move on this axis during the following. If set to a float the camera will stay fixed at this value on this axis. This does not fix its orientation. Hence won't change where the camera looks at, just its position the camera can still look up with a fixed zfix_orientationis used alongside thefixed_axisbecause even though you fixed some axis the camera will rotate due to the call oflookat, this can lead to unwanted movement. For example, if fixed on the z height in a locomotion case the robot's gait might lead to some z movement and those would be repercuted on the camera orientation doing ups and downs.Added code
camera.py
follow_entityto register the followed entity with some arguments related to the cameras' movementrenderfunction to compute the camera's position withupdate_followingviewer.py
interactive_drone.py
update_camerafunction since it is now redundant, the viewer is directly set to follow the dronego2_env.py
go2_train.py
-v/--visto enable the gui for the viewer and follower cameraExamples
You can run
TODO
The camera only follow the first env due to
camera.pyI don't really know how to get the id of each env here...