AirSim icon indicating copy to clipboard operation
AirSim copied to clipboard

Whether the distance sensor can obtain position information?

Open wagh311 opened this issue 2 years ago • 2 comments

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}

wagh311 avatar May 20 '22 10:05 wagh311

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.

jonyMarino avatar Jun 27 '22 15:06 jonyMarino

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

wagh311 avatar Jul 01 '22 02:07 wagh311