From 33bb83af920cac8b7041aff4f752103cf0da9115 Mon Sep 17 00:00:00 2001
From: Tommy Persson <tommy.persson@liu.se>
Date: Sat, 23 May 2015 12:37:13 +0200
Subject: [PATCH] lqwtf.py added

---
 src/lqwtf.py           | 31 +++++++++++++++++++++++++++++++
 src/pyutil/__init__.py |  2 +-
 src/pyutil/wtf.py      | 32 ++++++++++++++++++++++++++++++++
 3 files changed, 64 insertions(+), 1 deletion(-)
 create mode 100755 src/lqwtf.py
 create mode 100644 src/pyutil/wtf.py

diff --git a/src/lqwtf.py b/src/lqwtf.py
new file mode 100755
index 0000000..136f1c0
--- /dev/null
+++ b/src/lqwtf.py
@@ -0,0 +1,31 @@
+#!/usr/bin/env python
+
+from pyutil.wtf import *
+
+
+def check_lidar(ns):
+    nodes = ["scantocloud"]
+    check_nodes("LIDAR", ns, nodes)
+
+def check_basic_lq(ns):
+    nodes = ["dwdb", "quadconn", "quadexec", "scanserver", "uav_laser_frame_publisher", 
+             "quadexec"]
+    check_nodes("BASIC LQ", ns, nodes)
+
+def check(ns):
+    check_basic_lq(ns)
+    check_lidar(ns)
+    check_tst(ns)
+    check_delegation(ns)
+    check_task_planning(ns)
+    check_motion_planning(ns)
+
+if __name__ == '__main__':
+
+    ns = rospy.get_namespace ()
+
+    check(ns)
+
+#    ping("/ground/cserver")
+
+#    rosnode.rosnode_ping_all(True)
diff --git a/src/pyutil/__init__.py b/src/pyutil/__init__.py
index 13852e6..7ffa3c0 100644
--- a/src/pyutil/__init__.py
+++ b/src/pyutil/__init__.py
@@ -1 +1 @@
-__all__ = ["tfutil", "fipa", "consutil", "rautil", "wdbutil", "geoconv", "imutil"]
+__all__ = ["tfutil", "fipa", "consutil", "rautil", "wdbutil", "geoconv", "imutil", "wtf"]
diff --git a/src/pyutil/wtf.py b/src/pyutil/wtf.py
new file mode 100644
index 0000000..f8bfc4d
--- /dev/null
+++ b/src/pyutil/wtf.py
@@ -0,0 +1,32 @@
+import rospy
+import rosnode
+
+def ping(functionality, name):
+    res = rosnode.rosnode_ping(name, max_count=1, verbose=False)
+    if res:
+        print functionality, " - ", name, ": OK"
+    else:
+        print functionality, " - ", name, ": Could not ping"
+
+def check_nodes(functionality, ns, nodes):
+    for nd in nodes:
+        ping(functionality, ns+nd)
+
+def check_delegation(ns):
+    nodes = ["interface", "bidder", "cserver", "delegationagent", "queryserver", 
+             "qparamserver", "resourceagent", "unitprioritizer"]
+    check_nodes("DELEGATION", ns, nodes)
+
+def check_tst(ns):
+    nodes = ["tstfactory", "tstuiserver"]
+    check_nodes("TST", ns, nodes)
+
+def check_task_planning(ns):
+    nodes = ["tfpop", "plantotst"]
+    check_nodes("TASK PLANNING", ns, nodes)
+
+def check_motion_planning(ns):
+    nodes = ["mpinfo", "mplanner"]
+    check_nodes("MOTION PLANNING", ns, nodes)
+
+
-- 
GitLab