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

Recording distance sensor data for drones in airsim_rec.txt #4311

Open
bineet-coderep opened this issue Jan 23, 2022 · 3 comments
Open

Recording distance sensor data for drones in airsim_rec.txt #4311

bineet-coderep opened this issue Jan 23, 2022 · 3 comments
Labels

Comments

@bineet-coderep
Copy link

Question

What's your question?

I am currently using a drone to gather a dataset. Can you please let me know how can I equip the drone with a distance sensor to compute its altitude. Note that the distance sensor, in my case, needs to be pointed downwards. Merely using (x,y,z) coordinates of the drone is not sufficient to compute altitude of the drone, in my case. The environment I am currently using has animated objects moving in the ground. So, to calculate the altitude of the drone, w.r.t to those objects, I need a distance sensor that's pointed downwards. Note that I also need to record this distance sensor data is airsim_rec.txt.

Include context on what you are trying to achieve

Following is what I am trying to achieve:

  • Equip the drone with a distance sensor that's pointed perpendicularly downwards (towards the ground).
  • Record the distance sensor data in airsim_rec.txt.

Context details

Development environment:

  • OS: Ubuntu 20.04.3 LTS (64 bit)
  • Python: 3.7.6
  • Unreal: 4.25.4

I am currently recording x,y,x and roll, pitch yaw, in airsim_rec.txt, by modifying PawnSimApi.cpp (Issue 4251)

Include details of what you already did to find answers

I tried the following, without success:

@Frederik-Hartmann
Copy link

Frederik-Hartmann commented Jan 25, 2022

Hi @bineet-coderep,
Question 1: Equip the drone with a distance Sensor:
You will need to edit the Settings.json as referred in https://microsoft.github.io/AirSim/sensors/ . To add a distance sensor pointing downwards, add
"Distance": { "SensorType": 5, "Enabled" : true, "MinDistance": 0.2, "MaxDistance": 40, "X": 0, "Y": 0, "Z": 0, "Yaw": 0, "Pitch": -90, "Roll": 0, "DrawDebugPoints": true }
in your Sensor list.

Question 2: Record the distance sensor data in airsim_rec.txt
If you are controlling your drone with simple_flight you can try the following pseudo python code:
thread = client.moveToPositionAsync(x,y,z,velocity)

while Vehicle is not close to end point:
distance = client.getDistanceSensorData(distance_sensor_name="", vehicle_name="").distance

thread.join()

To store the data, you could write to a file or redirect all print statements via the shell ( >airsim_rec.txt ). Another approach would be to modify recordings: https://microsoft.github.io/AirSim/modify_recording_data/

Hope this helps.

Edit:
I just realized that getting the distance sensor data will not solve your problem. This is because the distance sensor is getting the data from Ground Truth Kinematics. Therefore it should not consider the animal. But I might be wrong on that. Check https://github.com/microsoft/AirSim/blob/master/AirLib/include/sensors/distance/DistanceSimple.hpp for more details.

@rajat2004
Copy link
Contributor

https://microsoft.github.io/AirSim/modify_recording_data/ This page will be helpful for details on how to modify the data being recorded. Instead of Imu or Barometer, you'll need to use getDistanceSensorData(), You can search for this method in the project and how it's used, the data format being returned

@deepchokshi
Copy link

To add distance sensor to the drone is Airsim you need to add the configuration of distance sensor in settings.json. Configuration for distance sensor is mentioned below
"Distance": {
"SensorType": 5,
"Enabled": true,
"MinDistance": 0.2,
"MaxDistance": 40,
"X": 0,
"Y": 0,
"Z": -1,
"Yaw": 0,
"Pitch": 0,
"Roll": 0,
"DrawDebugPoints": false
}

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

No branches or pull requests

5 participants