其他分享
首页 > 其他分享> > ros 充电topic

ros 充电topic

作者:互联网

 

#!/usr/bin/env python
#coding=utf-8

import rospy
from std_msgs.msg import String
i=0
def talker():
    global i
    pub = rospy.Publisher('bp_nav_goal',String, queue_size=10)
    rospy.init_node('talker',anonymous=True)
    #rate = rospy.Rate(10) # 10hz
    #rospy.signal_shutdown("closed!")
    while not rospy.is_shutdown():
        rospy.loginfo("pub")
        pub.publish(String(data="charging_port"))
        i=i+1
        #rate.sleep()
 
if __name__ == '__main__':
    try:
        talker()
    except rospy.ROSInterruptException:
        pass

 

标签:__,String,pub,topic,rate,rospy,talker,充电,ros
来源: https://www.cnblogs.com/sea-stream/p/10518229.html