4 from std_msgs.msg
import String, Bool
5 from nav_msgs.msg
import Odometry
6 from rr_openrover_driver_msgs.msg
import RawRrOpenroverDriverSlowRateData, RawRrOpenroverDriverMedRateData, SmartBatteryStatus
12 self.
pub = rospy.Publisher(
'/inorbit/custom_data/0', String, queue_size=5)
13 rospy.Subscriber(
"/raw_slow_rate_data", RawRrOpenroverDriverSlowRateData, self.
slow_data_cb)
14 rospy.Subscriber(
"/rr_openrover_driver/raw_med_rate_data", RawRrOpenroverDriverMedRateData, self.
med_data_cb)
15 rospy.Subscriber(
"/rr_openrover_driver/battery_status_a", SmartBatteryStatus, self.
battery_status_a_cb)
16 rospy.Subscriber(
"/rr_openrover_driver/battery_status_b", SmartBatteryStatus, self.
battery_status_b_cb)
20 warn_msg =
"Battery Levels [" + str(data.reg_robot_rel_soc_a) +
", " + str(
21 data.reg_robot_rel_soc_b) +
"] Motor temps [" + str(data.reg_motor_temp_left) +
", " + str(
22 data.reg_motor_temp_right) +
"]" 25 self.pub.publish(
"Battery Cell 1 SOC=" + str(data.reg_robot_rel_soc_a))
26 self.pub.publish(
"Battery Cell 2 SOC=" + str(data.reg_robot_rel_soc_b))
27 self.pub.publish(
"Left Motor Temp=" + str(data.reg_motor_temp_left))
28 self.pub.publish(
"Right Motor Temp=" + str(data.reg_motor_temp_right))
29 self.pub.publish(
"Battery Mode A=" + str(data.battery_mode_a))
30 self.pub.publish(
"Battery Mode B=" + str(data.battery_mode_b))
31 self.pub.publish(
"Battery Temp A=" + str((data.battery_temp_a/10)-273))
32 self.pub.publish(
"Battery Temp B=" + str((data.battery_temp_b/10)-273))
33 self.pub.publish(
"Power Bat Voltage A=" + str(data.reg_power_bat_voltage_a/58.33))
34 self.pub.publish(
"Power Bat Voltage B=" + str(data.reg_power_bat_voltage_b/58.33))
35 self.pub.publish(
"Battery Voltage A=" + str(data.battery_voltage_a/1000))
36 self.pub.publish(
"Battery Voltage B=" + str(data.battery_voltage_b/1000))
39 self.pub.publish(
"Motor Feedback Current Left=" + str(data.reg_motor_fb_current_left))
40 self.pub.publish(
"Motor Feedback Current Right=" + str(data.reg_motor_fb_current_right))
41 self.pub.publish(
"Power A Current=" + str(data.reg_power_a_current))
42 self.pub.publish(
"Power B Current=" + str(data.reg_power_b_current))
43 self.pub.publish(
"Battery Current A=" + str(data.battery_current_a))
44 self.pub.publish(
"Battery Current B=" + str(data.battery_current_b))
47 for k
in type(msg).__slots__:
49 self.pub.publish(
"Battery Status A." + k +
'=' + str(int(getattr(msg, k))))
52 for k
in type(msg).__slots__:
54 self.pub.publish(
"Battery Status B." + k +
'=' + str(int(getattr(msg, k))))
58 self.pub.publish(
"Open Rover Charging=" + str(msg.data))
61 if __name__ ==
'__main__':
62 rospy.loginfo(
"Starting node")
63 rospy.init_node(
'openrover_diagnostics_node')
def battery_status_b_cb(self, msg)
def slow_data_cb(self, data)
def battery_status_a_cb(self, msg)
def med_data_cb(self, data)
def openrover_charging_cb(self, msg)