raisimTech / raisimLib

Visit www.raisim.com
http://www.raisim.com
Other
338 stars 91 forks source link

Get depth/RGB data from the added Realsense sensor #448

Closed itaouil closed 1 year ago

itaouil commented 1 year ago

Hi,

I read the small excerpt on the Raisim documentation about adding sensors to the URDF file, and I also saw that you added the sensor implementations in raisimUnreal #329.

My question is how can I access the RGB and depth data coming from the sensor?

Thanks, Ilyass

jhwangbo commented 1 year ago

DepthSensor::getDepthArray and RGBSensor::getImageBuffer are the functions that you are looking for.

itaouil commented 1 year ago

Thanks for the quick response.

One last question....

Is there also a way to visualize the RGB and depth images or maybe I should do something extra to have them visible on raisimUnreal?

Because as you can see from the picture below the windows are completely black

Screenshot from 2023-04-13 13-38-42

jhwangbo commented 1 year ago

how about the raisim example sensors? Do you also see black images only?

itaouil commented 1 year ago

In the example I can see the sensory output.

I guess I am doing something wrong on my side on the URDF.

jhwangbo commented 1 year ago

If you click the checkbox, it should show the frame. From your picture, I don't see any sensor frame.

itaouil commented 1 year ago

Solved.

I had to pay attention to which version of Python I was compiling with, and also I did not realize I had to call these two functions inside the code:

auto depthSensor = robot->getSensor<raisim::DepthCamera>("depth_camera_front_camera_parent:depth");
depthSensor->setMeasurementSource(raisim::Sensor::MeasurementSource::VISUALIZER);
auto rgbCamera = robot->getSensor<raisim::RGBCamera>("depth_camera_front_camera_parent:color");
rgbCamera->setMeasurementSource(raisim::Sensor::MeasurementSource::VISUALIZER);

Thanks.