Farama-Foundation / Gymnasium-Robotics

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

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

Closed AlexandreBrown closed 3 months ago

AlexandreBrown commented 3 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 3 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 3 months ago

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