View my account

How to configure L515 Min distance controls in python ?



  • Zulkifli Halim

    Hello Lyhour Newtechnology,


    Here is sample code for setting sensor options in Python:

    import pyrealsense2 as rs
    pipeline = rs.pipeline()
    config = rs.config()
    profile = pipeline.start(config) # Start streaming
    sensor_dep = profile.get_device().first_depth_sensor()
    If sensor_dep.supports(rs.option.min_distance):
      print "Trying to set min_distance"
      dist = sensor_dep.get_option(rs.option.min_distance)
      print "min_distance = %d" % dist
      print "Setting min_distance to new value"
      dist = sensor_dep.set_option( rs.option.min_distance, 1)
      dist = sensor_dep.get_option(rs.option.min_distance)
      print "New min_distance = %d" % dist
    profile = pipeline.stop

    You can find the full list of options in rs_option.h file. The Python wrapper exposes all these options like this:
    RS2_OPTION_MAX_DISTANCE -> rs.option.max_distance
    RS2_OPTION_ENABLE_AUTO_EXPORE -> rs.option.enable_auto_exposure
    RS2_OPTION_AUTO_EXPOSURE_PRIORITY -> rs.option.auto_exposure_priority



    Zulkifli Halim

    Intel Customer Support 

    Comment actions Permalink
  • Lyhour Newtechnology

    Thank you very much sir, now I can do it.


    Comment actions Permalink

Please sign in to leave a comment.