pr2_visualization.py
Go to the documentation of this file.
1 #!/usr/bin/env python
2 
3 import rospy
4 
5 rospy.init_node("pr2_rviz_visualization")
6 
7 
8 from std_msgs.msg import Float32
9 from pr2_msgs.msg import BatteryServer
10 
11 battery_status = {}
12 battery_pub0 = rospy.Publisher("/visualization/battery/value0", Float32)
13 battery_pub1 = rospy.Publisher("/visualization/battery/value1", Float32)
14 battery_pub2 = rospy.Publisher("/visualization/battery/value2", Float32)
15 battery_pub3 = rospy.Publisher("/visualization/battery/value3", Float32)
16 battery_pubs = [battery_pub0,
17  battery_pub1,
18  battery_pub2,
19  battery_pub3]
20 
21 def batteryCB(msg):
22  battery_pubs[msg.id].publish(Float32(msg.averageCharge))
23 
24 s = rospy.Subscriber("/battery/server", BatteryServer, batteryCB)
25 
26 rospy.spin()
27 
28 


jsk_rviz_plugins
Author(s): Kei Okada , Yohei Kakiuchi , Shohei Fujii , Ryohei Ueda
autogenerated on Sat Mar 20 2021 03:03:18