Go to the documentation of this file.00001
00002
00003 import rospy
00004
00005 rospy.init_node("pr2_rviz_visualization")
00006
00007
00008 from std_msgs.msg import Float32
00009 from pr2_msgs.msg import BatteryServer
00010
00011 battery_status = {}
00012 battery_pub0 = rospy.Publisher("/visualization/battery/value0", Float32)
00013 battery_pub1 = rospy.Publisher("/visualization/battery/value1", Float32)
00014 battery_pub2 = rospy.Publisher("/visualization/battery/value2", Float32)
00015 battery_pub3 = rospy.Publisher("/visualization/battery/value3", Float32)
00016 battery_pubs = [battery_pub0,
00017 battery_pub1,
00018 battery_pub2,
00019 battery_pub3]
00020
00021 def batteryCB(msg):
00022 battery_pubs[msg.id].publish(Float32(msg.averageCharge))
00023
00024 s = rospy.Subscriber("/battery/server", BatteryServer, batteryCB)
00025
00026 rospy.spin()
00027
00028