battery_visualization.py
Go to the documentation of this file.
00001 #!/usr/bin/env python
00002 
00003 import rospy
00004 
00005 rospy.init_node("pr2_battery_visualization")
00006 
00007 try:
00008     from std_msgs.msg import Float32
00009     from pr2_msgs.msg import BatteryServer
00010 except:
00011     import roslib; roslib.load_manifest("jsk_pr2_startup")
00012     from std_msgs.msg import Float32
00013     from pr2_msgs.msg import BatteryServer
00014 
00015 battery_status = {}
00016 battery_pub0 = rospy.Publisher("/visualization/battery/value0", Float32)
00017 battery_pub1 = rospy.Publisher("/visualization/battery/value1", Float32)
00018 battery_pub2 = rospy.Publisher("/visualization/battery/value2", Float32)
00019 battery_pub3 = rospy.Publisher("/visualization/battery/value3", Float32)
00020 battery_pubs = [battery_pub0,
00021                 battery_pub1,
00022                 battery_pub2,
00023                 battery_pub3]
00024 
00025 def batteryCB(msg):
00026     battery_pubs[msg.id].publish(Float32(msg.averageCharge))
00027 
00028 s = rospy.Subscriber("/battery/server", BatteryServer, batteryCB)
00029 
00030 rospy.spin()
00031 
00032 


jsk_pr2_startup
Author(s):
autogenerated on Wed Sep 16 2015 10:32:17