Items with no label
3338 Discussions

Where to find detailed definition of rs2_device_info?

HNguy103
Beginner
1,544 Views

I am exploring Intel's librealsense library here:

https://github.com/IntelRealSense/librealsense  

 

Tracing the code, I can see that rs2_device_info is defined in rs_types.h:

https://github.com/IntelRealSense/librealsense/blob/master/include/librealsense2/h/rs_types.h

 

as follows:

  typedef struct rs2_device_info rs2_device_info;

 

However, it does not contain detailed the actual definition like `rs2_intrinsics` in the same file. Could someone show me where it is? How can the code compile if the actual definition is missing? Thanks.

0 Kudos
5 Replies
MartyG
Honored Contributor III
1,294 Views

Line 20 of the file 'context.h' shows how device_info can be defined within the framework of a "struct".

https://github.com/IntelRealSense/librealsense/blob/master/src/context.h#L20

 

The struct also makes reference to a 'device_info' class that is defined outside of the struct, just before it on line 17.

0 Kudos
HNguy103
Beginner
1,294 Views

@MartyG​ , Thank you so much. I am using the sln file that came with the RealSense SDK installer. The example I am looking at is `rs-pointcloud.cpp` which is here. It has no reference to `context.h` in any way. Can you tell how it will even compile?

0 Kudos
MartyG
Honored Contributor III
1,294 Views

RealSense programming is not one of my specialist areas (though I have an understanding of it on a general level). so there may be others, especially on the RealSense GitHub site, who can provide a better answer.

 

Having said that, looking at the point cloud example, I suspect that it gets to the context file by first including 'librealsense2/rs.hpp' so the point cloud example can access the code in rs.hpp. In turn, rs.hpp includes context.hpp. So my guess would be that the point cloud example includes the context data as part of the pooling-together of files through #include. That is an opinion though, not certainty. If you would like confirmation, I recommend asking a question on the RealSense GitHub, by visiting the link below and clicking on the 'New Issue' button.

 

https://github.com/IntelRealSense/librealsense/issues

 

You may also find useful the following charts of the linkages of 'context.h' through the SDK files.

 

http://docs.ros.org/kinetic/api/librealsense2/html/context_8h.html

0 Kudos
HNguy103
Beginner
1,294 Views

@MartyG​ , thank you so much. I really appreciate it.

0 Kudos
MartyG
Honored Contributor III
1,294 Views

You're very welcome. Good luck with your explorations of Librealsense, and please feel free to ask follow-up questions whenever you need to. The RealSense forum has moved to a new location, so I recommend bookmarking that for future reference and posting follow-up questions there so that Intel support team members can assist you.

 

https://support.intelrealsense.com/hc/en-us/community/topics

0 Kudos
Reply