weixin_39951112
weixin_39951112
2021-01-11 19:15

Measure distance using net_device

| Required Info | | |---------------------------------|------------------------------------------- | | Camera Model | D435 | | Firmware Version | 05.12.07.100 | | Operating System & Version | client: Linux (Manjaro 20.0.3), rs-server: an image from the article | | Kernel Version (Linux Only) | 5.8.0 | | Platform | PC, Raspberry Pi | | SDK Version | 2.38.0 | | Language | C++ | | Segment | others |

I'm trying to measure distance using example rs-measure via camera connected using the article. So I changed rs-measure respectively (changes below) but measurements aren't valid. In case of validation, I put a 15cm ruler under the camera and got approximately 800,000cm length for it using modified rs-measure. It's nonsense because everything works properly via usb. Does anybody have ideas how to fix it or from which I could start debugging?

rs-measure.cpp changes
diff --git a/examples/measure/rs-measure.cpp b/examples/measure/rs-measure.cpp
index d14170e23..1149e94e9 100644
--- a/examples/measure/rs-measure.cpp
+++ b/examples/measure/rs-measure.cpp
@@ -3,6 +3,7 @@

 #include <librealsense2> // Include RealSense Cross Platform API
 #include <librealsense2>
+#include <librealsense2-net>
 #include "example.hpp"          // Include short list of convenience functions for rendering

 // This example will require several standard data-structures and algorithms:
@@ -129,14 +130,17 @@ int main(int argc, char * argv[]) try
     //   b. We don't want to introduce new holes
     rs2::align align_to(RS2_STREAM_DEPTH);

+    rs2::context ctx;
+    rs2::net_device dev("10.0.0.175");
+    dev.add_to(ctx);
     // Declare RealSense pipeline, encapsulating the actual device and sensors
-    rs2::pipeline pipe;
+    rs2::pipeline pipe(ctx);

     rs2::config cfg;
     cfg.enable_stream(RS2_STREAM_DEPTH); // Enable default depth
     // For the color stream, set format to RGBA
     // To allow blending of the color frame on top of the depth frame
-    cfg.enable_stream(RS2_STREAM_COLOR, RS2_FORMAT_RGBA8);
+    cfg.enable_stream(RS2_STREAM_COLOR, RS2_FORMAT_RGB8);
     auto profile = pipe.start(cfg);

     auto sensor = profile.get_device().first<:depth_sensor>();
</:depth_sensor></librealsense2-net></librealsense2></librealsense2>
CMakeLists.txt changes
diff --git a/examples/measure/CMakeLists.txt b/examples/measure/CMakeLists.txt
index 66201dd4f..148d451ce 100644
--- a/examples/measure/CMakeLists.txt
+++ b/examples/measure/CMakeLists.txt
@@ -11,7 +11,7 @@ find_package(Threads REQUIRED)
 if(BUILD_GRAPHICAL_EXAMPLES)
     add_executable(rs-measure rs-measure.cpp ../example.hpp)
     set_property(TARGET rs-measure PROPERTY CXX_STANDARD 11)
-    target_link_libraries(rs-measure ${DEPENDENCIES} Threads::Threads)
+    target_link_libraries(rs-measure ${DEPENDENCIES} Threads::Threads realsense2-net)
     include_directories(rs-measure ../)
     set_target_properties (rs-measure PROPERTIES FOLDER "Examples")

该提问来源于开源项目:IntelRealSense/librealsense

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享
  • 邀请回答

5条回答

  • weixin_39605905 weixin_39605905 4月前

    Hi -ilya You have an uncommon Linux setup (at least, uncommon in terms of librealsense setups). Would it be possible please to try using the modified rs-measure.cpp example with the pre-made Pi 4 SD card image that Intel provide in the open-source ethernet networking paper, to confirm whether or not the problem that you are experiencing is related to your Linux configuration?

    https://dev.intelrealsense.com/docs/open-source-ethernet-networking-for-intel-realsense-depth-cameras#section-2-3-preparing-the-sd-card

    点赞 评论 复制链接分享
  • weixin_39951112 weixin_39951112 4月前

    -RealSense I use exactly the same image on the Raspberry pi without any significant modifications. After setup the image I just configured network. So rs-server started on a common linux setup. But I got an idea. I'll try to reproduce the bug on different clients with a common linux or windows setup.

    点赞 评论 复制链接分享
  • weixin_39605905 weixin_39605905 4月前

    Ok -ilya I look forward to your test results with different clients. Thanks!

    点赞 评论 复制链接分享
  • weixin_39603778 weixin_39603778 4月前

    Hi -ilya I suspect this may be due to a bug that was addressed lately (#7017). It seems that Depth-Units of Net Device were not being reported correctly. The fix should be part of upcoming release.

    点赞 评论 复制链接分享
  • weixin_39951112 weixin_39951112 4月前

    -RealSense I've reproduced the bug on a windows machine. But as suspected it's just a duplication of the issue #7017. Thank you for your support

    点赞 评论 复制链接分享

相关推荐