|
From: <wa...@us...> - 2009-07-20 06:50:49
|
Revision: 19187
http://personalrobots.svn.sourceforge.net/personalrobots/?rev=19187&view=rev
Author: wattsk
Date: 2009-07-20 06:50:39 +0000 (Mon, 20 Jul 2009)
Log Message:
-----------
Moved ntp_monitor to pr2_computer_monitor, removed dep on runtime_monitor from pr2_alpha
Modified Paths:
--------------
pkg/trunk/stacks/pr2/pr2_alpha/manifest.xml
pkg/trunk/stacks/pr2/pr2_alpha/pre.launch
pkg/trunk/stacks/pr2/pr2_alpha/pre.people.launch
pkg/trunk/stacks/pr2/pr2_alpha/prf.launch
pkg/trunk/stacks/pr2/pr2_alpha/prf_manip.launch
pkg/trunk/stacks/pr2/pr2_alpha/prg.launch
pkg/trunk/stacks/pr2/pr2_alpha/prg.people.launch
Added Paths:
-----------
pkg/trunk/pr2/pr2_computer_monitor/scripts/ntp_monitor.py
Removed Paths:
-------------
pkg/trunk/stacks/hardware_test/runtime_monitor/scripts/ntp_monitor.py
Added: pkg/trunk/pr2/pr2_computer_monitor/scripts/ntp_monitor.py
===================================================================
--- pkg/trunk/pr2/pr2_computer_monitor/scripts/ntp_monitor.py (rev 0)
+++ pkg/trunk/pr2/pr2_computer_monitor/scripts/ntp_monitor.py 2009-07-20 06:50:39 UTC (rev 19187)
@@ -0,0 +1,98 @@
+#!/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 roslib
+roslib.load_manifest('pr2_computer_monitor')
+
+from diagnostic_msgs.msg import DiagnosticMessage, DiagnosticStatus, DiagnosticValue, DiagnosticString
+import sys
+import rospy
+import socket
+from subprocess import Popen, PIPE
+
+import time
+
+import re
+
+NAME = 'ntp_monitor'
+
+def ntp_monitor(ntp_hostname, offset=500):
+ pub = rospy.Publisher("/diagnostics", DiagnosticMessage)
+ rospy.init_node(NAME, anonymous=True)
+
+ hostname = socket.gethostbyaddr(socket.gethostname())[0]
+
+ while not rospy.is_shutdown():
+ try:
+ p = Popen(["ntpdate", "-q", ntp_hostname], stdout=PIPE, stdin=PIPE, stderr=PIPE)
+ res = p.wait()
+ (o,e) = p.communicate()
+ except OSError, (errno, msg):
+ if errno == 4:
+ break #ctrl-c interrupt
+ else:
+ raise
+ if (res == 0):
+ measured_offset = float(re.search("offset (.*),", o).group(1))*1000000
+ if (abs(measured_offset) < offset):
+ stat = DiagnosticStatus(0,"NTP offset from: "+ hostname + " to: " +ntp_hostname, "Acceptable synchronization", [DiagnosticValue(measured_offset,"offset (us)")],[])
+ print measured_offset
+ else:
+ stat = DiagnosticStatus(2,"NTP offset from: "+ hostname + " to: " +ntp_hostname, "Offset too great", [DiagnosticValue(measured_offset,"offset (us)")],[])
+ else:
+ stat = DiagnosticStatus(2,"NTP offset from: "+ hostname + " to: " +ntp_hostname, "Failure to run ntpdate -q", [],[])
+
+ pub.publish(DiagnosticMessage(None, [stat]))
+ time.sleep(1)
+
+def ntp_monitor_main(argv=sys.argv):
+ import optparse
+ parser = optparse.OptionParser(usage="usage: ntp_monitor ntp-hostname [offset-tolerance]")
+ options, args = parser.parse_args(argv[1:])
+ if len(args) == 1:
+ ntp_hostname, offset = args[0], 500
+ elif len(args) == 2:
+ ntp_hostname, offset = args
+ try:
+ offset = int(offset)
+ except:
+ parser.error("offset must be a number")
+ else:
+ parser.error("Invalid arguments")
+ ntp_monitor(ntp_hostname, offset)
+
+if __name__ == "__main__":
+ try:
+ ntp_monitor_main(rospy.myargv())
+ except KeyboardInterrupt: pass
+
Property changes on: pkg/trunk/pr2/pr2_computer_monitor/scripts/ntp_monitor.py
___________________________________________________________________
Added: svn:executable
+ *
Deleted: pkg/trunk/stacks/hardware_test/runtime_monitor/scripts/ntp_monitor.py
===================================================================
--- pkg/trunk/stacks/hardware_test/runtime_monitor/scripts/ntp_monitor.py 2009-07-20 06:48:59 UTC (rev 19186)
+++ pkg/trunk/stacks/hardware_test/runtime_monitor/scripts/ntp_monitor.py 2009-07-20 06:50:39 UTC (rev 19187)
@@ -1,98 +0,0 @@
-#!/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 roslib
-roslib.load_manifest('runtime_monitor')
-
-from diagnostic_msgs.msg import DiagnosticMessage, DiagnosticStatus, DiagnosticValue, DiagnosticString
-import sys
-import rospy
-import socket
-from subprocess import Popen, PIPE
-
-import time
-
-import re
-
-NAME = 'ntp_monitor'
-
-def ntp_monitor(ntp_hostname, offset=500):
- pub = rospy.Publisher("/diagnostics", DiagnosticMessage)
- rospy.init_node(NAME, anonymous=True)
-
- hostname = socket.gethostbyaddr(socket.gethostname())[0]
-
- while not rospy.is_shutdown():
- try:
- p = Popen(["ntpdate", "-q", ntp_hostname], stdout=PIPE, stdin=PIPE, stderr=PIPE)
- res = p.wait()
- (o,e) = p.communicate()
- except OSError, (errno, msg):
- if errno == 4:
- break #ctrl-c interrupt
- else:
- raise
- if (res == 0):
- measured_offset = float(re.search("offset (.*),", o).group(1))*1000000
- if (abs(measured_offset) < offset):
- stat = DiagnosticStatus(0,"NTP offset from: "+ hostname + " to: " +ntp_hostname, "Acceptable synchronization", [DiagnosticValue(measured_offset,"offset (us)")],[])
- print measured_offset
- else:
- stat = DiagnosticStatus(2,"NTP offset from: "+ hostname + " to: " +ntp_hostname, "Offset too great", [DiagnosticValue(measured_offset,"offset (us)")],[])
- else:
- stat = DiagnosticStatus(2,"NTP offset from: "+ hostname + " to: " +ntp_hostname, "Failure to run ntpdate -q", [],[])
-
- pub.publish(DiagnosticMessage(None, [stat]))
- time.sleep(1)
-
-def ntp_monitor_main(argv=sys.argv):
- import optparse
- parser = optparse.OptionParser(usage="usage: ntp_monitor ntp-hostname [offset-tolerance]")
- options, args = parser.parse_args(argv[1:])
- if len(args) == 1:
- ntp_hostname, offset = args[0], 500
- elif len(args) == 2:
- ntp_hostname, offset = args
- try:
- offset = int(offset)
- except:
- parser.error("offset must be a number")
- else:
- parser.error("Invalid arguments")
- ntp_monitor(ntp_hostname, offset)
-
-if __name__ == "__main__":
- try:
- ntp_monitor_main(rospy.myargv())
- except KeyboardInterrupt: pass
-
Modified: pkg/trunk/stacks/pr2/pr2_alpha/manifest.xml
===================================================================
--- pkg/trunk/stacks/pr2/pr2_alpha/manifest.xml 2009-07-20 06:48:59 UTC (rev 19186)
+++ pkg/trunk/stacks/pr2/pr2_alpha/manifest.xml 2009-07-20 06:50:39 UTC (rev 19187)
@@ -1,5 +1,5 @@
-<package>
+
<description brief="The scripts to run the PR2 Alpha base">
This package contains XML descriptions of robots in the format
@@ -23,7 +23,6 @@
<depend package="imu_node"/>
<depend package="dcam"/>
<depend package="robot_pose_ekf"/>
- <depend package="runtime_monitor"/>
<depend package="sound_play"/>
<depend package="joint_calibration_monitor" />
<depend package="forearm_cam" />
Modified: pkg/trunk/stacks/pr2/pr2_alpha/pre.launch
===================================================================
--- pkg/trunk/stacks/pr2/pr2_alpha/pre.launch 2009-07-20 06:48:59 UTC (rev 19186)
+++ pkg/trunk/stacks/pr2/pr2_alpha/pre.launch 2009-07-20 06:50:39 UTC (rev 19187)
@@ -59,8 +59,8 @@
<node pkg="rosrecord" type="rosrecord" args="-f /hwlog/pre_runtime_automatic /diagnostics" />
<!-- NTP monitoring script Warns to console if sync error
- <node pkg="runtime_monitor" type="ntp_monitor.py" args="pre2" machine="realtime"/>
- <node pkg="runtime_monitor" type="ntp_monitor.py" args="fw1 7000" machine="two"/>
+ <node pkg="pr2_computer_monitor" type="ntp_monitor.py" args="pre2" machine="realtime"/>
+ <node pkg="pr2_computer_monitor" type="ntp_monitor.py" args="fw1 7000" machine="two"/>
-->
<!-- Disk usage monitoring script Warns to console if disk full -->
Modified: pkg/trunk/stacks/pr2/pr2_alpha/pre.people.launch
===================================================================
--- pkg/trunk/stacks/pr2/pr2_alpha/pre.people.launch 2009-07-20 06:48:59 UTC (rev 19186)
+++ pkg/trunk/stacks/pr2/pr2_alpha/pre.people.launch 2009-07-20 06:50:39 UTC (rev 19187)
@@ -59,10 +59,10 @@
<node pkg="rosrecord" type="rosrecord" args="-f /hwlog/pre_runtime_automatic /diagnostics" />
<!-- NTP monitoring script Warns to console if sync error -->
- <node pkg="runtime_monitor" type="ntp_monitor.py" args="pre2" machine="realtime"/>
- <node pkg="runtime_monitor" type="ntp_monitor.py" args="fw1 7000" machine="two"/>
- <node pkg="runtime_monitor" type="ntp_monitor.py" args="pre2" machine="three"/>
- <node pkg="runtime_monitor" type="ntp_monitor.py" args="pre2" machine="four"/>
+ <node pkg="pr2_computer_monitor" type="ntp_monitor.py" args="pre2" machine="realtime"/>
+ <node pkg="pr2_computer_monitor" type="ntp_monitor.py" args="fw1 7000" machine="two"/>
+ <node pkg="pr2_computer_monitor" type="ntp_monitor.py" args="pre2" machine="three"/>
+ <node pkg="pr2_computer_monitor" type="ntp_monitor.py" args="pre2" machine="four"/>
</launch>
Modified: pkg/trunk/stacks/pr2/pr2_alpha/prf.launch
===================================================================
--- pkg/trunk/stacks/pr2/pr2_alpha/prf.launch 2009-07-20 06:48:59 UTC (rev 19186)
+++ pkg/trunk/stacks/pr2/pr2_alpha/prf.launch 2009-07-20 06:50:39 UTC (rev 19187)
@@ -98,10 +98,10 @@
<node pkg="joint_calibration_monitor" type="pr2_calibration_monitor_node.py" machine="two" />
<!-- NTP monitoring script Warns to console if sync error -->
- <node pkg="runtime_monitor" type="ntp_monitor.py" args="prf2" machine="realtime"/>
- <node pkg="runtime_monitor" type="ntp_monitor.py" args="fw1 7000" machine="two"/>
- <node pkg="runtime_monitor" type="ntp_monitor.py" args="prf2" machine="three"/>
- <node pkg="runtime_monitor" type="ntp_monitor.py" args="prf2" machine="four"/>
+ <node pkg="pr2_computer_monitor" type="ntp_monitor.py" args="prf2" machine="realtime"/>
+ <node pkg="pr2_computer_monitor" type="ntp_monitor.py" args="fw1 7000" machine="two"/>
+ <node pkg="pr2_computer_monitor" type="ntp_monitor.py" args="prf2" machine="three"/>
+ <node pkg="pr2_computer_monitor" type="ntp_monitor.py" args="prf2" machine="four"/>
<!-- Disk, CPU monitoring scripts. -->
<include file="$(find pr2_alpha)/pr2_monitors.launch" />
Modified: pkg/trunk/stacks/pr2/pr2_alpha/prf_manip.launch
===================================================================
--- pkg/trunk/stacks/pr2/pr2_alpha/prf_manip.launch 2009-07-20 06:48:59 UTC (rev 19186)
+++ pkg/trunk/stacks/pr2/pr2_alpha/prf_manip.launch 2009-07-20 06:50:39 UTC (rev 19187)
@@ -78,9 +78,9 @@
<node pkg="rosrecord" type="rosrecord" args="-f /hwlog/prf_runtime_automatic /diagnostics" />
<!-- NTP monitoring script Warns to console if sync error -->
- <node pkg="runtime_monitor" type="ntp_monitor.py" args="prf2" machine="realtime"/>
- <node pkg="runtime_monitor" type="ntp_monitor.py" args="prf2" machine="three"/>
- <node pkg="runtime_monitor" type="ntp_monitor.py" args="prf2" machine="four"/>
+ <node pkg="pr2_computer_monitor" type="ntp_monitor.py" args="prf2" machine="realtime"/>
+ <node pkg="pr2_computer_monitor" type="ntp_monitor.py" args="prf2" machine="three"/>
+ <node pkg="pr2_computer_monitor" type="ntp_monitor.py" args="prf2" machine="four"/>
</launch>
Modified: pkg/trunk/stacks/pr2/pr2_alpha/prg.launch
===================================================================
--- pkg/trunk/stacks/pr2/pr2_alpha/prg.launch 2009-07-20 06:48:59 UTC (rev 19186)
+++ pkg/trunk/stacks/pr2/pr2_alpha/prg.launch 2009-07-20 06:50:39 UTC (rev 19187)
@@ -96,10 +96,10 @@
<node pkg="joint_calibration_monitor" type="pr2_calibration_monitor_node.py" machine="two" />
-->
<!-- NTP monitoring script Warns to console if sync error -->
- <node pkg="runtime_monitor" type="ntp_monitor.py" args="prg2" machine="realtime"/>
- <node pkg="runtime_monitor" type="ntp_monitor.py" args="fw1 7000" machine="two"/>
- <node pkg="runtime_monitor" type="ntp_monitor.py" args="prg2" machine="three"/>
- <node pkg="runtime_monitor" type="ntp_monitor.py" args="prg2" machine="four"/>
+ <node pkg="pr2_computer_monitor" type="ntp_monitor.py" args="prg2" machine="realtime"/>
+ <node pkg="pr2_computer_monitor" type="ntp_monitor.py" args="fw1 7000" machine="two"/>
+ <node pkg="pr2_computer_monitor" type="ntp_monitor.py" args="prg2" machine="three"/>
+ <node pkg="pr2_computer_monitor" type="ntp_monitor.py" args="prg2" machine="four"/>
<!-- Disk, CPU monitoring scripts. -->
<include file="$(find pr2_alpha)/pr2_monitors.launch" />
Modified: pkg/trunk/stacks/pr2/pr2_alpha/prg.people.launch
===================================================================
--- pkg/trunk/stacks/pr2/pr2_alpha/prg.people.launch 2009-07-20 06:48:59 UTC (rev 19186)
+++ pkg/trunk/stacks/pr2/pr2_alpha/prg.people.launch 2009-07-20 06:50:39 UTC (rev 19187)
@@ -58,10 +58,10 @@
<node pkg="rosrecord" type="rosrecord" args="-f /hwlog/prg_runtime_automatic /diagnostics" />
<!-- NTP monitoring script Warns to console if sync error -->
- <node pkg="runtime_monitor" type="ntp_monitor.py" args="prg2" machine="realtime"/>
- <node pkg="runtime_monitor" type="ntp_monitor.py" args="fw1 7000" machine="two"/>
- <node pkg="runtime_monitor" type="ntp_monitor.py" args="prg2" machine="three"/>
- <node pkg="runtime_monitor" type="ntp_monitor.py" args="prg2" machine="four"/>
+ <node pkg="pr2_computer_monitor" type="ntp_monitor.py" args="prg2" machine="realtime"/>
+ <node pkg="pr2_computer_monitor" type="ntp_monitor.py" args="fw1 7000" machine="two"/>
+ <node pkg="pr2_computer_monitor" type="ntp_monitor.py" args="prg2" machine="three"/>
+ <node pkg="pr2_computer_monitor" type="ntp_monitor.py" args="prg2" machine="four"/>
</launch>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|