aqeelanwar / PEDRA

Programmable Engine for Drone Reinforcement Learning Applications
MIT License
267 stars 59 forks source link

The drone hits the wall and stuck at training in the loop in the env of indoor_vanleer. Could you help to modify the env or the drone settings? #58

Closed BenoitKAO closed 3 years ago

BenoitKAO commented 4 years ago

Thank you for your marvelous works!

I found the issue that the drone hits the wall and stuck at training in the loop in the env of indoor_vanleer.

Could you help to modify the env or the drone settings? Or could we modify the orientation of the drone in the starting point?

Here is the link of the recording video: https://youtu.be/E9hx_QkMAPE

Any help is appreciated.

aqeelanwar commented 4 years ago

Hello,

Did you change the environment initial position? The default values were supposed to work fine. Yes, you can modify the orientation of the drone at its initial position in the following module https://github.com/aqeelanwar/PEDRA/blob/eb4e69aa3650ea4a96ee89104007ceecf7fb715f/unreal_envs/initial_positions.py#L33

The third argument is the yaw angle, you can change that to change the yaw of the drone in its initial position.

BenoitKAO commented 4 years ago

Hi Aqeelanwar,

No, I did not change the environment initial position.

Following your webpage: https://github.com/aqeelanwar/PEDRA/blob/master/unreal_envs/readme.md

What is the meaning of the 'position array' and 'level_name'? = = = def indoor_vanleer(): ... orig_ip = [ [-3100, -4530, 90], #Player Start [-1340, -2240, -90], [-3790, -5450, 180], [-3980, -1760, -90] ] level_name = ['VanLeer1', 'VanLeer2', 'VanLeer3', 'VanLeer4'] ... = = =

I understand this: [x coord, y coord, yaw] [-3100, -4530, 90], #Player Start

If it is the meaning, I guess: [-1340, -2240, -90], 'VanLeer2' [-3790, -5450, 180], 'VanLeer3' [-3980, -1760, -90] ' VanLeer4'

then how should I trigger the position of drone in 'VanLeer2', 'VanLeer3', 'VanLeer4?

Thank you for your reply and help.

aqeelanwar commented 4 years ago

You can provide as many intial positions for the drone as you like. The algorithm alternates between the initial positions every 'switch_env_steps' as defined in the algorithm config file. https://github.com/aqeelanwar/PEDRA/blob/eb4e69aa3650ea4a96ee89104007ceecf7fb715f/configs/DeepREINFORCE.cfg#L14

level_name are the names assigned to each of these initial positions. This could be anything that helps you understand which initial position the drone is at.

In order to select a specific initial position for the drone among the ones defined in the initial_position.py file, use the reset_to_initial function with necessary arguments

https://github.com/aqeelanwar/PEDRA/blob/eb4e69aa3650ea4a96ee89104007ceecf7fb715f/aux_functions.py#L280

For example, say the environment under considertaion is VanLeer, using the following code will reset the drone to the 2nd initial position (x = -3790, y = -5450, yaw = 180 degrees] as defined in the initial_position.py file.

reset_to_initial(2, reset_array, client, vehicle_name=name_agent)

kirk0306 commented 4 years ago

Great work! Also had similar issue but the drones only get stucked at ceiling (4 drones in indoor_complex), so I guess the problem is about initial height in Airsim. Any help is appreciated thnx.

aqeelanwar commented 4 years ago

@kirk0306 Yes. That would be the issue. Did you modify the initial height of the drone?

kirk0306 commented 4 years ago

@kirk0306 Yes. That would be the issue. Did you modify the initial height of the drone?

I did not modify the height, it seems fine after I add some delay when looping to reset_to_initial in DeepQlearning.py , and connect_drone in aux_functions.py . So I guess it just need time to let airsim respawn the agents one by one.

aqeelanwar commented 3 years ago

@kirk0306 Yes. You are right. I experimented with the delay as well. The drone needs time to settle to the defined height before it can be used again. I have edited the PEDRA code to address this issue. Thanks.