4 import rospy, sys, termios, tty
7 from geometry_msgs.msg
import Pose, PoseStamped
8 from visualization_msgs.msg
import Marker, MarkerArray
9 from move_base_msgs.msg
import MoveBaseActionResult
16 """docstring for input_kp""" 24 self.marker.color.r=1.0
25 self.marker.color.g=0.0
26 self.marker.color.b=0.0
27 self.marker.color.a=1.0
28 self.marker.ns=
'input_kp' 30 self.marker.scale.y=0.1
31 self.marker.scale.z=0.1
32 self.marker.header.frame_id=
'map' 33 self.marker.type=Marker.ARROW
34 self.marker.action=Marker.ADD
36 self.
markers_pub = rospy.Publisher(
'/kp',MarkerArray,queue_size=1)
41 tip =
'请在rviz当中使用鼠标点击第 ' + str(self.
num_kp) +
' 个目标点的位置。' 47 kptmp = {
"recog":
False,
"play_words":
"大家好,这是安徽省机器人比赛服务机器人项讲解机器人子项的比赛现场,我是您的机器人讲解员小德.我们本场比赛总共设置了两个讲解点,目前我们所在的位置比赛的是第一个讲解点.",
"name":
"",
"pose": [[pos.pose.position.x,pos.pose.position.y,pos.pose.position.z],[pos.pose.orientation.x,pos.pose.orientation.y,pos.pose.orientation.z,pos.pose.orientation.w]],
"play":
True,
"chat":
False}
53 print 'added '+str(self.
num_kp)+
' keypoints' 54 self.marker.header.stamp =rospy.Time.now()
55 self.marker.pose = pos.pose
56 self.marker.id = self.
num_kp 57 self.arraymarker.markers.append(self.
marker)
59 tip =
'请在rviz当中使用鼠标点击第' + str(self.
num_kp+1) +
' 个目标点的位置。' 63 with open(
'kp.json',
'w')
as f:
64 json.dump(self.
kp,f,ensure_ascii=
False)
66 print '您已完成所有关键点的录入,关键点文件已成功存入运行目录下的keypoint.yaml文件,请使用ctrl+c退出程序即可。' 78 if __name__ ==
'__main__':
79 rospy.init_node(
'input_kp_serve')
81 rospy.loginfo(
'office lady initialized...')
83 except rospy.ROSInterruptException:
84 rospy.loginfo(
'office lady initialize failed, please retry...')