19 from std_msgs.msg
import Bool
20 from std_msgs.msg
import Float64
21 from cob_srvs.srv
import SetFloat, SetFloatResponse
22 from diagnostic_msgs.msg
import DiagnosticArray, DiagnosticStatus
23 from diagnostic_updater
import Updater
30 self.
pub_voltage = rospy.Publisher(
'~voltage', Float64, queue_size = 1)
31 self.
pub_current = rospy.Publisher(
'~current', Float64, queue_size = 1)
37 self.updater.setHardwareID(
"bms")
51 self.
current = round(req.data,2)
52 res_current = SetFloatResponse(
True,
"Set current to {}".format(self.
current))
57 res_capacity = SetFloatResponse(
True,
"Set relative remaining capacity to {}".format(self.
remaining_capacity))
64 stat.summary(DiagnosticStatus.OK,
"Fake Driver: Ready")
65 stat.add(
"current[A]", self.
current)
66 stat.add(
"voltage[V]", self.
voltage)
73 self.pub_voltage.publish(self.
voltage)
74 self.pub_current.publish(self.
current)
88 if __name__ ==
'__main__':
89 rospy.init_node(
'fake_bms')
def timer_consume_power_cb(self, event)
srv_relative_remaining_capacity
def publish_diagnostics(self, event)
def produce_diagnostics(self, stat)
def relative_remaining_capacity_cb(self, req)
def current_cb(self, req)
def timer_cb(self, event)