45 print(
"Looking at ", element)
46 if element
in wiremap:
47 if "children" in wiremap[element]:
48 for child
in wiremap[element][
"children"]:
50 errors.extend(errors_return)
53 value = float(messages[ wiremap[element][
'component']][wiremap[element][
'value']])
54 child_value = float(messages[ wiremap[child][
'component']][wiremap[child][
'value']])
55 tolerance = wiremap[element][
'tolerance']
56 if abs(value - child_value) / value > tolerance/100.0:
57 errors.append(
"difference between %f (%s) and %f (%s) voltages exceeds tolerance %f percent"%(value, element, child_value, child, tolerance))
59 rospy.logdebug(
"%s passed"%child)
61 errors.append(
"badly formed parameters for element %s: %s"%(element, e));
63 print(
"No children of element: ", element)
65 errors.append(
"no element %s"% element)
70 def test(latest_status, parameters):
74 if "wiring_tree" in parameters:
75 wiremap = parameters[
"wiring_tree"]
77 results[
'error'] = [
"power_wires: no wiring_tree found"]
80 if 'root' in parameters:
82 for root
in parameters[
"root"]:
83 results[
'error'].extend(
recurse_tree(root, latest_status, wiremap))
85 if results[
'error'] == []:
88 results[
'error'] = [
"power_wires: no root found"]