camera_reconfigure.py
Go to the documentation of this file.
00001 #!/usr/bin/env python
00002 
00003 # Copyright (C) 2015 Fetch Robotics Inc
00004 #
00005 # Licensed under the Apache License, Version 2.0 (the "License");
00006 # you may not use this file except in compliance with the License.
00007 # You may obtain a copy of the License at
00008 #
00009 #     http://www.apache.org/licenses/LICENSE-2.0
00010 #
00011 # Unless required by applicable law or agreed to in writing, software
00012 # distributed under the License is distributed on an "AS IS" BASIS,
00013 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00014 # See the License for the specific language governing permissions and
00015 # limitations under the License.
00016 
00017 # Author: Michael Ferguson
00018 
00019 import sys
00020 import rospy
00021 import dynamic_reconfigure.client
00022 
00023 class CameraReconfigure(object):
00024 
00025     def __init__(self):
00026         self.client = dynamic_reconfigure.client.Client("head_camera/driver",
00027                                                         timeout=30,
00028                                                         config_callback=self.callback)
00029 
00030     def disable_auto(self):
00031         self.client.update_configuration({"auto_exposure": False,
00032                                           "auto_white_balance": False})
00033 
00034     def enable_auto(self):
00035         self.client.update_configuration({"auto_exposure": True,
00036                                           "auto_white_balance": True})
00037 
00038     def callback(self, config):
00039         rospy.loginfo("camera configured")
00040 
00041 if __name__ == "__main__":
00042     if len(sys.argv) < 2:
00043         print("Usage: camera_reconfigure --enable/disable")
00044         exit(-1)
00045 
00046     rospy.init_node("camera_reconfigure")
00047     reconfigure = CameraReconfigure()
00048 
00049     if sys.argv[1] == "--enable":
00050         reconfigure.enable_auto()
00051     else:
00052         reconfigure.disable_auto()
00053 
00054     rospy.sleep(1)


fetch_calibration
Author(s): Michael Ferguson
autogenerated on Sat Aug 5 2017 04:00:20