<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic how to set advanced settings for rs400 in cpp in Items with no label</title>
    <link>https://community.intel.com/t5/Items-with-no-label/how-to-set-advanced-settings-for-rs400-in-cpp/m-p/569789#M10027</link>
    <description>&lt;P&gt;I want to set advanced settings on my D415 in c++.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;How do I do that exactly?&lt;/P&gt;&lt;P&gt;I tried to do something like, but of course it doesn't work:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;void enable_device(rs2::device dev, rs2::context ctx)&lt;/P&gt;&lt;P&gt;{&lt;/P&gt;&lt;P&gt;std::lock_guard lock(_mutex);&lt;/P&gt;&lt;P&gt;std::string serial_number(dev.get_info(RS2_CAMERA_INFO_SERIAL_NUMBER));&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if (_devices.find(serial_number) != _devices.end())&lt;/P&gt;&lt;P&gt;{&lt;/P&gt;&lt;P&gt;return; //already in&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;// Ignoring platform cameras (webcams, etc..)&lt;/P&gt;&lt;P&gt;if (platform_camera_name == dev.get_info(RS2_CAMERA_INFO_NAME))&lt;/P&gt;&lt;P&gt;{&lt;/P&gt;&lt;P&gt;return;&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;// Create a pipeline from the given device&lt;/P&gt;&lt;P&gt;rs2::pipeline p;&lt;/P&gt;&lt;P&gt;rs2::config c;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;c.enable_stream(RS2_STREAM_DEPTH, depthWidth, depthHeight, RS2_FORMAT_Z16, depthFps);&lt;/P&gt;&lt;P&gt;c.enable_stream(RS2_STREAM_COLOR, -1, colorWidth, colorHeight, RS2_FORMAT_RGB8, colorFps);&lt;/P&gt;&lt;P&gt;c.enable_device(serial_number);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;// Start the pipeline with the configuration&lt;/P&gt;&lt;P&gt;rs2::pipeline_profile profile = p.start(c);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;auto depth_sensor = profile.get_device().first();&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;// general settings&lt;/P&gt;&lt;P&gt;depth_sensor.set_option(RS2_OPTION_EXPOSURE, 62520);&lt;/P&gt;&lt;P&gt;depth_sensor.set_option(RS2_OPTION_LASER_POWER, 360);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; // advanced&lt;/P&gt;&lt;P&gt; auto advanced = rs400::advanced_mode(dev);&lt;/P&gt;&lt;P&gt; while (!advanced.is_enabled()) {&lt;/P&gt;&lt;P&gt;            advanced.toggle_advanced_mode(true);&lt;/P&gt;&lt;P&gt;            std::cout &amp;lt;&amp;lt; "toggled advanced mode for " &amp;lt;&amp;lt; serial_number &amp;lt;&amp;lt; ", have to sleep" &amp;lt;&amp;lt; std::endl;&lt;/P&gt;&lt;P&gt;            usleep(5000); // the device will reconnect, so we have to wait a bit and then init the device again&lt;/P&gt;&lt;P&gt;            auto devices = ctx.query_devices();&lt;/P&gt;&lt;P&gt;            for (auto device : devices) {&lt;/P&gt;&lt;P&gt;                if (device.get_info(RS2_CAMERA_INFO_SERIAL_NUMBER) == serial_number) {&lt;/P&gt;&lt;P&gt;                    dev = device;&lt;/P&gt;&lt;P&gt;                    advanced = rs400::advanced_mode(dev);&lt;/P&gt;&lt;P&gt;                }&lt;/P&gt;&lt;P&gt;            }&lt;/P&gt;&lt;P&gt; }&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;advanced.load_json(advancedOptions); // advanced options are exported from realsense-viewer&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;what am I missing?&lt;/P&gt;</description>
    <pubDate>Mon, 11 Jun 2018 17:04:29 GMT</pubDate>
    <dc:creator>JSchl4</dc:creator>
    <dc:date>2018-06-11T17:04:29Z</dc:date>
    <item>
      <title>how to set advanced settings for rs400 in cpp</title>
      <link>https://community.intel.com/t5/Items-with-no-label/how-to-set-advanced-settings-for-rs400-in-cpp/m-p/569789#M10027</link>
      <description>&lt;P&gt;I want to set advanced settings on my D415 in c++.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;How do I do that exactly?&lt;/P&gt;&lt;P&gt;I tried to do something like, but of course it doesn't work:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;void enable_device(rs2::device dev, rs2::context ctx)&lt;/P&gt;&lt;P&gt;{&lt;/P&gt;&lt;P&gt;std::lock_guard lock(_mutex);&lt;/P&gt;&lt;P&gt;std::string serial_number(dev.get_info(RS2_CAMERA_INFO_SERIAL_NUMBER));&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if (_devices.find(serial_number) != _devices.end())&lt;/P&gt;&lt;P&gt;{&lt;/P&gt;&lt;P&gt;return; //already in&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;// Ignoring platform cameras (webcams, etc..)&lt;/P&gt;&lt;P&gt;if (platform_camera_name == dev.get_info(RS2_CAMERA_INFO_NAME))&lt;/P&gt;&lt;P&gt;{&lt;/P&gt;&lt;P&gt;return;&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;// Create a pipeline from the given device&lt;/P&gt;&lt;P&gt;rs2::pipeline p;&lt;/P&gt;&lt;P&gt;rs2::config c;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;c.enable_stream(RS2_STREAM_DEPTH, depthWidth, depthHeight, RS2_FORMAT_Z16, depthFps);&lt;/P&gt;&lt;P&gt;c.enable_stream(RS2_STREAM_COLOR, -1, colorWidth, colorHeight, RS2_FORMAT_RGB8, colorFps);&lt;/P&gt;&lt;P&gt;c.enable_device(serial_number);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;// Start the pipeline with the configuration&lt;/P&gt;&lt;P&gt;rs2::pipeline_profile profile = p.start(c);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;auto depth_sensor = profile.get_device().first();&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;// general settings&lt;/P&gt;&lt;P&gt;depth_sensor.set_option(RS2_OPTION_EXPOSURE, 62520);&lt;/P&gt;&lt;P&gt;depth_sensor.set_option(RS2_OPTION_LASER_POWER, 360);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; // advanced&lt;/P&gt;&lt;P&gt; auto advanced = rs400::advanced_mode(dev);&lt;/P&gt;&lt;P&gt; while (!advanced.is_enabled()) {&lt;/P&gt;&lt;P&gt;            advanced.toggle_advanced_mode(true);&lt;/P&gt;&lt;P&gt;            std::cout &amp;lt;&amp;lt; "toggled advanced mode for " &amp;lt;&amp;lt; serial_number &amp;lt;&amp;lt; ", have to sleep" &amp;lt;&amp;lt; std::endl;&lt;/P&gt;&lt;P&gt;            usleep(5000); // the device will reconnect, so we have to wait a bit and then init the device again&lt;/P&gt;&lt;P&gt;            auto devices = ctx.query_devices();&lt;/P&gt;&lt;P&gt;            for (auto device : devices) {&lt;/P&gt;&lt;P&gt;                if (device.get_info(RS2_CAMERA_INFO_SERIAL_NUMBER) == serial_number) {&lt;/P&gt;&lt;P&gt;                    dev = device;&lt;/P&gt;&lt;P&gt;                    advanced = rs400::advanced_mode(dev);&lt;/P&gt;&lt;P&gt;                }&lt;/P&gt;&lt;P&gt;            }&lt;/P&gt;&lt;P&gt; }&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;advanced.load_json(advancedOptions); // advanced options are exported from realsense-viewer&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;what am I missing?&lt;/P&gt;</description>
      <pubDate>Mon, 11 Jun 2018 17:04:29 GMT</pubDate>
      <guid>https://community.intel.com/t5/Items-with-no-label/how-to-set-advanced-settings-for-rs400-in-cpp/m-p/569789#M10027</guid>
      <dc:creator>JSchl4</dc:creator>
      <dc:date>2018-06-11T17:04:29Z</dc:date>
    </item>
    <item>
      <title>Re: how to set advanced settings for rs400 in cpp</title>
      <link>https://community.intel.com/t5/Items-with-no-label/how-to-set-advanced-settings-for-rs400-in-cpp/m-p/569790#M10028</link>
      <description>&lt;P&gt;Hello jrkb, &lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;To enable the Advance mode on your D415 camera please follow the instructions on the following link: &lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt; &lt;A href="https://github.com/IntelRealSense/librealsense/releases"&gt;https://github.com/IntelRealSense/librealsense/releases&lt;/A&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;Best Regards, &lt;P&gt;&amp;nbsp;&lt;/P&gt;Juan N.</description>
      <pubDate>Tue, 12 Jun 2018 17:53:02 GMT</pubDate>
      <guid>https://community.intel.com/t5/Items-with-no-label/how-to-set-advanced-settings-for-rs400-in-cpp/m-p/569790#M10028</guid>
      <dc:creator>idata</dc:creator>
      <dc:date>2018-06-12T17:53:02Z</dc:date>
    </item>
    <item>
      <title>Re: how to set advanced settings for rs400 in cpp</title>
      <link>https://community.intel.com/t5/Items-with-no-label/how-to-set-advanced-settings-for-rs400-in-cpp/m-p/569791#M10029</link>
      <description>&lt;P&gt;Hello Juan,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thanks for your answer.&lt;/P&gt;&lt;P&gt;I tried to find more information on the github wiki, but I couldn't find any, so my hope was to get more detailed support here.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In the meantime I figured out a way to do it. Apparently I was only missing to enable the camera again after reconnecting it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;After running that once, the whole `while (...) {..}` is never called again, and advanced mode directly accessible from start.&lt;/P&gt;&lt;P&gt;I guess this is intended behavior.&lt;/P&gt;&lt;P&gt;Somehow I can't set any settings individually with e.g. `STDepthControlGroup` ..&lt;/P&gt;&lt;P&gt;Loading a complete json does work though.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I still doubt that this is the best way to do it, and indeed I found an interesting link here:&lt;/P&gt;&lt;P&gt;&lt;A href="https://github.com/IntelRealSense/librealsense/blob/02aeec770d23b3f8a364f1800e3c5faaaa7d0482/doc/rs400_advanced_mode.md"&gt;https://github.com/IntelRealSense/librealsense/blob/02aeec770d23b3f8a364f1800e3c5faaaa7d0482/doc/rs400_advanced_mode.md&lt;/A&gt; librealsense/rs400_advanced_mode.md at 02aeec770d23b3f8a364f1800e3c5faaaa7d0482 · IntelRealSense/librealsense · GitHub &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'll get more into it, and hope that I don't brick the cameras on the way...&lt;/P&gt;</description>
      <pubDate>Tue, 12 Jun 2018 19:24:55 GMT</pubDate>
      <guid>https://community.intel.com/t5/Items-with-no-label/how-to-set-advanced-settings-for-rs400-in-cpp/m-p/569791#M10029</guid>
      <dc:creator>JSchl4</dc:creator>
      <dc:date>2018-06-12T19:24:55Z</dc:date>
    </item>
  </channel>
</rss>

