AntwnhsG / path-planning-airsim-scripts

Python scripts for path planning and obstacle detection and avoidance using LiDAR sensor in an AirSim - Unreal Engine simulation.
10 stars 1 forks source link

Problems running in a forest enviroment #1

Open JuanCarlos-TiqueRangel opened 12 months ago

JuanCarlos-TiqueRangel commented 12 months ago

Hi really thank you sharing this project. I have a problem trying to run the drone_astar_3d_re.py in a forest enviroment. The drone is not moving and the task ends. I am editing the .csv file with my own coordinates, they are the next:

start_x,start_y,start_z,target_x,target_y,target_z
6, 60, 1,-7,104,-5

and after run the code this is the result:

Arming the drone...

0 87 0

[[ 3 88  0]
 [ 0 88  0]
 [ 0 86  0]
 [ 1 87  0]
 [ 2 87  0]
 [ 2 88  0]
 [ 3 89  0]]

[[ 0 87  0]
 [ 0 87  1]
 [ 0 88  1]
 [ 0 89  1]
 [ 0 90  1]
 [ 0 91  1]
 [ 0 92  1]
 [ 0 93  1]
 [ 0 94  1]
 [ 0 94  0]]

Total time needed to reach the target: 0.068653

        Total distanced traveled to reach the target: 0.000000

        Total steps: 0

And the drone is not moving from the start position

image

Do you know what should be the error or what can I do ?

Thank you in advace.

AntwnhsG commented 11 months ago

Hello and thank you for showing interest in the scripts,

I believe the problem might be in LiDAR sensor because you use a forest environment. I used blocks which is easy. The problem probably is that LiDAR makes everything an obstacle. Let me have a look because it was a year ago and I will answer as fast as possible.

Thank you

On Mon, Nov 13, 2023 at 9:10 AM Juan Carlos Tique @.***> wrote:

Hi really thank you sharing this project. I have a problem trying to run the drone_astar_3d_re.py in a forest enviroment. The drone is not moving and the task ends. I am editing the .csv file with my own coordinates, they are the next:

start_x,start_y,start_z,target_x,target_y,target_z 6, 60, 1,-7,104,-5

and after run the code this is the result:

Arming the drone...

0 87 0

[[ 3 88 0] [ 0 88 0] [ 0 86 0] [ 1 87 0] [ 2 87 0] [ 2 88 0] [ 3 89 0]]

[[ 0 87 0] [ 0 87 1] [ 0 88 1] [ 0 89 1] [ 0 90 1] [ 0 91 1] [ 0 92 1] [ 0 93 1] [ 0 94 1] [ 0 94 0]]

Total time needed to reach the target: 0.068653

    Total distanced traveled to reach the target: 0.000000

    Total steps: 0

And the drone is not moving from the start position [image: image] https://user-images.githubusercontent.com/47435355/282387270-a28963dc-21e3-4188-b02f-efb3c01fc970.png

Do you know what should be the error or what can I do ?

Thank you in advace.

— Reply to this email directly, view it on GitHub https://github.com/AntwnhsG/path-planning-airsim-scripts/issues/1, or unsubscribe https://github.com/notifications/unsubscribe-auth/AI6CUA26WPOE3AGEJV2OETTYEHBXLAVCNFSM6AAAAAA7IV57VKVHI2DSMVQWIX3LMV43ASLTON2WKOZRHE4TAMBRGUZDKNY . You are receiving this because you are subscribed to this thread.Message ID: @.***>

JuanCarlos-TiqueRangel commented 11 months ago

@AntwnhsG Thank you for your time and help. Just if this help you, this is my settings.json file

{
  "SimMode" : "Multirotor", 
  "SettingsVersion" : 1.2, 
  "SeeDocsAt" : "https://github.com/Microsoft/AirSim/blob/master/docs/settings.md",
  "LocalHostIp": "172.29.240.1",
  "ClockSpeed": 10,
  "Vehicles": {
     "Drone1": {
         "VehicleType": "SimpleFlight",
         "AutoCreate": true,
         "Sensors": {
             "Barometer":{
                 "SensorType": 1,
                 "Enabled": true,
                 "PressureFactorSigma": 0.0001825
             },
             "MyLidar1": {
                 "SensorType": 6,
                 "Enabled" : true,
                 "NumberOfChannels": 32,
                 "Range": 80,
                 "PointsPerSecond": 6000,
                 "RotationsPerSecond": 10,
                 "HorizontalFOVStart": 0,
                 "HorizontalFOVEnd": 359,
                 "VerticalFOVUpper": 15,
                 "VerticalFOVLower": -16,
                 "X": 0, "Y": 0, "Z": -0.5,
                 "Roll": 0, "Pitch": -180, "Yaw" : 0,
                 "DrawDebugPoints": true,
                 "DataFrame": "SensorLocalFrame"
             }
         },
         "Cameras": {
             "Test0": {
                 "CaptureSettings": [
                   {
                     "ImageType": 0,
                     "Width": 256,
                     "Height": 144,
                     "FOV_Degrees": 90,
                     "AutoExposureSpeed": 100,
                     "AutoExposureBias": 0,
                     "AutoExposureMaxBrightness": 0.64,
                     "AutoExposureMinBrightness": 0.03,
                     "MotionBlurAmount": 0,
                     "TargetGamma": 1.0,
                     "ProjectionMode": "",
                     "OrthoWidth": 5.12
                   }
                 ],
                 "NoiseSettings": [
                   {
                     "Enabled": false,
                     "ImageType": 0,

                     "RandContrib": 0.2,
                     "RandSpeed": 100000.0,
                     "RandSize": 500.0,
                     "RandDensity": 2,

                     "HorzWaveContrib":0.03,
                     "HorzWaveStrength": 0.08,
                     "HorzWaveVertSize": 1.0,
                     "HorzWaveScreenSize": 1.0,

                     "HorzNoiseLinesContrib": 1.0,
                     "HorzNoiseLinesDensityY": 0.01,
                     "HorzNoiseLinesDensityXY": 0.5,

                     "HorzDistortionContrib": 1.0,
                     "HorzDistortionStrength": 0.002
                   }
                 ],
                 "Gimbal": {
                   "Stabilization": 0,
                   "Pitch": 0, "Roll": 0, "Yaw": 0
                 },
                 "X": 0, "Y": 0, "Z": 0,
                 "Pitch": 0, "Roll": 0, "Yaw": 0
              },

              "DepthCamera": {
                "CaptureSettings": [
                  {
                    "PublishToRos":1,
                    "ImageType": 3,
                    "Width": 640,
                    "Height": 140,
                    "FOV_Degrees": 90,
                    "AutoExposureSpeed": 100,
                    "AutoExposureBias": 0,
                    "AutoExposureMaxBrightness": 0.64,
                    "AutoExposureMinBrightness": 0.03,
                    "MotionBlurAmount": 0,
                    "TargetGamma": 1.0,
                    "ProjectionMode": "",
                    "OrthoWidth": 5.12
                  }
                ],
                "Gimbal": {
                  "Stabilization": 0,
                  "Pitch": 0, "Roll": 0, "Yaw": 0
                },
                "X": 0, "Y": 0, "Z": 0,
                "Pitch": 0, "Roll": 0, "Yaw": 0
             }
         }
     }
 }
 }
AntwnhsG commented 11 months ago

Ok 3 things I will suggest.

  1. The LiDAR algorithm is implemented for the position that it is located in my settings (included in the repo). Since you changed the position it sits on the drone I believe the distance now will be different between the sensor and the obstacle.

  2. To scan for ground obstacles I used a second LiDAR sensor. If you don't use it you should comment out the function "lidar_ground_check".

  3. Finally try to start the drone from higher position. Change the start z = 1 to -5. If I remember correctly -z means higher and +z means lower.

This seems fine and should work. Try what I suggested and we will see. If i have time I will try to help.

JuanCarlos-TiqueRangel commented 11 months ago

@AntwnhsG Thank you for your reply. I really appreciate it. I did what you said but I am still having the problem. Sorry I uploaded the wrong settings but I am using the same as you.

0 87 0

[[ 3 88  0]
 [ 0 88  0]
 [ 0 89  0]
 [ 0 86  0]
 [ 1 87  0]
 [ 1 88  0]
 [ 2 87  0]
 [ 2 88  0]
 [ 3 89  0]]

[[ 0 87  0]
 [ 0 87  1]
 [ 0 88  1]
 [ 0 89  1]
 [ 0 90  1]
 [ 0 91  1]
 [ 0 92  1]
 [ 0 93  1]
 [ 0 94  1]
 [ 0 94  0]]

Despite the fact I got a path to follow, the drone is not moving, the position in the eval_points_whole.csv is the next 6, 60, 1,-7,104,-5. Also, I am running the drone_astar_3d_re.py is it correct ?

AntwnhsG commented 11 months ago

@JuanCarlos-TiqueRangel Yes, drone_astar_3d_re.py is the script. I am running the script now in the blocks environment and it works fine. The algorithm is slow and my computer is not that fast so it takes time but it runs. You still get this:

Total time needed to reach the target: 0.068653

    Total distanced traveled to reach the target: 0.000000

    Total steps: 0
    ?
JuanCarlos-TiqueRangel commented 11 months ago

@AntwnhsG Yes I am still facing the same issue and always the result is:

Total time needed to reach the target: 0.077936

        Total distanced traveled to reach the target: 0.000000

        Total steps: 0

Maybe do you have an advice what can I do with this kind of enviroment ?

AntwnhsG commented 11 months ago

@JuanCarlos-TiqueRangel I will try another environment so I can see what is happening and I will notify you

JuanCarlos-TiqueRangel commented 11 months ago

@AntwnhsG Really thank you for your time and help in this matter. Let me know if you can see something. thank you in advance.

AntwnhsG commented 11 months ago

@JuanCarlos-TiqueRangel I am sorry my friend but the script runs perfect in landscape mountains environment I downloaded from here: https://github.com/Microsoft/AirSim/releases. I still believe the problem is that you have start_z = 1. start_z = 0 is the ground and start_z = -1 is above ground. So you have start_z = 1 this is below ground (error). Also I the drone only moves forward and you have start_x = 6 and target_x = -7. Please try again and set your csv like this:

start_x,start_y,start_z, target_x,target_y,target_z -6, 60, -1, 7, 104, -5

for example. if there is an obstacle in that position change x or y to set the drone elsewhere. But as I said start_x < target_x and start_z and target_z < 0

I hope this works. Please tell me if this helped you.

AntwnhsG commented 11 months ago

@JuanCarlos-TiqueRangel Did this fix your problems?

JuanCarlos-TiqueRangel commented 11 months ago

Hi @AntwnhsG I was trying really hard to test the scripts in some enviroments and still not working well with many obstacles in a forest and sometimes takes a lot time to find the path. I will see looking what is it the problem and let you know. So, did you test with the landscape mountains environment on the trees ? because that environment basically do not have many obstacles