anqixu / ueye_cam

A ROS nodelet and node that wraps the driver API for UEye cameras by IDS Imaging Development Systems GMBH.
Other
60 stars 102 forks source link

Auto_gain setting being overwritten by hardware gain #2

Closed ghost closed 10 years ago

ghost commented 10 years ago

Hello,

I've run into a problem when setting the auto_gain parameter using the ueye_cam driver. The relevant function is UEyeCamDriver::setGain().

The problem is that the call to is_SetHardwareGain() overwrites any changes to the auto_gain parameter. From the UEye manual for is_SetAutoParameter:

A manual change of the exposure time and gain settings disables the auto functions.

Since is_SetHardwareGain is called AFTER is_SetAutoParameter, auto_gain is always disabled right after having been enabled.

I've added a patch that prioritises auto_gain over the manual gain settings by moving is_SetAutoParameter behind is_SetHardwareGain function: https://gist.github.com/wji/8595160

Consequently, to set a master_gain manually, auto_gain must first be disabled, but I believe that is closer to the expected behaviour than not having auto_gain work at all :).

anqixu commented 10 years ago

Thank you wji for reporting this bug.

I've updated the code so that it behaves differently when auto gain is toggled on (where it will ONLY enable auto gain) and when auto gain is toggled off (where it will first disable auto gain, and the change other gain-related settings).

Also, the ROS wrapper will now auto-disable "auto gain" if it detects any changes in the manual gain params, which I presume is the ideal "expected behavior" that you were alluding to :D

12785f501c5dca74527b54d40420bdf289c927a1 4cba05953f335ff68c33d1231ea72298532b035f