10 Containing both proxy and gui instances, this class gives a control of
11 a node on both ROS & GUI sides.
16 @type proxy: rqt_launch.NodeProxy
22 self.
_gui.set_node_controller(self)
26 Works as a slot particularly intended to work for
27 QAbstractButton::toggled(checked). Internally calls
28 NodeController.start / stop depending on `signal`.
32 if self.
_proxy.is_running():
34 rospy.logdebug(
'---start_stop_slot stOP')
37 rospy.logdebug(
'==start_stop_slot StART')
41 Start a ROS node as a new _process.
43 rospy.logdebug(
'Controller.start restart={}'.format(restart))
48 if self.
_proxy.is_running():
58 if (self.
_proxy.config.launch_prefix != self.
_gui._lineEdit_launch_args.text()):
59 self.
_proxy.config.launch_prefix = self.
_gui._lineEdit_launch_args.text()
60 self.
_proxy.recreate_process()
62 self.
_gui.set_node_started(
False)
63 self.
_gui.label_status.set_starting()
64 self.
_proxy.start_process()
65 self.
_gui.label_status.set_running()
70 Stop a ROS node's _process.
76 self.
_gui.set_node_started(
True)
77 self.
_gui.label_status.set_stopping()
79 self.
_gui.label_status.set_stopped()
83 rospy.logerr(
"Process died: {}".format(self.
_proxy.get_proc_name()))
85 self.
_gui.set_node_started(
True)
86 if self.
_proxy._process.exit_code == 0:
87 self.
_gui.label_status.set_stopped()
89 self.
_gui.label_status.set_died()
92 if self.
_gui.respawn_toggle.isChecked():
93 rospy.loginfo(
"Respawning _process: {}".format(self.
_proxy._process.name))
94 self.
_gui.label_status.set_starting()
95 self.
_proxy.start_process()
96 self.
_gui.label_status.set_running()
106 return self.
_proxy.is_running()
109 return "({})".format(self.
_proxy.get_spawn_count())