microsoft / AirSim

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

How to use the distance sensor? #1029

Closed galgyeony closed 5 years ago

galgyeony commented 6 years ago

I am very happy to see the new "distance" sensor but don't know how to use it.

As far as I know, the distance sensor internally uses getRayLength(), which is actually implemented by UE4. However, I do not know how to acquire the result (i.e., to log or display the distance value).

Is there an API or another way to do so?

Thank you very much for your support.

sytelus commented 6 years ago

There is no Python API yet. We are planning to expose this soon.

galgyeony commented 6 years ago

I know that there are some GPS related sensor APIs (e.g., getGPSLocation) and IMU related ones (e.g., get*Kinematics). But, for me, it is still difficult to find any API for magnetometor and barometer.

Is there any API for magnetometor and barometer? If not, are you planning to expose them?

Thank you!

dileep-krishnan commented 6 years ago

Hi @sytelus , Any update on the above feature? If not, can you point me to an existing API as example so that I can build make the API myself.

Thanks a lot!!

paulerikf commented 6 years ago

@dileep-krishnan Did you figure this out? Alternatively, does anyone have an example?

TheGreatGalaxy commented 5 years ago

hi, @sytelus is there anything updated for distance sensor ? I cannot find docs for how to use this sensor. You know that it's necessary to mount sensors (e.g.,ultrasonic sensor,millimeter-wave radar) on cars if we want to test our driverless car. i think that we need more sensors model (ultrasonic sensor and millimeter-wave radar are best ).

stavBodik commented 5 years ago

@sytelus @paulerikf @dileep-krishnan

for C++ users

I also could not find anyway to get Barometer pressure...but :

Please look at BarometerSimple.hpp

Function : getOutputInternal(...)

auto pressure = EarthUtils::getStandardPressure(altitude);

. . .

madratman commented 5 years ago

I just added APIs for Barometer, IMU, GPS, Magnetometer, Distance Sensor in https://github.com/Microsoft/AirSim/pull/1920

See the updated docs https://github.com/Microsoft/AirSim/blob/master/docs/sensors.md and the API here https://github.com/Microsoft/AirSim/blob/master/docs/sensors.md#sensor-apis

madratman commented 5 years ago

For details on distance sensor / point lidar, see the discussion in the original PR here https://github.com/Microsoft/AirSim/pull/791 and the original feature request here https://github.com/Microsoft/AirSim/issues/405

The params of the distance sensor - pose , min_distance, max_distance all need to be still exposed, but we have an API for the default config. I'll add a PR to expose this params in settings.json soon.

For those who want to do this by modifying code, you can directly params can be directly changed for any sensor in https://github.com/Microsoft/AirSim/tree/master/AirLib/include/sensors/SENSOR_NAME/SENSOR_NAMESimpleParams.hpp For example,

Closing this now, but happy to keep the discussion alive. Please let us know if things are still not clear

rajatthosar commented 5 years ago

I tried to implement the getDistanceSensorData(lidar_name, vehicle_name) method but I received the following error. NameError: name 'DistanceSensorData' is not defined

I tried to find the DistanceSensorData class but couldn't find it. Has anyone faced a similar issue? And if so, how did you resolve it? Any help is much appreciated

Hoshea7 commented 5 years ago

@rajatthosar I also meet this issue, have you solved it ?

ACLeighner commented 4 years ago

To anyone looking for a fix to this when using the python wrapper. I was able to get the distance sensor working by adding a definition of DistanceSensorData to the 'types' file: AirSim\PythonClient\airsim\types.py.

Just paste this in the bottom of that file: class DistanceSensorData(MsgpackMixin): time_stamp = np.uint64(0) distance = np.float32(0) min_distance = np.float32(0) max_distance = np.float32(0) relative_pose = Pose()

ibrhm0v commented 4 years ago

For details on distance sensor / point lidar, see the discussion in the original PR here #791 and the original feature request here #405

The params of the distance sensor - pose , min_distance, max_distance all need to be still exposed, but we have an API for the default config. I'll add a PR to expose this params in settings.json soon.

For those who want to do this by modifying code, you can directly params can be directly changed for any sensor in https://github.com/Microsoft/AirSim/tree/master/AirLib/include/sensors/SENSOR_NAME/SENSOR_NAMESimpleParams.hpp For example,

* Barometer https://github.com/Microsoft/AirSim/blob/master/AirLib/include/sensors/barometer/BarometerSimpleParams.hpp

* IMU - https://github.com/Microsoft/AirSim/blob/master/AirLib/include/sensors/imu/ImuSimpleParams.hpp

* Distance Sensor: https://github.com/Microsoft/AirSim/blob/master/AirLib/include/sensors/distance/DistanceSimpleParams.hpp

Closing this now, but happy to keep the discussion alive. Please let us know if things are still not clear

@madratman are the settings.json distance sensor parameters out yet?