• ROS
  • How can I set the autoexposure region when using the ROS node?

Hi, I think yes, if its a crucial feature we can put in on top of backlog

For our usecase it is definitely crucial. We are currently seeing our area of interest washed out due to a darker background. However our lighting will not be completely fixed so we cannot rely on manual exposure parameters

@BradSteiner which ROS distro are you using? I can create a temporary branch with this feature that you will be able to use in meantime

I am using Humble, thanks!!

2 months later

Do you know if this change will be merged into the main humble branch?

Luxonis-Adam Certainly,

Here is the client setup

self.exp_parameter_client = self.create_client(SetParameters, '/oak/set_parameters')

Here is the definition of the parameters

def set_exposure_params(self, box):

    self.get_logger().info("Setting exposure params")

    # Use the input bounding box to set the exposure region of interest

    # box = np.array([[min_x, min_y], [max_x, min_y], [max_x, max_y], [min_x, max_y]])

    request = SetParameters.Request()

    roi_dict = {

        "rgb.r_auto_exp_region_start_x": box[0][0],

        "rgb.r_auto_exp_region_start_y": box[0][1],

        "rgb.r_auto_exp_region_width": box[1][0] - box[0][0],

        "rgb.r_auto_exp_region_height": box[2][1] - box[0][1],

    }

    cam_exposure_params = []

    for key, val in roi_dict.items():

        param = Parameter()

        param.name = key  # Full parameter name

        param.value.type = ParameterType.PARAMETER_INTEGER

        param.value.integer_value = int(val)

        cam_exposure_params.append(param)

    

    request.parameters = cam_exposure_params

    future = self.exp_parameter_client.call_async(request)

    rclpy.spin_until_future_complete(self, future)

    response = future.result()

    self.get_logger().info(f"Set exposure params response: {response}")

Thanks @CamDuarte, unless this is set externally they should also set r_set_autoexp_region: true for this to work

    Hi, the full name should be rgb.r_set_autoexp_region. You can get the list of all parameters either by using ros2 param dump /oak or going through param_handlers classes in the driver. Documentation will be updated after the release