Best Python code snippet using avocado_python
Camera1394Stereo.cfg
Source:Camera1394Stereo.cfg
1#! /usr/bin/env python2#*3#* Copyright (c) 2010, Jack O'Quin4#* All rights reserved.5#*6#* Redistribution and use in source and binary forms, with or without7#* modification, are permitted provided that the following conditions8#* are met:9#*10#* * Redistributions of source code must retain the above copyright11#* notice, this list of conditions and the following disclaimer.12#* * Redistributions in binary form must reproduce the above13#* copyright notice, this list of conditions and the following14#* disclaimer in the documentation and/or other materials provided15#* with the distribution.16#* * Neither the name of the author nor the names of other17#* contributors may be used to endorse or promote products derived18#* from this software without specific prior written permission.19#*20#* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS21#* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT22#* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS23#* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE24#* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,25#* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,26#* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;27#* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER28#* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT29#* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN30#* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE31#* POSSIBILITY OF SUCH DAMAGE.32#***********************************************************33# 1394 camera dynamic configuration34PACKAGE='camera1394stereo'35from dynamic_reconfigure.parameter_generator_catkin import *36# Reconfiguration levels, must agree with Levels class in driver1394.h:37class SensorLevels:38 RECONFIGURE_CLOSE = 3 # Parameters that need the device closed to change39 RECONFIGURE_STOP = 1 # Parameters that need the device stopped to change40 RECONFIGURE_RUNNING = 0 # Parameters that can be changed while streaming41gen = ParameterGenerator()42# Name, Type, Reconfiguration level, Description, Default, Min, Max43gen.add("guid", str_t, SensorLevels.RECONFIGURE_CLOSE,44 "Global Unique ID of camera, 16 hex digits (use first camera if null).",45 "")46gen.add("reset_on_open", bool_t, SensorLevels.RECONFIGURE_CLOSE,47 "Reset camera when opening the device.", False)48modes = gen.enum([gen.const("Format0_Mode0", str_t, "160x120_yuv444", ""),49 gen.const("Format0_Mode1", str_t, "320x240_yuv422", ""),50 gen.const("Format0_Mode2", str_t, "640x480_yuv411", ""),51 gen.const("Format0_Mode3", str_t, "640x480_yuv422", ""),52 gen.const("Format0_Mode4", str_t, "640x480_rgb8", ""),53 gen.const("Format0_Mode5", str_t, "640x480_mono8", ""),54 gen.const("Format0_Mode6", str_t, "640x480_mono16", ""),55 gen.const("Format1_Mode0", str_t, "800x600_yuv422", ""),56 gen.const("Format1_Mode1", str_t, "800x600_rgb8", ""),57 gen.const("Format1_Mode2", str_t, "800x600_mono8", ""),58 gen.const("Format1_Mode6", str_t, "800x600_mono16", ""),59 gen.const("Format1_Mode3", str_t, "1024x768_yuv422", ""),60 gen.const("Format1_Mode4", str_t, "1024x768_rgb8", ""),61 gen.const("Format1_Mode5", str_t, "1024x768_mono8", ""),62 gen.const("Format1_Mode7", str_t, "1024x768_mono16", ""),63 gen.const("Format2_Mode0", str_t, "1280x960_yuv422", ""),64 gen.const("Format2_Mode1", str_t, "1280x960_rgb8", ""),65 gen.const("Format2_Mode2", str_t, "1280x960_mono8", ""),66 gen.const("Format2_Mode6", str_t, "1280x960_mono16", ""),67 gen.const("Format2_Mode3", str_t, "1600x1200_yuv422", ""),68 gen.const("Format2_Mode4", str_t, "1600x1200_rgb8", ""),69 gen.const("Format2_Mode5", str_t, "1600x1200_mono8", ""),70 gen.const("Format2_Mode7", str_t, "1600x1200_mono16", ""),71 gen.const("Format7_Mode0", str_t, "format7_mode0", ""),72 gen.const("Format7_Mode1", str_t, "format7_mode1", ""),73 gen.const("Format7_Mode2", str_t, "format7_mode2", ""),74 gen.const("Format7_Mode3", str_t, "format7_mode3", ""),75 gen.const("Format7_Mode4", str_t, "format7_mode4", ""),76 gen.const("Format7_Mode5", str_t, "format7_mode5", ""),77 gen.const("Format7_Mode6", str_t, "format7_mode6", ""),78 gen.const("Format7_Mode7", str_t, "format7_mode7", ""),79 ],80 "Video mode for camera.")81gen.add("video_mode", str_t, SensorLevels.RECONFIGURE_CLOSE,82 "IIDC video mode.", "640x480_mono8", edit_method = modes)83gen.add("frame_id", str_t, SensorLevels.RECONFIGURE_CLOSE,84 "ROS tf frame of reference, resolved with tf_prefix unless absolute.",85 "stereo_camera")86gen.add("frame_rate", double_t, SensorLevels.RECONFIGURE_CLOSE,87 "Camera speed (frames per second).", 15.0, 1.875, 240.0)88gen.add("iso_speed", int_t, SensorLevels.RECONFIGURE_CLOSE,89 "Total IEEE 1394 bus bandwidth (Megabits/second).", 400, 100, 3200)90gen.add("camera_info_url_left", str_t, SensorLevels.RECONFIGURE_RUNNING,91 "Left camera calibration URL for this video_mode (uncalibrated if null).",92 "")93gen.add("camera_info_url_right", str_t, SensorLevels.RECONFIGURE_RUNNING,94 "Right camera calibration URL for this video_mode (uncalibrated if null).",95 "")96# Format7-specific parameters97gen.add("binning_x", int_t, SensorLevels.RECONFIGURE_CLOSE,98 "Number of pixels combined for Format7 horizontal binning, use device hints if zero.",99 0, 0, 4)100gen.add("binning_y", int_t, SensorLevels.RECONFIGURE_CLOSE,101 "Number of pixels combined for Format7 vertical binning, use device hints if zero.",102 0, 0, 4)103gen.add("roi_width", int_t, SensorLevels.RECONFIGURE_CLOSE,104 "Width of Format7 Region of Interest in unbinned pixels, full width if zero.",105 0, 0, 65535)106gen.add("roi_height", int_t, SensorLevels.RECONFIGURE_CLOSE,107 "Height of Format7 Region of Interest in unbinned pixels, full height if zero.",108 0, 0, 65535)109gen.add("x_offset", int_t, SensorLevels.RECONFIGURE_CLOSE,110 "Horizontal offset for left side of Format7 ROI in unbinned pixels.",111 0, 0, 65535)112gen.add("y_offset", int_t, SensorLevels.RECONFIGURE_CLOSE,113 "Vertical offset for top of Format7 ROI in unbinned pixels.",114 0, 0, 65535)115gen.add("format7_packet_size", int_t, SensorLevels.RECONFIGURE_CLOSE,116 "Format7 packet size (bytes), device-recommended size if zero.",117 0, 0, 39320)118codings = gen.enum([gen.const("mono8", str_t, "mono8", ""),119 gen.const("mono16", str_t, "mono16", ""),120 gen.const("mono16s", str_t, "mono16s", ""),121 gen.const("raw8", str_t, "raw8", ""),122 gen.const("raw16", str_t, "raw16", ""),123 gen.const("rgb8", str_t, "rgb8", ""),124 gen.const("rgb16", str_t, "rgb16", ""),125 gen.const("rgb16s", str_t, "rgb16s", ""),126 gen.const("yuv411", str_t, "yuv411", ""),127 gen.const("yuv422", str_t, "yuv422", ""),128 gen.const("yuv444", str_t, "yuv444", "")],129 "Format7 color coding methods")130gen.add("format7_color_coding", str_t, SensorLevels.RECONFIGURE_CLOSE,131 "Color coding (only for Format7 modes)", "mono8",132 edit_method = codings)133# Bayer color filter parameters134patterns = gen.enum([gen.const("none", str_t, "", "No Bayer encoding"),135 gen.const("rggb", str_t, "rggb", ""),136 gen.const("gbrg", str_t, "gbrg", ""),137 gen.const("grbg", str_t, "grbg", ""),138 gen.const("bggr", str_t, "bggr", "")],139 "Bayer color encoding patterns")140gen.add("bayer_pattern", str_t, SensorLevels.RECONFIGURE_CLOSE,141 "Bayer color encoding pattern (default: none).", "",142 edit_method = patterns)143methods = gen.enum([gen.const("image_proc", str_t, "",144 "Decode via ROS image_proc"),145 gen.const("DownSample", str_t, "DownSample", ""),146 gen.const("Simple", str_t, "Simple", ""),147 gen.const("Bilinear", str_t, "Bilinear", ""),148 gen.const("HQ", str_t, "HQ", ""),149 gen.const("VNG", str_t, "VNG", ""),150 gen.const("AHD", str_t, "AHD", "")],151 "Bayer method")152gen.add("bayer_method", str_t, SensorLevels.RECONFIGURE_CLOSE,153 "Bayer decoding method (default: ROS image_proc).",154 "", edit_method = methods)155# Stereo extract parameters156stereo_methods = gen.enum([gen.const("No_stereo", str_t, "","No stereo extraction"),157 gen.const("Interlaced", str_t, "Interlaced", ""),158 gen.const("Field", str_t, "Field", "")],159 "Stereo method")160 161gen.add("stereo_method", str_t, SensorLevels.RECONFIGURE_CLOSE,162 "Stereo extraction method (default: no extraction).",163 "", edit_method = stereo_methods)164# Generic IIDC feature control states, not all apply.165controls = gen.enum([gen.const("Off", int_t, 0, "Use fixed value"),166 gen.const("Query", int_t, 1, "Query current values"),167 gen.const("Auto", int_t, 2, "Camera sets continuously"),168 gen.const("Manual", int_t, 3, "Use explicit value"),169 gen.const("OnePush", int_t, 4, "Camera sets once"),170 gen.const("None", int_t, 5, "Feature not available")],171 "Feature control states")172gen.add("auto_brightness", int_t, SensorLevels.RECONFIGURE_RUNNING,173 "Brightness control state.", 1, 0, 4, edit_method = controls)174gen.add("brightness", double_t, SensorLevels.RECONFIGURE_RUNNING,175 "Black level offset.", 0., 0., 4095.)176gen.add("auto_exposure", int_t, SensorLevels.RECONFIGURE_RUNNING,177 "Combined Gain, Iris & Shutter control.",178 1, 0, 4, edit_method = controls)179gen.add("exposure", double_t, SensorLevels.RECONFIGURE_RUNNING,180 "Auto exposure value (like contrast).", 0., -10., 4095.)181gen.add("auto_focus", int_t, SensorLevels.RECONFIGURE_RUNNING,182 "Focus control state.", 1, 0, 4, edit_method= controls)183gen.add("focus", double_t, SensorLevels.RECONFIGURE_RUNNING,184 "Focus control.", 0., 0., 4095.)185gen.add("auto_gain", int_t, SensorLevels.RECONFIGURE_RUNNING,186 "Gain control state.", 1, 0, 4, edit_method = controls)187gen.add("gain", double_t, SensorLevels.RECONFIGURE_RUNNING,188 "Relative circuit gain.", 0., -10., 4095)189gen.add("auto_gamma", int_t, SensorLevels.RECONFIGURE_RUNNING,190 "Gamma control state.", 1, 0, 4, edit_method = controls)191gen.add("gamma", double_t, SensorLevels.RECONFIGURE_RUNNING,192 "Gamma expansion exponent.", 2.2, 0., 10.)193gen.add("auto_hue", int_t, SensorLevels.RECONFIGURE_RUNNING,194 "Hue control state.", 1, 0, 4, edit_method = controls)195gen.add("hue", double_t, SensorLevels.RECONFIGURE_RUNNING,196 "Color phase.", 0., 0., 4095.)197gen.add("auto_iris", int_t, SensorLevels.RECONFIGURE_RUNNING,198 "Iris control state.", 1, 0, 4, edit_method = controls)199gen.add("iris", double_t, SensorLevels.RECONFIGURE_RUNNING,200 "Iris control.", 8., 0., 4095.)201gen.add("auto_saturation", int_t, SensorLevels.RECONFIGURE_RUNNING,202 "Saturation control state.", 1, 0, 4, edit_method = controls)203gen.add("saturation", double_t, SensorLevels.RECONFIGURE_RUNNING,204 "Color saturation.", 1., 0., 4095.)205gen.add("auto_sharpness", int_t, SensorLevels.RECONFIGURE_RUNNING,206 "Sharpness control state.", 1, 0, 4, edit_method = controls)207gen.add("sharpness", double_t, SensorLevels.RECONFIGURE_RUNNING,208 "Image sharpness.", 1., 0., 4095.)209gen.add("auto_shutter", int_t, SensorLevels.RECONFIGURE_RUNNING,210 "Shutter control state.", 1, 0, 4, edit_method = controls)211gen.add("external_trigger", bool_t, SensorLevels.RECONFIGURE_RUNNING,212 "External trigger power state", False)213gen.add("software_trigger", bool_t, SensorLevels.RECONFIGURE_RUNNING,214 "Software trigger power state", False)215trigger_modes = gen.enum([gen.const("Mode_0", str_t, "mode_0", "Exposure starts with a falling edge and stops when the the exposure specified by the SHUTTER feature is elapsed"),216 gen.const("Mode_1", str_t, "mode_1", "Exposure starts with a falling edge and stops with the next rising edge"),217 gen.const("Mode_2", str_t, "mode_2", "The camera starts the exposure at the first falling edge and stops the integration at the nth falling edge"),218 gen.const("Mode_3", str_t, "mode_3", "This is an internal trigger mode. The trigger is generated every n*(period of fastest framerate)"),219 gen.const("Mode_4", str_t, "mode_4", "A multiple exposure mode. N exposures are performed each time a falling edge is observed on the trigger signal. Each exposure is as long as defined by the SHUTTER feature"),220 gen.const("Mode_5", str_t, "mode_5", "Same as Mode 4 except that the exposure is is defined by the length of the trigger pulse instead of the SHUTTER feature"),221 gen.const("Mode_14", str_t, "mode_14", "-- vendor specified trigger mode"),222 gen.const("Mode_15", str_t, "mode_15", "-- vendor specified trigger mode")],223 "Trigger modes")224gen.add("trigger_mode", str_t, SensorLevels.RECONFIGURE_RUNNING,225 "External trigger mode", "mode_0",226 edit_method = trigger_modes)227trigger_sources = \228 gen.enum([gen.const("Source_0", str_t, "source_0", ""),229 gen.const("Source_1", str_t, "source_1", ""),230 gen.const("Source_2", str_t, "source_2", ""),231 gen.const("Source_3", str_t, "source_3", ""),232 gen.const("Source_Software", str_t, "source_software", "")],233 "External trigger sources")234gen.add("trigger_source", str_t, SensorLevels.RECONFIGURE_RUNNING,235 "External trigger source", "source_0",236 edit_method = trigger_sources)237trigger_polarity = \238 gen.enum([gen.const("Active_Low", str_t, "active_low", ""),239 gen.const("Active_High", str_t, "active_high", "")],240 "Trigger polarity")241gen.add("trigger_polarity", str_t, SensorLevels.RECONFIGURE_RUNNING,242 "Trigger polarity", "active_low",243 edit_method = trigger_polarity)244gen.add("auto_trigger", int_t, SensorLevels.RECONFIGURE_RUNNING,245 "Trigger control state.", 1, 0, 4, edit_method = controls)246gen.add("trigger", double_t, SensorLevels.RECONFIGURE_RUNNING,247 "Trigger parameter N", 0., 0., 4095.)248gen.add("shutter", double_t, SensorLevels.RECONFIGURE_RUNNING,249 "Shutter speed.", 1., 0., 4095.)250gen.add("auto_pan", int_t, SensorLevels.RECONFIGURE_RUNNING,251 "PAN register control state.", 1, 0, 4, edit_method = controls)252gen.add("pan", double_t, SensorLevels.RECONFIGURE_RUNNING,253 "PAN control to witch camera output order", 0., 0., 4.)254# For bumblebee2 hicol cameras the absolute mode of these feature 255# does not seem to work (setting the feature mode to absolute mode and256# and changing the absolute value does not change the previous frame rate).257# However, the manual mode works, though the conversion form integer register258# values to real frame rates is strange (for sure it is not linear).259# From Coriander, the range and some interesting values are:260# 470 = 20.19874954 fps (max value)261# 480 = 20.00000000 fps (value for auto mode)262# 800 = 15.00000000 fps263# 1232 = 10.00000000 fps264# 1544 = 7.50000000 fps265# 1864 = 5.00000000 fps266# 2116 = 3.75000000 fps267# 2276 = 3.00000000 fps268# 2618 = 2.00000000 fps269# 2658 = 1.87500000 fps270# 3145 = 1.00000000 fps271# 4095 = 0.29112083 fps (min value)272gen.add("auto_frame_rate_feature", int_t, SensorLevels.RECONFIGURE_RUNNING,273 "Frame rate dc1394 feature state.", 1, 0, 4, edit_method = controls)274gen.add("frame_rate_feature", double_t, SensorLevels.RECONFIGURE_RUNNING,275 "Frame rate IIDC v1.31 feature", 480., 470., 4095.)276gen.add("auto_white_balance", int_t, SensorLevels.RECONFIGURE_RUNNING,277 "White balance control state.", 1, 0, 4, edit_method = controls)278gen.add("white_balance_BU", double_t, SensorLevels.RECONFIGURE_RUNNING,279 "Blue or U component of white balance.",280 0., 0., 4095.)281gen.add("white_balance_RV", double_t, SensorLevels.RECONFIGURE_RUNNING,282 "Red or V component of white balance.",283 0., 0., 4095.)284gen.add("auto_zoom", int_t, SensorLevels.RECONFIGURE_RUNNING,285 "Zoom control state.", 1, 0, 4, edit_method = controls)286gen.add("zoom", double_t, SensorLevels.RECONFIGURE_RUNNING,287 "Zoom control.", 0., 0., 4095.)288PACKAGE='camera1394stereo'...
PointGrey.cfg
Source:PointGrey.cfg
1#! /usr/bin/env python2'''3This code was developed by the National Robotics Engineering Center (NREC),4part of Carnegie Mellon University's Robotics Institute. Its development was5funded by DARPA under the LS3 program and submitted for public release6on June 7th, 2012. Release was granted on August, 21st 2012 with Distribution Statement A7(Approved for Public Release, Distribution Unlimited).8This software is released under a BSD license:9Copyright (c) 2012, National Robotics Engineering Center (NREC)10All rights reserved.11Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:12Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.13Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.14Neither the name of the National Robotics Engineering Center (NREC) nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.15THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.16'''17'''18 @file Camera.cfg19 @author Chad Rockey20 @date July 11, 201121 @brief Interface to Point Grey cameras22 @attention Copyright (C) 201123 @attention National Robotics Engineering Center24 @attention Carnegie Mellon University25 @attention Adapted from ROS Camera1394.cfg by Jack O' Quin26'''27#* Copyright (c) 2010, Jack O'Quin28#* All rights reserved. BSD.29#*30#* Redistribution and use in source and binary forms, with or without31#* modification, are permitted provided that the following conditions32#* are met:33#*34#* * Redistributions of source code must retain the above copyright35#* notice, this list of conditions and the following disclaimer.36#* * Redistributions in binary form must reproduce the above37#* copyright notice, this list of conditions and the following38#* disclaimer in the documentation and/or other materials provided39#* with the distribution.40#* * Neither the name of the author nor the names of other41#* contributors may be used to endorse or promote products derived42#* from this software without specific prior written permission.43#*44#* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS45#* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT46#* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS47#* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE48#* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,49#* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,50#* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;51#* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER52#* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT53#* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN54#* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE55#* POSSIBILITY OF SUCH DAMAGE.56#***********************************************************57PACKAGE='pointgrey_camera_driver'58from dynamic_reconfigure.parameter_generator_catkin import *59class SensorLevels:60 RECONFIGURE_RUNNING = 061 RECONFIGURE_STOP = 162gen = ParameterGenerator()63# Name Type Reconfiguration level Description Default Min Max64video_modes = gen.enum([gen.const("Format0_Mode5", str_t, "640x480_mono8", ""),65 gen.const("Format0_Mode6", str_t, "640x480_mono16", ""),66 gen.const("Format2_Mode1", str_t, "1280x960_bayer8", ""),67 gen.const("Format2_Mode2", str_t, "1280x960_mono8", ""),68 gen.const("Format2_Mode6", str_t, "1280x960_mono16", ""),69 gen.const("Format7_Mode0", str_t, "format7_mode0", ""),70 gen.const("Format7_Mode1", str_t, "format7_mode1", ""),71 gen.const("Format7_Mode2", str_t, "format7_mode2", ""),72 gen.const("Format7_Mode3", str_t, "format7_mode3", ""),73 gen.const("Format7_Mode4", str_t, "format7_mode4", ""),74 gen.const("Format7_Mode5", str_t, "format7_mode5", ""),75 gen.const("Format7_Mode7", str_t, "format7_mode7", ""),76 ],77 "Video mode for camera.")78gen.add("video_mode", str_t, SensorLevels.RECONFIGURE_STOP, "Video mode.", "format7_mode0", edit_method = video_modes)79gen.add("frame_rate", double_t, SensorLevels.RECONFIGURE_RUNNING, "Camera speed (frames per second).", 7, 0, 166)80gen.add("auto_exposure", bool_t, SensorLevels.RECONFIGURE_RUNNING, "Allow the camera to automatically change exposure (Combined Gain, Iris & Shutter control).", True)81gen.add("exposure", double_t, SensorLevels.RECONFIGURE_RUNNING, "Auto exposure value (like contrast).", 1.35, -10.0, 10.0)82gen.add("auto_shutter", bool_t, SensorLevels.RECONFIGURE_RUNNING, "Shutter control state.", True)83gen.add("shutter_speed", double_t, SensorLevels.RECONFIGURE_RUNNING, "Amount of time (in seconds) for the apeture to remain open.", 0.03, 0.0, 1.0)84gen.add("auto_gain", bool_t, SensorLevels.RECONFIGURE_RUNNING, "Gain control state.", True)85gen.add("gain", double_t, SensorLevels.RECONFIGURE_RUNNING, "Relative circuit gain.", 0, -10, 30)86gen.add("pan", int_t, SensorLevels.RECONFIGURE_RUNNING, "Controls camera pan.", 0, -1000, 1000)87gen.add("tilt", int_t, SensorLevels.RECONFIGURE_RUNNING, "Controls camera tilt.", 0, -1000, 1000)88gen.add("brightness", double_t, SensorLevels.RECONFIGURE_RUNNING, "Black level offset.", 0.0, 0.0, 10.0)89gen.add("auto_sharpness", bool_t, SensorLevels.RECONFIGURE_RUNNING, "Allow the camera to automatically change sharpness.", True)90gen.add("sharpness", double_t, SensorLevels.RECONFIGURE_RUNNING, "sharpness.", 1024.0, 0.0, 4095.0)91gen.add("auto_saturation", bool_t, SensorLevels.RECONFIGURE_RUNNING, "Allow the camera to automatically change saturation.", True)92gen.add("saturation", double_t, SensorLevels.RECONFIGURE_RUNNING, "saturation.", 100.0, 0.0, 399.0)93gen.add("gamma", double_t, SensorLevels.RECONFIGURE_RUNNING, "Gamma expansion exponent.", 1.0, 0.5, 4.0)94gen.add("auto_white_balance", bool_t, SensorLevels.RECONFIGURE_RUNNING, "Automatically change white balance", True)95gen.add("white_balance_blue", int_t, SensorLevels.RECONFIGURE_RUNNING, "White balance blue component.", 800, 0, 1023)96gen.add("white_balance_red", int_t, SensorLevels.RECONFIGURE_RUNNING, "White balance red component.", 550, 0, 1023)97# Format7-specific parameters98gen.add("format7_roi_width", int_t, SensorLevels.RECONFIGURE_STOP, "Width of Format7 Region of Interest in unbinned pixels, full width if zero.", 0, 0, 65535)99gen.add("format7_roi_height", int_t, SensorLevels.RECONFIGURE_STOP, "Height of Format7 Region of Interest in unbinned pixels, full height if zero.", 0, 0, 65535)100gen.add("format7_x_offset", int_t, SensorLevels.RECONFIGURE_STOP, "Horizontal offset for left side of Format7 ROI in unbinned pixels.", 0, 0, 65535)101gen.add("format7_y_offset", int_t, SensorLevels.RECONFIGURE_STOP, "Vertical offset for top of Format7 ROI in unbinned pixels.", 0, 0, 65535)102codings = gen.enum([gen.const("Mono8", str_t, "mono8", ""),103 gen.const("Mono16", str_t, "mono16", ""),104 gen.const("Raw8", str_t, "raw8", ""),105 gen.const("Raw16", str_t, "raw16", ""),106 gen.const("RGB8", str_t, "rgb8", "")],107 "Format7 color coding methods")108gen.add("format7_color_coding", str_t, SensorLevels.RECONFIGURE_STOP, "Color coding (only for Format7 modes)", "raw8", edit_method = codings)109# Trigger parameters110gen.add("enable_trigger", bool_t, SensorLevels.RECONFIGURE_RUNNING, "Enable the external triggering mode.", False)111trigger_modes = gen.enum([gen.const("Mode0", str_t, "mode0", ""),112 gen.const("Mode1_bulb_trigger", str_t, "mode1", ""),113 gen.const("Mode3", str_t, "mode3", ""),114 gen.const("Mode14", str_t, "mode14", "")],115 "IIDC v1.31 Trigger Modes")116gen.add("trigger_mode", str_t, SensorLevels.RECONFIGURE_RUNNING, "IIDC v1.31 Trigger Modes", "mode0", edit_method = trigger_modes)117gpio_pins = gen.enum([gen.const("GPIO0", str_t, "gpio0", ""),118 gen.const("GPIO1", str_t, "gpio1", ""),119 gen.const("GPIO2", str_t, "gpio2", ""),120 gen.const("GPIO3", str_t, "gpio3", "")],121 "GPIO Trigger Sources")122gen.add("trigger_source", str_t, SensorLevels.RECONFIGURE_RUNNING, "GPIO Trigger Sources", "gpio0", edit_method = gpio_pins)123polarities = gen.enum([gen.const("Low", int_t, 0, "Low Polarity"),124 gen.const("High", int_t, 1, "High Polarity")],125 "GPIO Polarities")126gen.add("trigger_polarity", int_t, SensorLevels.RECONFIGURE_RUNNING, "GPIO Trigger Polarity", 0, edit_method = polarities)127gen.add("enable_trigger_delay", bool_t, SensorLevels.RECONFIGURE_RUNNING, "Whether Trigger Delay is active.", False)128gen.add("trigger_delay", double_t, SensorLevels.RECONFIGURE_RUNNING, "The trigger delay to wait once triggered (in seconds).", 0.0, 0.0, 1.0)129gen.add("trigger_parameter", int_t, SensorLevels.RECONFIGURE_RUNNING, "Trigger mode parameter. Varies based on mode.", 0, -32768, 32767)130gen.add("enable_strobe1", bool_t, SensorLevels.RECONFIGURE_RUNNING, "Whether strobe is sent.", False)131gen.add("strobe1_polarity", int_t, SensorLevels.RECONFIGURE_RUNNING, "GPIO Strobe Polarity", 0, edit_method = polarities)132gen.add("strobe1_delay", double_t, SensorLevels.RECONFIGURE_RUNNING, "The delay between capture and strobe out (in milliseconds).", 0.0, 0.0, 1000.0)133gen.add("strobe1_duration", double_t, SensorLevels.RECONFIGURE_RUNNING, "Strobe duration (in milliseconds)", 0.0, 0.0, 1000.0)134gen.add("enable_strobe2", bool_t, SensorLevels.RECONFIGURE_RUNNING, "Whether strobe is sent.", False)135gen.add("strobe2_polarity", int_t, SensorLevels.RECONFIGURE_RUNNING, "GPIO Strobe Polarity", 0, edit_method = polarities)136gen.add("strobe2_delay", double_t, SensorLevels.RECONFIGURE_RUNNING, "The delay between capture and strobe out (in milliseconds).", 0.0, 0.0, 1000.0)137gen.add("strobe2_duration", double_t, SensorLevels.RECONFIGURE_RUNNING, "Strobe duration (in milliseconds)", 0.0, 0.0, 1000.0)...
test_reconfig01.py
Source:test_reconfig01.py
...31# test_reconfig01.py32# Smoke-test the connection reconfiguration operations.33class test_reconfig01(wttest.WiredTigerTestCase):34 def test_reconfig_shared_cache(self):35 self.conn.reconfigure("shared_cache=(name=pool,size=300M)")36 def test_reconfig_async(self):37 # Async starts off. Reconfigure through all the various cases, each38 # building from the previous state.39 # Async is off, and remains off.40 self.conn.reconfigure("async=(enabled=false)")41 # Async is off, turn it on.42 self.conn.reconfigure("async=(enabled=true)")43 # Async is on, and remains on.44 self.conn.reconfigure("async=(enabled=true)")45 # Async is on, turn it off.46 self.conn.reconfigure("async=(enabled=false)")47 # Async is off, turn it on with ops_max and threads.48 self.conn.reconfigure("async=(enabled=true,ops_max=512,threads=10)")49 # Reconfigure and use same thread count. (no-op)50 self.conn.reconfigure("async=(threads=10)")51 # Reconfigure more threads.52 self.conn.reconfigure("async=(threads=14)")53 # Reconfigure fewer threads.54 self.conn.reconfigure("async=(threads=8)")55 # Reconfigure illegal ops_max (ignored).56 self.conn.reconfigure("async=(ops_max=1024)")57 # Turn async off.58 self.conn.reconfigure("async=(enabled=false)")59 # Async is off, turn it on. Should end up with the60 # same ops_max of 512 and thread of 8.61 self.conn.reconfigure("async=(enabled=true)")62 def test_reconfig_eviction(self):63 # Increase the max number of running threads (default 8).64 self.conn.reconfigure("eviction=(threads_max=10)")65 # Increase the min number of running threads (default 1).66 self.conn.reconfigure("eviction=(threads_min=5)")67 # Decrease the max number of running threads.68 self.conn.reconfigure("eviction=(threads_max=7)")69 # Decrease the min number of running threads.70 self.conn.reconfigure("eviction=(threads_min=2)")71 # Set min and max the same.72 self.conn.reconfigure("eviction=(threads_min=6,threads_max=6)")73 # Set target and trigger with an absolute value.74 self.conn.reconfigure("eviction_target=50M,eviction_trigger=100M")75 # Set dirty target and trigger with an absolute value76 self.conn.reconfigure("eviction_dirty_target=20M,"77 "eviction_dirty_trigger=40M")78 # Set eviction checkpoint target with an absolute value79 self.conn.reconfigure("eviction_checkpoint_target=50M")80 def test_reconfig_lsm_manager(self):81 # We create and populate a tiny LSM so that we can start off with82 # the LSM threads running and change the numbers of threads.83 # Take all the defaults.84 uri = "lsm:test_reconfig"85 nrecs = 1086 SimpleDataSet(self, uri, nrecs).populate()87 # Sleep to make sure all threads are started.88 time.sleep(2)89 # Now that an LSM tree exists, reconfigure LSM manager threads.90 # We start with the default, which is 4. Configure more threads.91 self.conn.reconfigure("lsm_manager=(worker_thread_max=10)")92 # Generate some work93 nrecs = 2094 SimpleDataSet(self, uri, nrecs).populate()95 # Now reconfigure fewer threads.96 self.conn.reconfigure("lsm_manager=(worker_thread_max=3)")97 def test_reconfig_statistics(self):98 self.conn.reconfigure("statistics=(all)")99 self.conn.reconfigure("statistics=(fast)")100 self.conn.reconfigure("statistics=(none)")101 def test_reconfig_capacity(self):102 self.conn.reconfigure("io_capacity=(total=80M)")103 self.conn.reconfigure("io_capacity=(total=100M)")104 msg = '/below minimum/'105 self.assertRaisesWithMessage(wiredtiger.WiredTigerError,106 lambda: self.conn.reconfigure("io_capacity=(total=16K)"), msg)107 def test_reconfig_checkpoints(self):108 self.conn.reconfigure("checkpoint=(wait=0)")109 self.conn.reconfigure("checkpoint=(wait=5)")110 self.conn.reconfigure("checkpoint=(log_size=0)")111 self.conn.reconfigure("checkpoint=(log_size=1M)")112 # Statistics logging: reconfigure the things we can reconfigure.113 def test_reconfig_statistics_log_ok(self):114 self.conn.reconfigure("statistics=[all],statistics_log=(wait=0)")115 self.conn.reconfigure("statistics_log=(wait=0)")116 self.conn.reconfigure("statistics_log=(wait=2,json=true)")117 self.conn.reconfigure("statistics_log=(wait=0)")118 self.conn.reconfigure("statistics_log=(wait=2,on_close=true)")119 self.conn.reconfigure("statistics_log=(wait=0)")120 self.conn.reconfigure("statistics_log=(wait=2,sources=[lsm:])")121 self.conn.reconfigure("statistics_log=(wait=0)")122 self.conn.reconfigure("statistics_log=(wait=2,timestamp=\"t%b %d\")")123 self.conn.reconfigure("statistics_log=(wait=0)")124 # Statistics logging: reconfigure the things we can't reconfigure.125 def test_reconfig_statistics_log_fail(self):126 msg = '/unknown configuration key/'127 self.assertRaisesWithMessage(wiredtiger.WiredTigerError,128 lambda: self.conn.reconfigure("log=(path=foo)"), msg)129 def test_file_manager(self):130 self.conn.reconfigure("file_manager=(close_scan_interval=3)")131 self.conn.reconfigure("file_manager=(close_idle_time=4)")132 self.conn.reconfigure(133 "file_manager=(close_idle_time=4,close_scan_interval=100)")134if __name__ == '__main__':...
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!