Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Distance sensor Upgrades #2807

Merged
merged 7 commits into from
Jul 24, 2020
Merged

Conversation

rajat2004
Copy link
Contributor

@rajat2004 rajat2004 commented Jun 27, 2020

  1. Add setting for drawing debug point with Distance Sensor
  2. Expose Distance sensor settings, also move sensor above Car vehicle by 1 meter by default
  3. Fix DistanceSensorData struct in types.py (Should be float, not Quaternion)
  4. Update docs
  5. Use Custom sensor orientation in Mavlink Distance Sensor message (Needs testing with PX4)
  6. ROS wrapper change
  7. Example script for Distance sensor with 2 cars

Default sensor-
Screenshot from 2020-06-28 08-42-07

Downward-facing (altitude measurement)-
Screenshot from 2020-06-28 11-35-03

2 Cars with distance sensor
Screenshot from 2020-07-24 10-30-09

Closes #2723, closes #2806
Related issues - #2444, #1029

Question: Should there be fields in settings for other params such as update_frequency, noise, etc? Currently haven't added those

@rajat2004 rajat2004 marked this pull request as ready for review June 28, 2020 06:17
@rajat2004 rajat2004 force-pushed the distance-sensor branch 3 times, most recently from a0b70fa to cbceb09 Compare June 30, 2020 01:18
@madratman
Copy link
Contributor

/azp run microsoft.AirSim

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@mirarmdn
Copy link

How does the distance sensor airsim measure the distance from the car to the obstacles in front? because from the simulation that has been done, the result of the distance always increases even though the distance from the car to the obstacle is getting closer
anyone can help, please

@rajat2004
Copy link
Contributor Author

@mirarmdn Distance sensor uses a ray cast to measure the distance. You're right, I just tested, and there's some problem with Car vehicle, the distance values don't make sense. It's working correctly on Multirotor vehicle though. Need to look into this

@mirarmdn
Copy link

@rajat2004 What should I do? I desperately need the distance sensors to measure the distance from the car to the obstacle. I've looked into several sources, but I haven't found an answer. Can you help me
Thank you

@rajat2004
Copy link
Contributor Author

@mirarmdn I've pushed the fix for the Car vehicle, the problem was that the sensor was inside the vehicle, and so gave the wrong values. Moving it by 1 meter above fixes the problem, this is also being done in Lidar as well. Added an example script as well for measuring the distance between 2 vehicles which I used for testing

Screenshot from 2020-07-24 10-30-09

@madratman
Copy link
Contributor

This PR is looking good and complete to me. @rajat2004 do you want to add anything else here?

@rajat2004
Copy link
Contributor Author

@madratman Don't think so, I was thinking of adding support for distance sensor in ArduCopter, Rover vehicles but that will take time and requires a PR in AP repository to be merged first, so this can go in and will open a new PR later when that happens.
One point s whether fields like noise, etc should be exposed in settings or not, right now haven't done that.

@madratman
Copy link
Contributor

Yes, let's add those features in next PR. I'm getting this in.

@fracnaive
Copy link

fracnaive commented Dec 6, 2021

Problem:
It always got the same result ZERO no matter how i changed "X","Y","Z" of Distance Sensors when i ran the distance_sensor_multi.py.
my settings.json:
{"SeeDocsAt": "https://github.com/Microsoft/AirSim/blob/master/docs/settings.md","SettingsVersion": 1.2,"SimMode": "Car", "Vehicles": {"Car1": {"VehicleType": "PhysXCar","AutoCreate": true, "Sensors": { "Distance": { "SensorType": 5, "Enabled" : true,"X": 0, "Y": 0, "Z": 5, "DrawDebugPoints": true}}}, "Car2": {"VehicleType": "PhysXCar", "AutoCreate": true, "X": 10, "Y": 0, "Z": 0, "Sensors": {"Distance": { "SensorType": 5, "Enabled" : true,"X": 0, "Y": 0, "Z": 5,"DrawDebugPoints": true }}}}}
result:
Connected!
Client Ver:1 (Min Req: 1), Server Ver:1 (Min Req: 1)

Distance sensor data: Car1: 0.0, Car2: 0.0
Distance sensor data: Car1: 0.0, Car2: 0.0
Distance sensor data: Car1: 0.0, Car2: 0.0
Distance sensor data: Car1: 0.0, Car2: 0.0
Distance sensor data: Car1: 0.0, Car2: 0.0
Distance sensor data: Car1: 0.0, Car2: 0.0
Distance sensor data: Car1: 0.0, Car2: 0.0
Distance sensor data: Car1: 0.0, Car2: 0.0
Distance sensor data: Car1: 0.0, Car2: 0.0
Distance sensor data: Car1: 0.0, Car2: 0.0

image

@rajat2004
Copy link
Contributor Author

@fracnaive Your sensor is probably below the vehicle, in the ground itself. NED is used here, so +ve Z will be downwards.
Also for the future, it's preferable to create a new issue

@fracnaive
Copy link

I get it,thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Distance Detection Right in Front of Drone Visualizing sensors data in Client side (Unreal)
4 participants