microsoft / AirSim

Open source simulator for autonomous vehicles built on Unreal Engine / Unity, from Microsoft AI & Research
https://microsoft.github.io/AirSim/
Other
16.32k stars 4.55k forks source link

Whether the distance sensor can obtain position information? #4534

Open wagh311 opened 2 years ago

wagh311 commented 2 years ago

Question

What's your question?

I am implementing the UAV obstacle avoidance mission and want to use the distance sensor to get the distance between the UAV and the obstacle. I would like to ask whether the distance sensor can not only obtain the distance information, but also obtain the location information of obstacles? For example, the coordinates of the contact point between the laser emitted by the distance sensor and the obstacle(that's the coordinates of the green points). If the distance sensor cannot obtain the coordinate information, is there any other way to achieve this requirement?

Include context on what you are trying to achieve

Context details

捕获

Include details of what you already did to find answers

the distance1 data is <DistanceSensorData> { 'distance': 9.344301223754883, 'max_distance': 40.0, 'min_distance': 0.20000000298023224, 'relative_pose': <Pose> { 'orientation': <Quaternionr> { 'w_val': 1.0, 'x_val': 0.0, 'y_val': 0.0, 'z_val': 0.0}, 'position': <Vector3r> { 'x_val': 0.0, 'y_val': 0.0, 'z_val': 0.0}}, 'time_stamp': 1653041561676390400} the distance2 data is <DistanceSensorData> { 'distance': 40.14430236816406, 'max_distance': 40.0, 'min_distance': 0.20000000298023224, 'relative_pose': <Pose> { 'orientation': <Quaternionr> { 'w_val': 0.9659258127212524, 'x_val': 0.0, 'y_val': 0.0, 'z_val': 0.258819043636322}, 'position': <Vector3r> { 'x_val': 0.0, 'y_val': 0.0, 'z_val': 0.0}}, 'time_stamp': 1653041561676390400}

jonyMarino commented 2 years ago

Hi @wagh311! This is a matter of frame translation. You can get the frame of reference of the drone with simGetPose(), and then you translate that to your sensor frame of reference according to your settings in settings.json and finally add distance to the point.

wagh311 commented 2 years ago

Ok, I will try what you said, thank you very much for your reply!