6 import rsv_balance_msgs.srv
9 from python_qt_binding
import loadUi
10 from python_qt_binding.QtGui
import QWidget
15 super(BalanceModeWidget, self).
__init__(context)
17 self.setObjectName(
'BalanceMode')
20 from argparse
import ArgumentParser
21 parser = ArgumentParser()
23 parser.add_argument(
"-q",
"--quiet", action=
"store_true",
25 help=
"Put plugin in silent mode")
26 args, unknowns = parser.parse_known_args(context.argv())
28 print 'arguments: ', args
29 print 'unknowns: ', unknowns
34 ui_file = os.path.join(rospkg.RosPack().get_path(
'rsv_balance_rqt'),
'resource',
'BalanceModeWidget.ui')
38 self._widget.setObjectName(
'BalanceModeWidgetUI')
40 if context.serial_number() > 1:
41 self._widget.setWindowTitle(self._widget.windowTitle() + (
' (%d)' % context.serial_number()))
43 context.add_widget(self.
_widget)
59 instance_settings.set_value(
'topic', self._widget.topic_line_edit.text())
62 value = instance_settings.value(
'topic',
"/set_mode")
63 self._widget.topic_line_edit.setText(value)
67 self.
set_mode_srv(rsv_balance_msgs.srv.SetModeRequest.PARK)
68 except rospy.ServiceException, e:
69 rospy.logwarn(
"Service call failed: %s" % e)
73 self.
set_mode_srv(rsv_balance_msgs.srv.SetModeRequest.TRACTOR)
74 except rospy.ServiceException, e:
75 rospy.logwarn(
"Service call failed: %s" % e)
79 self.
set_mode_srv(rsv_balance_msgs.srv.SetModeRequest.BALANCE)
80 except rospy.ServiceException, e:
81 rospy.logwarn(
"Service call failed: %s" % e)
88 topic = self._widget.topic_line_edit.text()
91 self.set_mode_srv.close()
103 self.
set_mode_srv = rospy.ServiceProxy(topic, rsv_balance_msgs.srv.SetMode)