(Argus) Error BadParameter: Bad gain range / exposure time range

I have the same Issue as described here : Nvarguscamerasrc with gstreamer not reading max and min gain/exposure correctly from sensor in cpp lib

There is no really solution in this post.

if I try to set the exposure and gain using g_object_set_property :

“5.333330 5.333330” for gainrange

“18200 18200” for exposuretimerange

I get these errors in nvargus-daemon.service :

nvargus-daemon[120575]: (Argus) Error BadParameter: Bad gain range: [5.33, 0.00] (in src/api/RequestImpl.cpp, function setGainRange(), line 694)

nvargus-daemon[120575]: (Argus) Error BadParameter: Bad exposure time range: [18200, 0] (in src/api/RequestImpl.cpp, function setExposureTimeRange(), line 656)

Thanks,

Ori

*** Please note that this reply is generated by LLM automatically ***

I’ll provide a comprehensive answer to the question.

The issue you’re facing is related to setting the exposure and gain values using g_object_set_property in a C++ library with nvarguscamerasrc and gstreamer. You’re trying to set the gain range to 5333330 5333330 and the exposure time range to 18200 18200, but you’re getting errors in nvargus-daemon service.

To understand the issue, let’s break down the error messages:

  1. Bad gain range 533 000 in src/api/RequestImpl.cpp function setGainRange line 694:
    This error indicates that the gain range value you’re trying to set is invalid. The setGainRange function expects a valid range of gain values, but 5333330 5333330 is not a valid range.
  2. Bad exposure time range 18200 0 in src/api/RequestImpl.cpp function setExposureTimeRange line 656:
    This error indicates that the exposure time range value you’re trying to set is invalid. The setExposureTimeRange function expects a valid range of exposure time values, but 18200 0 is not a valid range.

To resolve this issue, you need to ensure that you’re setting valid ranges for gain and exposure time. You can refer to the sensor’s documentation to determine the valid ranges for these values.

In the context of nvarguscamerasrc, the gain range and exposure time range are typically set using the gain-range and exposure-time-range properties, respectively. You can use g_object_get_property to retrieve the current values of these properties and then use g_object_set_property to set new values within the valid ranges.

Here’s an example of how you can set the gain range and exposure time range using gstreamer:

gst-launch-1.0 nvarguscamerasrc sensor-id=0 \
  ! 'video/x-raw(memory:NVMM), width=1920, height=1080, framerate=30/1, format=NV12' \
  ! nvvidconv \
  ! xvimagesink \
  gain-range=100 1000 \
  exposure-time-range=1000 10000

In this example, the gain range is set to 100 1000, and the exposure time range is set to 1000 10000. You should replace these values with the valid ranges for your sensor.

In summary, the issue you’re facing is due to invalid gain and exposure time ranges being set using g_object_set_property. To resolve this issue, you need to ensure that you’re setting valid ranges for these values, and you can use gstreamer to set these values correctly.

*** Please give the thumbs up if you get answers you like. Or provide feedback to help us improve the answer. ***

I found an issue in the nvarguscamerasrc source code: there is no option to dynamically change the range if it’s out of bounds. The root cause is that sensorModeAnalogGainRange and limitExposureTimeRange are only declared and not initialized in threadExecute (the function responsible for dynamic changes), so they are initialized as [0, 0]. As a result, every attempt to set a new maximum fails, since any value greater than 0 is considered invalid.

For my use case, it was enough to delete the lines that check the min/max values in threadExecute, because I want full control on the fly and I already have a predefined set of values I use.

these are my changes:

remove_min_max_checks_patch.txt (2.2 KB)

Thanks,

Ori

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.