RobotLabLTH / skiros2

A skill-based platform for ROS v.2
Other
163 stars 20 forks source link

Service call failed due error world model query #81

Closed shola-lawal closed 11 months ago

shola-lawal commented 11 months ago

I am getting a strange error. I think it's caused by the /wm/ontology/query service not being able to set an attribute due to a "Parse error with following query: SELECT ?x WHERE { ?x rdfs:subPropertyOf* skiros:spatiallyRelated . } . "

Below is the output and error.

$roslaunch skiros2 skiros.launch

PARAMETERS

NODES / map2world (tf/static_transform_publisher) skiros_gui (rqt_gui/rqt_gui) test_robot (skiros2_skill/skill_manager_node) tm (skiros2_task/task_manager_node) wm (skiros2_world_model/world_model_server_node)

[WorldModelServer] Workspace folder: /home/me/catkin_ws/src/skiros2/skiros2/owl [load_reasoner] Loaded AauSpatialReasoner [WorldModelInterface] Wm communications active. [WorldModelInterface] Waiting wm communications... [WorldModelInterface] Wm communications active. AauSpatialReasoner warn: Adding relation to cora:Robot-1-skiros:test_robot [AauSpatialReasoner] Publishing cora:Robot-1-skiros:test_robot parent: map AauSpatialReasoner warn: Adding relation to skiros:Location-5-skiros:unknown_location [SkillManager] Registered robot cora:Robot-1-skiros:test_robot [wm_update] Wm not in sync, querying wm scene [WoQuery] error: Parse error with following query: SELECT ?x WHERE { ?x rdfs:subPropertyOf* skiros:spatiallyRelated . } . [ERROR] [1700793233.610550]: Error processing request: can't set attribute

['Traceback (most recent call last):\n', ' File "/opt/ros/noetic/lib/python3/dist-packages/rospy/impl/tcpros_service.py", line 633, in _handle_request\n response = convert_return_to_response(self.handler(request), self.response_class)\n', ' File "/home/me/catkin_ws/src/skiros2/skiros2_world_model/src/skiros2_world_model/ros/ontology_server.py", line 60, in _wo_query_cb\n raise e\n', ' File "/home/me/catkin_ws/src/skiros2/skiros2_world_model/src/skiros2_world_model/ros/ontology_server.py", line 44, in _wo_query_cb\n for s in self._ontology.query(msg.query_string, context_id=msg.context):\n', ' File "/usr/lib/python3/dist-packages/wrapt/decorators.py", line 500, in _synchronized_wrapper\n return wrapped(*args, **kwargs)\n', ' File "/home/me/catkin_ws/src/skiros2/skiros2_world_model/src/skiros2_world_model/core/ontology_rdflib.py", line 138, in query\n return self.ontology(context_id).query(query)\n', ' File "/home/me/.local/lib/python3.8/site-packages/rdflib/graph.py", line 1084, in query\n result = plugin.get(result, query.Result)\n', ' File "/home/me/.local/lib/python3.8/site-packages/rdflib/plugin.py", line 104, in get\n return p.getClass()\n', ' File "/home/me/.local/lib/python3.8/site-packages/rdflib/plugin.py", line 66, in getClass\n module = import(self.module_path, globals(), locals(), [""])\n', ' File "/home/me/.local/lib/python3.8/site-packages/rdflib/plugins/sparql/init.py", line 35, in \n from . import parser\n', ' File "/home/me/.local/lib/python3.8/site-packages/rdflib/plugins/sparql/parser.py", line 182, in \n Param(\'prefix\', PN_PREFIX)) + Suppress(\':\').leaveWhitespace()\n', ' File "/home/me/.local/lib/python3.8/site-packages/rdflib/plugins/sparql/parserutils.py", line 113, in init\n self.name = name\n', "AttributeError: can't set attribute\n"]

Service call failed: service [/wm/ontology/query] responded with an error: b"error processing request: can't set attribute" Traceback (most recent call last): File "/home/me/catkin_ws/src/skiros2/skiros2_world_model/src/skiros2_world_model/ros/ontology_interface.py", line 301, in _call resp1 = service(msg) File "/opt/ros/noetic/lib/python3/dist-packages/rospy/impl/tcpros_service.py", line 442, in call return self.call(*args, **kwds) File "/opt/ros/noetic/lib/python3/dist-packages/rospy/impl/tcpros_service.py", line 523, in call responses = transport.receive_once() File "/opt/ros/noetic/lib/python3/dist-packages/rospy/impl/tcpros_base.py", line 742, in receive_once p.read_messages(b, msg_queue, sock)
File "/opt/ros/noetic/lib/python3/dist-packages/rospy/impl/tcpros_service.py", line 360, in read_messages self._read_ok_byte(b, sock) File "/opt/ros/noetic/lib/python3/dist-packages/rospy/impl/tcpros_service.py", line 343, in _read_ok_byte raise ServiceException("service [%s] responded with an error: %s"%(self.resolved_name, str)) rospy.service.ServiceException: service [/wm/ontology/query] responded with an error: b"error processing request: can't set attribute"

matthias-mayr commented 11 months ago

Thanks for reporting this.
There were issues with RDFlib in the past.

What version do you have? I guess that you followed the normal installation instructions and would have the apt python package, in which case, this should tell the version:

apt show python3-rdflib

For me on the noetic docker image, its 4.2.2-5

shola-lawal commented 11 months ago

Hi Mathias-mayr,

Thank you for the help. The error didn't disappear, I am going to try again. I am using Ros1 do you think this is the problem?

matthias-mayr commented 11 months ago

Hm okay. Not super great, but I you can just re-open this issue if the error reappears.

We have not been able to release a ROS 2 version of the package yet, so right now everyone is using ROS 1.

jsalfity commented 2 months ago

@shola-lawal, I'm adding a comment here as I just came across this issue but solved it.

My apt show python3-rdflib showed 4.2.2.5, however, when I performed pip freeze | grep rdflib I had a version 4.x.x. The solution was to perform pip install rdflib==6.3.2, which fixed the problem.