ros-naoqi / naoqi_driver2

ROS2 driver for NAO and Pepper robots
Apache License 2.0
5 stars 8 forks source link

qi::FutureUserException Invalid signature #4

Open XO30 opened 5 months ago

XO30 commented 5 months ago

Hi

I'm running into the following error when running ros2 launch naoqi_driver naoqi_driver.launch.py nao_ip:=192.168.1.101

I have tried to install the naoqi_driver for ROS 2 in various ways. Ultimately, I want to run the setup in a Docker container. I have tested the installation in the following ways:

On all platforms, I have attempted the installation both with apt and by building from source. However, I consistently encounter the same error:

[naoqi_driver_node-1] terminate called after throwing an instance of 'qi::FutureUserException'
[naoqi_driver_node-1]   what():  Invalid signature

Output:

(base) stefan@stefan-ROS2:~/Downloads$ ros2 launch naoqi_driver naoqi_driver.launch.py nao_ip:=192.168.1.101 
[INFO] [launch]: All log files can be found below /home/stefan/.ros/log/2024-01-26-19-11-54-262748-stefan-ROS2-770229
[INFO] [launch]: Default logging verbosity is set to INFO
[INFO] [naoqi_driver_node-1]: process started with pid [770239]
[naoqi_driver_node-1] 2024-01-26 19:11:54.389 [RTPS_TRANSPORT_SHM Error] Failed init_port fastrtps_port7415: open_and_lock_file failed -> Function open_port_internal
[naoqi_driver_node-1] 2024-01-26 19:11:54.389 [RTPS_TRANSPORT_SHM Error] Failed init_port fastrtps_port7417: open_and_lock_file failed -> Function open_port_internal
[naoqi_driver_node-1] 2024-01-26 19:11:54.389 [RTPS_TRANSPORT_SHM Error] Failed init_port fastrtps_port7419: open_and_lock_file failed -> Function open_port_internal
[naoqi_driver_node-1] Receiving information about robot model
[naoqi_driver_node-1] Robot detected/NAOqi version: Pepper 1.8A / 2.5.10.7
[naoqi_driver_node-1] found an ament prefix /opt/ros/iron/share/naoqi_driver/share/boot_config.json
[naoqi_driver_node-1] load boot config from /opt/ros/iron/share/naoqi_driver/share/boot_config.json
[naoqi_driver_node-1] found a ament URDF /opt/ros/iron/share/naoqi_driver/share/urdf/pepper.urdf
[naoqi_driver_node-1] published robot description to /robot_description
[naoqi_driver_node-1] Audio Extractor: Start
[naoqi_driver_node-1] terminate called after throwing an instance of 'qi::FutureUserException'
[naoqi_driver_node-1]   what():  Invalid signature
[ERROR] [naoqi_driver_node-1]: process has died [pid 770239, exit code -6, cmd '/opt/ros/iron/lib/naoqi_driver/naoqi_driver_node --ros-args --params-file /tmp/launch_params_r9z25r93'].
andrewlblair commented 5 months ago

are you still experiencing this issue? i am encountering this too.

XO30 commented 5 months ago

Hello @andrewlblair

This error is probably due to a version incompatibility of libQi. Specifically, ALMemory.subscriber is causing problems. I cannot confirm this statement with certainty. However, the following source suggests this:

issue

Fortunately, not all NaoqiDriver2 services are affected by this. A modification of the boot_config.yaml can therefore solve the problem. The following setting worked for me:

{
    "_comment": "QQVGA = 0, QVGA = 1, VGA = 2",
    "converters":
    {
      "front_camera":
      {
        "enabled"       : true,
        "resolution"    : 1,
        "fps"           : 10,
        "recorder_fps"  : 5
      },
      "bottom_camera":
      {
        "enabled"       : true,
        "resolution"    : 1,
        "fps"           : 10,
        "recorder_fps"  : 5
      },
      "depth_camera":
      {
        "enabled"       : true,
        "xtion_resolution": 1,
        "stereo_resolution": 9,
        "fps"           : 10,
        "recorder_fps"  : 5
      },
      "stereo_camera":
      {
        "enabled"       : true,
        "resolution"    : 15,
        "fps"           : 10,
        "recorder_fps"  : 5
      },
      "ir_camera":
      {
        "enabled"       : true,
        "resolution"    : 1,
        "fps"           : 10,
        "recorder_fps"  : 5
      },
      "info":
      {
        "enabled"       : true,
        "frequency"     : 1
      },
      "logs":
      {
        "enabled"       : false,
        "frequency"     : 1
      },
      "diag":
      {
        "enabled"       : true,
        "frequency"     : 1
      },
      "imu_torso":
      {
        "enabled"       : true,
        "frequency"     : 10
      },
      "imu_base":
      {
        "enabled"       : true,
        "frequency"     : 10
      },
      "joint_states":
      {
        "enabled"       : true,
        "frequency"     : 50
      },
      "laser":
      {
        "enabled"       : true,
        "frequency"     : 10,
        "range_min"     : 0.1,
        "range_max"     : 3.0
      },
      "sonar":
      {
        "enabled"       : true,
        "frequency"     : 10
      },
      "audio":
      {
        "enabled"       : true
      },
      "bumper":
      {
        "enabled"       : false
      },
      "touch_hand":
      {
        "enabled"       : false
      },
      "touch_head":
      {
        "enabled"       : false
      },
      "odom":
      {
        "enabled"       : true,
        "frequency"     : 15
      }
    }
  }

The drivers now start successfully and I get important ROS2 topics, like /odom and /cmdvel. Unfortunately, the deactivated services such as touch_head, touch_hand and bumper are lost.

victorpaleologue commented 4 months ago

This error will depend on the version of the software the robot is running. Is it NAOqi 2.5? I had to make a choice and favor NAOqi 2.8 because it was more recent, but the communication lib has some incompatibility in certain cases.

I have an idea to workaround this, though, by avoiding the API ALMemory.subscriber. But the cons to this solution is that it will require your client to be exposed on the network, and it leads to other issues, like the ones some encounter with the audio features.

Maelic commented 2 months ago

@victorpaleologue Do you have any workaround regarding this issue? I am getting it as well, using a recent build with Naoqi 2.5. It is likely to be a problem related to one of the latest libQi releases as I didn't change anything else in my build.

victorpaleologue commented 2 months ago

Not yet. I had no time for such dev. I can assist someone to patch it though. I hope I can look into it someday soon.

XO30 commented 2 months ago

Hello @victorpaleologue

I have a general question about the NAOqi SDK. I've been trying to extend the ROS2 driver by wrapping ROS2 topics and services around existing NAOqi functions. For example, playing an audio file on Pepper using a ROS2 service. Since the Python SDK no longer works under ROS2 (due to Python 2.7), I was forced to use the C++ SDK. This has worked to some extent. I can write a small program that plays the audio file. However, I've noticed that I cannot compile the code for arm64, which is a dealbreaker for me.

Now I'm a bit confused, as I had assumed that these drivers were just ROS2 wrappers around existing NAOqi functions. Yet, I can use the drivers on ARM64. What exactly do I need to change to get my extensions running on ARM as well? I think this insight could also help with this issue, as it would be possible to develop an alternative ROS node for the bumpers, for example.

P.S. Additionally, I have encountered recommendations to use qibuild when developing C++ programs for naoqi. How can I bypass this, since I would prefer to build the node with colcon?

Thank you in advance for your assistance.

Maelic commented 2 months ago

Hello @victorpaleologue

I have a general question about the NAOqi SDK. I've been trying to extend the ROS2 driver by wrapping ROS2 topics and services around existing NAOqi functions. For example, playing an audio file on Pepper using a ROS2 service. Since the Python SDK no longer works under ROS2 (due to Python 2.7), I was forced to use the C++ SDK. This has worked to some extent. I can write a small program that plays the audio file. However, I've noticed that I cannot compile the code for arm64, which is a dealbreaker for me.

Now I'm a bit confused, as I had assumed that these drivers were just ROS2 wrappers around existing NAOqi functions. Yet, I can use the drivers on ARM64. What exactly do I need to change to get my extensions running on ARM as well? I think this insight could also help with this issue, as it would be possible to develop an alternative ROS node for the bumpers, for example.

P.S. Additionally, I have encountered recommendations to use qibuild when developing C++ programs for naoqi. How can I bypass this, since I would prefer to build the node with colcon?

Thank you in advance for your assistance.

Hi @XO30,

If I may, there is a new Python SDK that works with Naoqi and Python 3, you can find it at https://github.com/aldebaran/libqi-python. It works well with ROS2 Humble, we are using it to integrate diverse capabilities onboard the Pepper robot, if you are interested you may have a look at our latest development for Pepper: https://github.com/RoboBreizh-RoboCup-Home

XO30 commented 2 months ago

Hi @Maelic

Thank you for the information. It looks very promising. I will delve into the sources.

victorpaleologue commented 2 months ago

You're figuring it out right, but let me rephrase it more accurately.

The NAOqi Python SDK is 2.7, and is therefore obsolete. So is the NAOqi C++ SDK, honestly.

However, the underlying RPC library, libQi, is open source and has been maintained to work on more recent systems. It can be recompiled for other platforms as well, including arm64. There are Python bindings of it, it's the one mentioned by @Maelic (you can simply do a pip install qi and go on with it). But these are not technically SDKs, because services aren't statically binded, enums aren't published in headers, no toolchain is provided for the robots, etc... It's pretty much barebone, but it does the job.

We use the latter in ROS drivers. More precisely, I prepared a specific variant of it, so that it works well for NAOqi 2.8 and 2.9. But I used some mechanism (ALMemory.subscriber) that was broken in 2.5 and earlier, hence the issue. I can use another one to work around it (ALMemory.subscribeToMicroEvent), but it requires the driver to open a public port to be reachable by the robot - like we do for audio - and several people have issues with that.

victorpaleologue commented 2 months ago

I went down that rabbit hole, and it appears the latest ROS 2 driver works fine for NAOqi 2.1. I suppose if it works for 2.1, 2.8 and 2.9, it must work for 2.5. But only a test would tell. I don't have a 2.5 around me, so I'll have a hard time investigating.

So @XO30 perhaps you could run the node with a debugger? I'd love to have a backtrace of the crash. I usually debug nodes built from sources with this VSCode extension. Don't forget to add --cmake-args -DCMAKE_BUILD_TYPE=Debug when building.

Now I'm a bit confused, as I had assumed that these drivers were just ROS2 wrappers around existing NAOqi functions. Yet, I can use the drivers on ARM64. What exactly do I need to change to get my extensions running on ARM as well? I think this insight could also help with this issue, as it would be possible to develop an alternative ROS node for the bumpers, for example.

ROS packages for ARM are simply built with colcon with an ARM system.

But @Maelic, you're welcome to contribute your alternative bumper code here, if you think it has value beyond your own project.