open_house_demo_old_ver.py 文件源码

python
阅读 21 收藏 0 点赞 0 评论 0

项目:maki_demo 作者: jgreczek 项目源码 文件源码
def callback(data):
    global current_msg
    global key
    global last_message
    global buff_msg

    #determine game type according to the data head tag!!!!!!!!!

    #rospy.loginfo(rospy.get_caller_id() + "I heard %s", data.data)
    #print type(data), type(data.data), len(data.data)
    raw_msg = data.data
    if not raw_msg == buff_msg:
        current_msg = dataProcessing(raw_msg)
        if current_msg == last_msg and (not current_msg == None):    
        key = False
            print key
        else:
            key = True

    #TODO change to a mouth color publisher according to the current_msg
        pub = rospy.Publisher('mouth_color', Int8, queue_size=10)
        #target_color = current_msg[len(current_msg)-1] #this is formal solution
        #temp solution
        target_color = 1
        if task[0] == "complete_astronaut":
            target_color = 1
        elif task[0] == "complete_clown":
        target_color = 2
        elif task[0] == "complete_wizard":
        target_color = 3
        pub.publish(target_color)

    buff_msg = raw_msg
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号