camera_reconfigure.py
Go to the documentation of this file.
1 #!/usr/bin/env python
2 
3 # Copyright (C) 2015 Fetch Robotics Inc
4 #
5 # Licensed under the Apache License, Version 2.0 (the "License");
6 # you may not use this file except in compliance with the License.
7 # You may obtain a copy of the License at
8 #
9 # http://www.apache.org/licenses/LICENSE-2.0
10 #
11 # Unless required by applicable law or agreed to in writing, software
12 # distributed under the License is distributed on an "AS IS" BASIS,
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 # See the License for the specific language governing permissions and
15 # limitations under the License.
16 
17 # Author: Michael Ferguson
18 
19 import sys
20 import rospy
21 import dynamic_reconfigure.client
22 
23 class CameraReconfigure(object):
24 
25  def __init__(self):
26  self.client = dynamic_reconfigure.client.Client("head_camera/driver",
27  timeout=30,
28  config_callback=self.callback)
29 
30  def disable_auto(self):
31  self.client.update_configuration({"auto_exposure": False,
32  "auto_white_balance": False})
33 
34  def enable_auto(self):
35  self.client.update_configuration({"auto_exposure": True,
36  "auto_white_balance": True})
37 
38  def callback(self, config):
39  rospy.loginfo("camera configured")
40 
41 if __name__ == "__main__":
42  if len(sys.argv) < 2:
43  print("Usage: camera_reconfigure --enable/disable")
44  exit(-1)
45 
46  rospy.init_node("camera_reconfigure")
47  reconfigure = CameraReconfigure()
48 
49  if sys.argv[1] == "--enable":
50  reconfigure.enable_auto()
51  else:
52  reconfigure.disable_auto()
53 
54  rospy.sleep(1)


fetch_calibration
Author(s): Michael Ferguson
autogenerated on Mon Feb 28 2022 22:23:49