|
From: <tf...@us...> - 2008-12-25 13:24:27
|
Revision: 8596
http://personalrobots.svn.sourceforge.net/personalrobots/?rev=8596&view=rev
Author: tfoote
Date: 2008-12-25 13:24:23 +0000 (Thu, 25 Dec 2008)
Log Message:
-----------
work from the plane, most of the way to broken wire detection
Modified Paths:
--------------
pkg/trunk/hardware_test/runtime_monitor/scripts/runtime_test
Added Paths:
-----------
pkg/trunk/drivers/robot/pr2/pr2_power_board/pr_wiring.yaml
pkg/trunk/drivers/robot/pr2/pr2_power_board/src/pr2_power_board/__init__.py
pkg/trunk/drivers/robot/pr2/pr2_power_board/src/pr2_power_board/power_wires.py
pkg/trunk/drivers/robot/pr2/pr2_power_board/test_wires.launch
Added: pkg/trunk/drivers/robot/pr2/pr2_power_board/pr_wiring.yaml
===================================================================
--- pkg/trunk/drivers/robot/pr2/pr2_power_board/pr_wiring.yaml (rev 0)
+++ pkg/trunk/drivers/robot/pr2/pr2_power_board/pr_wiring.yaml 2008-12-25 13:24:23 UTC (rev 8596)
@@ -0,0 +1,16 @@
+wiring_tree: {
+#circuit1: { component: 'pr2_power_board', value: 'breaker_voltage1', tolerance: 10,
+# children: [fr_caster, fl_caster, br_caster, bl_caster]},
+ circuit0: {component: "pr2_power_board", value: "breaker_voltage0", tolerance: 10,
+ children: [l_shoulder_pan]},
+ circuit2: { component: "pr2_power_board", value: "breaker_voltage2", tolerance: 10 ,
+ children: [r_shoulder_pan]},
+ r_shoulder_pan: { component: "ethercat device r_shoulder_pan", value: "voltage", tolerance: 10,
+ children: [r_shoulder_tilt]},
+ l_shoulder_pan: { component: "ethercat device l_shoulder_pan", value: "voltage", tolerance: 10,
+ children: [l_shoulder_tilt]}
+}
+
+root: [ circuit0, circuit2]
+
+
Added: pkg/trunk/drivers/robot/pr2/pr2_power_board/src/pr2_power_board/power_wires.py
===================================================================
--- pkg/trunk/drivers/robot/pr2/pr2_power_board/src/pr2_power_board/power_wires.py (rev 0)
+++ pkg/trunk/drivers/robot/pr2/pr2_power_board/src/pr2_power_board/power_wires.py 2008-12-25 13:24:23 UTC (rev 8596)
@@ -0,0 +1,85 @@
+#!/usr/bin/env python
+# Software License Agreement (BSD License)
+#
+# Copyright (c) 2008, Willow Garage, Inc.
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above
+# copyright notice, this list of conditions and the following
+# disclaimer in the documentation and/or other materials provided
+# with the distribution.
+# * Neither the name of the Willow Garage nor the names of its
+# contributors may be used to endorse or promote products derived
+# from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+
+#import rostools
+#rostools.update_path(PKG)
+
+import sys
+import rospy
+from robot_msgs.msg import *
+
+
+def recurse_tree(element, messages, wiremap):
+ errors = []
+ if element in wiremap:
+ if "children" in wiremap[element]:
+ for child in wiremap[element]["children"]:
+ children_return, errors_return = recurse_tree(child, messages, wiremap)
+ children.extend(children_return)
+ errors.extend(errors_return)
+
+ try:
+ value = messages[ wiremap[element][component]][wiremap[element][value]]
+ child_value = messages[ wiremap[child][component]][wiremap[child][value]]
+ tolerance = wiremap[element][tolerance]
+ if abs(value - child_value) / value > tolerance/100:
+ errors.append("difference between %f (%s) and %f (%s) voltages exceeds tolerance %f\%"
+ %(value, element, child_value, child, tolerance))
+ except KeyError:
+ errors.append("badly formed parameters");
+ return errors
+
+
+def test(latest_status, parameters):
+ #print latest_status
+ results = {}
+
+ if "wiring_tree" in parameters:
+ wiremap = parameters["wiring_tree"]
+ else:
+ results['error'] = ["power_wires: no wiring_tree found"]
+ return results
+
+ if "root" in parameters:
+ for root in parameters["root"]:
+ results.extend( recurse_tree(root, latest_status, parameters))
+
+ else:
+ results['error'] = ["power_wires: no root found"]
+ return results
+
+
+ return results
+
+
Added: pkg/trunk/drivers/robot/pr2/pr2_power_board/test_wires.launch
===================================================================
--- pkg/trunk/drivers/robot/pr2/pr2_power_board/test_wires.launch (rev 0)
+++ pkg/trunk/drivers/robot/pr2/pr2_power_board/test_wires.launch 2008-12-25 13:24:23 UTC (rev 8596)
@@ -0,0 +1,5 @@
+<launch>
+ <node pkg="runtime_monitor" type="runtime_test" args="--test=power_wires --package=pr2_power_board" output="screen" name="wiring_voltage_test">
+ <rosparam command="load" file="pr_wiring.yaml"/>
+ </node>
+</launch>
\ No newline at end of file
Modified: pkg/trunk/hardware_test/runtime_monitor/scripts/runtime_test
===================================================================
--- pkg/trunk/hardware_test/runtime_monitor/scripts/runtime_test 2008-12-25 02:34:19 UTC (rev 8595)
+++ pkg/trunk/hardware_test/runtime_monitor/scripts/runtime_test 2008-12-25 13:24:23 UTC (rev 8596)
@@ -63,11 +63,12 @@
def analyze(package, test_name):
# import the test script
+ exec("rostools.update_path('%s')"%package)
exec('from %s import %s'%(package, test_name))
# get it's parameters
exec("params = rospy.get_param(\"~\")")
-
+
# run the test
exec("results = %s.test(latest_messages, params)"%test_name)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|