Farama-Foundation / Gymnasium-Robotics

A collection of robotics simulation environments for reinforcement learning
https://robotics.farama.org/
MIT License
571 stars 91 forks source link

[Question] How to move agent to specific position or set camera to goal position? #214

Closed AlexandreBrown closed 8 months ago

AlexandreBrown commented 8 months ago

Question

Hi, I'm working on a goal-conditioned RL approach and would like to know if it is possible to move the camera of the environment or the agent to a specific user-provided (x,y,z) position.

My objective is to move the camera or the agent to the goal to capture the observation (pixels) near the goal.

Thanks

Kallinteris-Andreas commented 8 months ago

You have asked two separate questions.

1) move camera You will have to create a new camera And then use the camera_name argument.

https://gymnasium.farama.org/main/environments/mujoco/#rendering-arguments ( For creating a new camera you have to look to the MuJoCo documentation )

2) move the "Agent" 'I assume by that you mean to move the robot, To do so you simply have to change the position state (env.unwrapped.data.qpos)

Hope this helps.

AlexandreBrown commented 8 months ago

@Kallinteris-Andreas Thanks a lot for the quick feedback.
Your suggestion for moving the agent worked flawlessly.
Thanks again!