jjshoots / PyFlyt

UAV Flight Simulator for Reinforcement Learning Research
https://taijunjet.com/PyFlyt/documentation.html
MIT License
100 stars 18 forks source link

[Question]How to Change the Camera View in RGB Array Render Mode for Drone in PyFlyt #62

Closed ItsBean closed 4 weeks ago

ItsBean commented 4 weeks ago

Hi,

I'm currently working with the PyFlyt/QuadX-Ball-In-Cup-v2 environment using gymnasium and have set the render_mode to 'rgb_array'. The environment currently returns a first-person view from the drone's perspective.

If I want the environment to return a third-person view instead, how should I modify my code to achieve this?

env = gymnasium.make("PyFlyt/QuadX-Ball-In-Cup-v2", render_mode='rgb_array')
jet-sony commented 4 weeks ago

You can set it to "human". :)

https://github.com/jjshoots/PyFlyt/blob/master/PyFlyt/gym_envs/quadx_envs/quadx_base_env.py#L311

I think there is probably a better naming scheme for the render mode, and documentation can also probably be amended.

jet-sony commented 4 weeks ago

Unfortunately, there is no clean way to alter the view of the visualizer camera. Instead, I directly modify these values to obtain the gifs https://github.com/jjshoots/PyFlyt/blob/master/PyFlyt/core/aviary.py#L216