37 from urlparse
import urlparse
39 from urllib.parse
import urlparse
42 from hrpsys
import rtm
43 from hrpsys_ros_bridge.hrpsys_dashboard
import HrpsysDashboard
44 from python_qt_binding
import loadUi
45 from python_qt_binding.QtCore
import Qt, Signal
48 from python_qt_binding.QtGui
import (QHeaderView, QItemSelectionModel,
51 from python_qt_binding.QtWidgets
import (QHeaderView, QWidget)
52 from python_qt_binding.QtCore
import QItemSelectionModel
54 from rosgraph
import Master
55 from rospkg
import RosPack
57 from rospy.exceptions
import ROSException
61 PKG_NAME =
'hironx_ros_bridge' 68 - joint_state_publisher is dropped, since hrpsys_ros_bridge seems to set 69 `robot_description` param using COLLADA (see https://goo.gl/aLpILa) 70 instead of URDF, which joint_state_publisher is not capable of. 75 A GUi panel to list common operation commands for Hironx / NEXTAGE Open robot. 77 @param guicontext: The plugin context to create the monitor in. 78 @type guicontext: qt_gui.plugin_context.PluginContext 80 super(HironxoCommandPanel, self).
__init__()
85 rtm.nshost = rospy.get_param(
'rtmnameserver_host',
'localhost')
86 rtm.nsport = rospy.get_param(
'rtmnameserver_port',
'15005')
87 robotname = rospy.get_param(
'rtmnameserver_robotname',
'HiroNX(Robot)0')
88 rospy.loginfo(
'Connecting to RTM nameserver. host={}, port={}, robotname={} using rtmnameserver_{{host,port,robotname}} ROS param'.format(rtm.nshost, rtm.nsport, robotname))
91 self.
_rtm.init(robotname=robotname, url=
'')
94 ui_file = os.path.join(rospack.get_path(PKG_NAME),
'resource',
95 'hironx_commandpanel_main.ui')
96 loadUi(ui_file, self, {
'HironxoCommandPanel': HironxoCommandPanel})
101 self.pushButton_checkEncoders.clicked[bool].connect(self.
_check_encoders)
102 self.pushButton_goInitial.clicked[bool].connect(self.
_go_initial)
104 self.pushButton_goOffPose.clicked[bool].connect(self.
_go_offPose)
105 self.pushButton_startImpedance.clicked[bool].connect(self.
_impedance_on)
106 self.pushButton_stopImpedance.clicked[bool].connect(self.
_impedance_off)
107 self.pushButton_actualPose_l.clicked[bool].connect(self.
_actual_pose_l)
108 self.pushButton_actualPose_r.clicked[bool].connect(self.
_actual_pose_r)
110 self.pushButton_groups.clicked[bool].connect(self.
_show_groups)
114 Workaround for rosgraph.Master.getUri() that does NOT return 115 a domain name with ".local". 117 master = Master(
'/hironxo_command_widget')
120 masteruri_http = os.environ[
'ROS_MASTER_URI']
121 urlparsed = urlparse(masteruri_http)
125 self.textBrowser_output.append(
'***Command used***\n\t' + command_str)
131 return float(self.doubleSpinBox_duration.text())
139 @return: Returns a name of arm group that is checked on GUI. None by default. 142 if self.radioButton_impedance_left.isChecked():
144 elif self.radioButton_impedance_right.isChecked():
150 self.
_rtm.checkEncoders()
158 self.
_rtm.goInitial(init_pose_type=self.
_rtm.INITPOS_TYPE_FACTORY,
167 Start/stop impedance control for the specified arm group. 168 Arm group to operate impedance control is automatically obtained from 169 GUI internally within this method. 170 @raise AttributeError: When no arm group is specified. 172 @param do_on: On/off of impedance control 176 raise AttributeError(
'No arm is specified for impedance control to start.')
179 self.
_rtm.startImpedance(armgroup)
182 self.
_rtm.stopImpedance(armgroup)
192 @type list_pose: [str] 193 @param list_pose: list of str that represent angles (in radian) 196 section_line_piece =
'-' 198 self.textBrowser_output.append(text_single_line * 4)
200 text_single_line =
'' 206 text_single_line += val
207 print(
'DEBUG) #{}: text_single_line: {}'.format(i, text_single_line))
211 if (i != 0
and i % 4 == 3)
or i+1 == len(list_pose):
212 self.textBrowser_output.append(text_single_line)
213 text_single_line =
'' 215 text_single_line +=
'\t' 219 target_joint =
'LARM_JOINT5' 224 target_joint =
'LARM_JOINT5' 229 groups = self.
_rtm.Groups
233 str_elems =
''.join(str(
'\t' + e +
'\n')
for e
in g[1])
237 self.textBrowser_output.append(text)
def getCurrentPose(self, lname=None, frame_name=None)
Returns the current physical pose of the specified joint.