Skip to content

Setting Sensor Parameters

Sammy Omari edited this page Apr 1, 2015 · 12 revisions

The libvisensor API allows to configure the sensors with direct access to certain configuration registers. The API is based on string value interface. The string selects the parameter, which will be set to the selected value.

Example call using the setSensorConfigParam(...)function:

visensor::ViSensorDriver drv_;
drv_.setSensorConfigParam(SensorId::CAM0, "coarse_shutter_width", 100);

The individual sensors are interfaced by their corresponding SensorId struct, as defined in the file libvisensor/include/visensor/visensor_constants.hpp and displayed below. Please

namespace SensorId {
  enum SensorId {
    CAM0 = 0, // MT9V034 cam0
    CAM1 = 1, // MT9V034 cam1
    CAM2 = 2, // MT9V034 cam2
    CAM3 = 3, // MT9V034 cam3
    IMU0 = 4, // ADIS 164XX IMU
    IMU_CAM0 = 5, // Ivensense MPU 9050 on cam0 PCB
    IMU_CAM1 = 6, // Ivensense MPU 9050 on cam1 PCB
    IMU_CAM2 = 7, // Ivensense MPU 9050 on cam2 PCB
    IMU_CAM3 = 8, // Ivensense MPU 9050 on cam3 PCB
    CORNER_CAM0 = 9, // Experimental
    CORNER_CAM1 = 10, // Experimental
    CORNER_CAM2 = 11, // Experimental
    CORNER_CAM3 = 12, // Experimental
    DENSE_MATCHER0 = 13, // Experimental
    EXTERNAL_TRIGGER0 = 14, // Trigger/Interrupt line
    SENSOR_STATUS = 15, // Experimental
    SENSOR_CLOCK = 16, // Experimental
    FLIR0 = 17, // Experimental
    FLIR1 = 18, // Experimental
    FLIR2 = 19, // Experimental
    FLIR3 = 20, // Experimental
    LED_FLASHER0 = 21, //PWM interface to LED Flasher
    NOT_SPECIFIED
  };
}

A sample program that interfaces the VI-Sensor and sets a camera parameter can be found here.

Cameras

The Aptina MT9V034 image sensors on the VI-Sensor can be configured with a wide range of parameters. Below the parameters supported by the libvisensor API are shortly described. The corresponding SensorId is SensorId::CAMx where x stands for the camera number (for the stereo camera this is 0 and 1). Please find more detailed information about the camera parameters in the MT9V034 datasheet.

Parameter Descriptions

parameter description
aec_enable enables the camera internal auto exposure controller.
coarse_shutter_width If aec_enable is set to false, the fixed exposure time is set by this parameter. Multiply by (752+94) * 1.0e3 / 25.0e6 to obtain ms
min_coarse_shutter_width Sets the lower limit for the automatic exposure control range. Multiply by (752+94) * 1.0e3 / 25.0e6 to obtain ms
max_coarse_shutter_width Sets the upper limit for the automatic exposure control range. Multiply by (752+94) * 1.0e3 / 25.0e6 to obtain ms
aec_low_pass_filter The number of frames the camera should use to calculate the auto exposure.
agc_enable enables the camera internal automatic analog gain controller.
global_analog_gain if agc_enable is set to false this parameters set the analog gain.
max_analog_gain Sets the upper limit for the automatic analog gain control range.
row_flip enables vertical mirroring on the camera chip (breaks the factory calibration)
column_flip enables horizontal mirroring on the camera chip (breaks the factory calibration)

Parameter Ranges and Types

parameter type default min max
aec_enable bool 1 0 1
coarse_shutter_width uint 480 2 32765
min_coarse_shutter_width uint 2 2 32765
max_coarse_shutter_width uint 100 2 32765
aec_low_pass_filter uint 0 0 16
agc_enable bool 1 0 1
global_analog_gain uint 16 16 64
max_analog_gain uint 64 16 64
row_flip bool 0 0 1
column_flip bool 0 0 1

Please note that a coarse shutter width of 950 (around 35 ms) is the maximal value that no frame drops occur at 20 Hz image rate. This is due to the fact that the image takes around 14 ms to be transmitted over LVDS to the FPGA and the imager cannot collect a new image while the transmission is still in place when in external trigger mode.

Triggers

The VI-Sensor provides a set of trigger/interrupt to interface external sensors. This enables us to tightly timesynchronize the VI-Sensor to external sensors such as Hokuyo 30LX or a GPS device (which both have a trigger output). Similarly, we can trigger measurements in other sensors via this line. The trigger functionality is not available in the standard configuration. If you are interested in using this feature, please contact us at info@skybotix.com for more information.

There are three pins, which can be used as trigger in- or output. All three triggers are handled with one sensor ID. Therefore the parameter strings contains the pin number (expressed as #) to select the desired pin. The corresponding SensorId is SensorId::EXTERNAL_TRIGGER0.

Parameter Descriptions

parameter description
enable_trigger_# enables the trigger with ID #
trigger_#_direction if set the trigger is used as input. (generates timestamps for each rising signal)
trigger_#_rate if set as output, this defines the frequency the trigger pin is sending a pulse.
trigger_#_offset set the trigger clock offset in FPGA clock cycles. (100000/s) allows a phase shift between other sensors.

Parameter Ranges and Types

parameter type default min max
trigger_#_direction bool 0 1
trigger_#_rate uint 0 100000
trigger_#_offset uint 0 100000

LED flashers

The LED flasher functionality is not available in the standard configuration. If you are interested in using this feature, please contact us at info@skybotix.com for more information.

One pin can be used as LED control output. It is designed to synchronize the LED strobes with the cameras to reduce power consumption and heat dissipation problems. The LED power can be controlled by setting the PWM duty cycle. And if needed it can also be configured to run continuously and the VI-Sensor will only generate a configurable PWM signal without breaks between camera exposure.

Parameter Descriptions

parameter description
strobe Sets the flasher duty cycle, where 100% is 12287.
strobe_mode Enables flashing only during camera exposure. If disabled flashers will run continuously with selected duty cycle.

Parameter Ranges and Types

parameter type default min max
strobe uint 2 0 12287
strobe_mode bool 1 0 1

Clone this wiki locally