Go to the documentation of this file.00001 """
00002    Copyright 2014 Southwest Research Institute
00003 
00004    Licensed under the Apache License, Version 2.0 (the "License");
00005    you may not use this file except in compliance with the License.
00006    You may obtain a copy of the License at
00007 
00008      http://www.apache.org/licenses/LICENSE-2.0
00009 
00010    Unless required by applicable law or agreed to in writing, software
00011    distributed under the License is distributed on an "AS IS" BASIS,
00012    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00013    See the License for the specific language governing permissions and
00014    limitations under the License.
00015 """
00016 
00017 import os
00018 import rospy
00019 import rospkg
00020 
00021 from qt_gui.plugin import Plugin
00022 from python_qt_binding import loadUi
00023 from python_qt_binding.QtGui import QWidget
00024 
00025 from std_srvs.srv import Empty
00026 
00027 class CalibrationControl(Plugin):
00028 
00029     def __init__(self, context):
00030         super(CalibrationControl, self).__init__(context)
00031         self.setObjectName('CalibrationControl')
00032         
00033         
00034         
00035         from argparse import ArgumentParser
00036         parser = ArgumentParser()
00037         
00038         parser.add_argument("-q", "--quiet", action="store_true",
00039                       dest="quiet",
00040                       help="Put plugin in silent mode")
00041         args, unknowns = parser.parse_known_args(context.argv())
00042         if not args.quiet:
00043             print 'arguments: ', args
00044             print 'unknowns: ', unknowns
00045 
00046         
00047         self._widget = QWidget()
00048         
00049         rp = rospkg.RosPack()
00050         ui_file = os.path.join(rp.get_path('industrial_calibration_gui'), 'resource', 'calibration_control.ui')
00051         loadUi(ui_file, self._widget)
00052         
00053         self._widget.setObjectName('calibration_control_Ui')
00054         
00055         
00056         self._widget.cal_button.clicked[bool].connect(self.__handle_cal_clicked)
00057         
00058         self.cal_service = rospy.ServiceProxy('calibration_service', Empty)
00059         
00060         
00061         context.add_widget(self._widget)
00062 
00063     def shutdown_plugin(self):
00064         
00065         pass
00066 
00067     def save_settings(self, plugin_settings, instance_settings):
00068         
00069         
00070         pass
00071 
00072     def restore_settings(self, plugin_settings, instance_settings):
00073         
00074         
00075         pass
00076         
00077         
00078     def __handle_cal_clicked(self, checked):
00079         self.cal_service()
00080         
00081