Skip to content

Commit e4507b2

Browse files
committed
added simple designator query after client test
1 parent 417c737 commit e4507b2

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

scripts/knowrob_designator_client.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
DesignatorExecutionStartAction, DesignatorExecutionStartGoal,
1515
DesignatorExecutionFinishedAction, DesignatorExecutionFinishedGoal
1616
)
17+
from knowrob_ros.knowrob_ros_lib import KnowRobRosLib
18+
from knowrob_ros.knowrob_ros_lib import get_default_modalframe
1719

1820
def send_action(client, goal, label):
1921
rospy.loginfo(f"[{label}] Waiting for action server...")
@@ -24,6 +26,15 @@ def send_action(client, goal, label):
2426
result = client.get_result()
2527
rospy.loginfo(f"[{label}] Result: success={result.success}, message='{result.message}''")
2628

29+
def testQueryDesig():
30+
know = KnowRobRosLib()
31+
know.init_clients() # After rospy.init_node()
32+
33+
query = "triple(?d, rdf:type, soma:PyCramDesignator)"
34+
rospy.loginfo(f"asking [{query}] ...")
35+
result = know.ask_one(query, get_default_modalframe())
36+
rospy.loginfo(f"response: [{result}]")
37+
2738
def main():
2839
rospy.init_node('knowrob_designator_full_test_client')
2940

@@ -142,6 +153,9 @@ def main():
142153
exec_finished_goal.json_designator = resolved_designator
143154
exec_finished_goal.stamp = now
144155
send_action(exec_finished_client, exec_finished_goal, "ExecutionFinished")
156+
157+
# Finally do some testing queries with KnowRob
158+
testQueryDesig()
145159

146160
if __name__ == '__main__':
147161
main()

0 commit comments

Comments
 (0)