hanruihua / rl_rvo_nav

The source code of the [RA-L] paper "Reinforcement Learned Distributed Multi-Robot Navigation with Reciprocal Velocity Obstacle Shaped Rewards"
MIT License
180 stars 32 forks source link

How to change environment by adding dynamic and static obstacles? #2

Closed RuxueYan closed 2 years ago

RuxueYan commented 2 years ago

I've changed the environment using examples in the usage of intelligent-robot-simulator, but where can I implement this environment in gym_env and policy_train_process? Thank you.

1

Basically, how should we add all the varied environments like dynamic obstacles and different shapes of obstacles from 'Intelligent robot simulator' to this project? i.e. which file do we need to add or edit, or the reward function...

hanruihua commented 2 years ago

Hi, thanks for your interest on my work. To change the env in the training process, you can modify the file _trainworld.yaml directly in the policytrain folder or using your own yaml file by changing the argument --worldpath in the train_process.py.

Most of the environment can be set by the yaml file, such as the different size of obstacles. But for the dynamic obstacles, the function _obs_cirsstep is necessary to assignment velocity of obstacles. All these modifications can be transformed in the _stepir function in the mrnav.py

RuxueYan commented 2 years ago

Hi, thank you for your reply. I've successfully added dynamic obstacles to the environment under gym_test_world.yaml and gy_env_test.py by adding obs_cirs_stpe() in step_ir, but when I tried to run train_process the dynamic obstacles seem static, do I need to edit ppo.training_loop? And for static obstacles, it seems that the environment doesn't reset if robots collide with static obstacles, do I need to write a new VO reward function to fix it? Thank you very much.

hanruihua commented 2 years ago

Hi, I have added a file _dynamic_obstest.yaml to set the world with dynamic obstacles and added _obs_cirsstep() in step_ir in the latest version.

It works well. You can change the --world_path to _dynamic_obstest.yaml to use without other changes. The rvo reward function calculates these obstacles too.

RuxueYan commented 2 years ago

Hi, thank you so much for your help. But I noticed that dynamic obstacles on plots of train_process and pre_trained_model still seem static (obstacles don't move at all for an epoch), even though robots did avoid those obstacles in pre_trained_model. Is this normal? Thank you.

hanruihua commented 2 years ago

Hi, the normal animation with dynamic obstacles should be as follows, which is generated with the latest version by policy_test_pre_train.py

rl_rvo_dyna_obs

RuxueYan commented 2 years ago

Hi ruihua, It works well now. Thank you for your help, I will close the issue.