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

How to use the distance sensor? #1029

Closed
galgyeony opened this issue Apr 27, 2018 · 12 comments
Closed

How to use the distance sensor? #1029

galgyeony opened this issue Apr 27, 2018 · 12 comments

Comments

@galgyeony
Copy link

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
Copy link
Contributor

sytelus commented Apr 27, 2018

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

@galgyeony
Copy link
Author

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
Copy link

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
Copy link

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

@TheGreatGalaxy
Copy link

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
Copy link

@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
Copy link
Contributor

I just added APIs for Barometer, IMU, GPS, Magnetometer, Distance Sensor in #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
Copy link
Contributor

madratman commented Apr 30, 2019

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,

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

@rajatthosar
Copy link

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
Copy link

Hoshea7 commented Aug 14, 2019

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

@ACLeighner
Copy link

ACLeighner commented Oct 7, 2019

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
Copy link
Contributor

ibrhm0v commented Dec 31, 2019

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?

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

No branches or pull requests