rai icon indicating copy to clipboard operation
rai copied to clipboard

`/rai_whoami_documentation_service` does not return a response upon call

Open Cytrus14 opened this issue 7 months ago • 2 comments

Describe the bug The /rai_whoami_documentation_service does not return a response upon call. Additionally, if the call command is aborted before receiving a response, the service throws an exception:

Traceback (most recent call last): File "/usr/lib/python3.10/threading.py", line 1016, in _bootstrap_inner self.run() File "/usr/lib/python3.10/threading.py", line 953, in run self._target(*self._args, **self._kwargs) File "/opt/ros/humble/local/lib/python3.10/dist-packages/rclpy/executors.py", line 294, in spin self.spin_once() File "/opt/ros/humble/local/lib/python3.10/dist-packages/rclpy/executors.py", line 806, in spin_once self._spin_once_impl(timeout_sec) File "/opt/ros/humble/local/lib/python3.10/dist-packages/rclpy/executors.py", line 803, in _spin_once_impl future.result() File "/opt/ros/humble/local/lib/python3.10/dist-packages/rclpy/task.py", line 105, in result raise self.exception() File "/opt/ros/humble/local/lib/python3.10/dist-packages/rclpy/task.py", line 254, in call self._handler.send(None) File "/opt/ros/humble/local/lib/python3.10/dist-packages/rclpy/executors.py", line 447, in handler await call_coroutine(entity, arg) File "/opt/ros/humble/local/lib/python3.10/dist-packages/rclpy/executors.py", line 401, in _execute_service response = await await_or_execute(srv.callback, request, srv.srv_type.Response()) File "/opt/ros/humble/local/lib/python3.10/dist-packages/rclpy/executors.py", line 107, in await_or_execute return callback(*args) File "/home/user/Work/Robotec/rai/src/rai_whoami/rai_whoami/agents/ros2/vector_store_retrieval_agent.py", line 74, in service_callback response.scores = [result[1] for result in vdb_results] File "/home/user/Work/Robotec/rai/install/rai_interfaces/local/lib/python3.10/dist-packages/rai_interfaces/srv/_vector_store_retrieval.py", line 325, in scores assert
AssertionError: The 'scores' field must be a set or sequence and each value of type 'float' and each float in [-340282346600000016151267322115014000640.000000, 340282346600000016151267322115014000640.000000]

To Reproduce Steps to reproduce the behavior:

  1. Configure the robot's identity according to the Robot's identity within RAI tutorial
  2. Run the RAI Whomai service: python src/rai_whoami/rai_whoami/scripts/ros2_vector_store_retrieval_service.py panda/
  3. Call the service: ros2 service call /rai_whoami_documentation_service rai_interfaces/srv/VectorStoreRetrieval "query: 'maximum load'"
  4. The service will not return a response. If the service call is aborted, an exception is thrown within the src/rai_whoami/rai_whoami/scripts/ros2_vector_store_retrieval_service.py service

Expected behavior The /rai_whoami_documentation_service should return a response, an error or timeout. Additionally, the service should not crash when the service call is aborted.

Screenshots None

Platform

  • OS: Ubuntu 22.04
  • ROS 2 Version: Humble

Version commit 0e12297a468eab719b25228f5e273877605cbdfd

Additional context None

Cytrus14 avatar May 08 '25 09:05 Cytrus14

Couldn't reproduce. I am wondering what was the value of [result[1] for result in vdb_results], perhaps result[1] was NaN or None? Can you please attach pdb at that point and find out what are these values?

maciejmajek avatar May 08 '25 13:05 maciejmajek

The value of [result[1] for result in vdb_results] is equal to [0.5291562, 0.6289791]. I believe that the issue is caused by a type mismatch, as the [result[1] for result in vdb_results] values are of numpy.float32 type. Changing the expression to [float(result[1]) for result in vdb_results] appears to resolve the bug.

Cytrus14 avatar May 09 '25 05:05 Cytrus14