[FEATURE] Camera and viewer able to follow and entity #611
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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_axis
is used to fix the camera movement on a chosen axis[x, y, z]
, if set toNone
the 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_orientation
is used alongside thefixed_axis
because 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_entity
to register the followed entity with some arguments related to the cameras' movementrender
function to compute the camera's position withupdate_following
viewer.py
interactive_drone.py
update_camera
function since it is now redundant, the viewer is directly set to follow the dronego2_env.py
go2_train.py
-v
/--vis
to enable the gui for the viewer and follower cameraExamples
You can run
TODO
The camera only follow the first env due to
camera.py
I don't really know how to get the id of each env here...