4 import rospy, yaml, os, json,time
6 from xbot_face.msg
import FaceResult
7 from xbot_talker.srv
import chat, play
8 from std_msgs.msg
import String, UInt32, UInt8, Bool
9 from geometry_msgs.msg
import Pose, PoseStamped
10 from actionlib_msgs.msg
import GoalStatusArray
11 from move_base_msgs.msg
import MoveBaseActionResult
12 from std_srvs.srv
import Empty
15 """docstring for welcome""" 31 self.
chat_srv = rospy.ServiceProxy(
'/xbot/chat',chat)
33 self.
play_srv = rospy.ServiceProxy(
'/xbot/play',play)
48 self.
kp_path = rospy.get_param(
'/demo/kp_path',
'/home/roc/ros_kinetic_ws/xbot-u/src/xbot_navi/param/kp.json')
49 self.
greet_path = rospy.get_param(
'/demo/greet_path',
'/home/roc/ros_kinetic_ws/xbot-u/src/xbot_navi/param/greet.json')
51 with open(self.
kp_path,
'r') as json_file: 62 self.
play_srv(
False,2,
'',
'您好,我还不认识您,如有需要请注册。')
74 if not msg.face_exist:
78 if msg.confidence >0.55:
104 goal.header.frame_id =
'map' 105 goal.pose.position.x = pos[0][0]
106 goal.pose.position.y = pos[0][1]
107 goal.pose.position.z = pos[0][2]
108 goal.pose.orientation.x = pos[1][0]
109 goal.pose.orientation.y = pos[1][1]
110 goal.pose.orientation.z = pos[1][2]
111 goal.pose.orientation.w = pos[1][3]
113 self.move_base_goal_pub.publish(goal)
117 end_talk = self.
play_srv(
False, 2,
'',
'好的,您请跟我来!')
124 if result.status.status == 3:
128 resp = self.
play_srv(
False, 2,
'', kp[
'play_words'])
137 elif result.status.status == 4:
145 if __name__ ==
'__main__':
146 rospy.init_node(
'demo_node')
148 rospy.loginfo(
'demo node initialized...')
150 except rospy.ROSInterruptException:
151 rospy.loginfo(
'demo node initialize failed, please retry...')
def move_base_resultCB(self, result)