ros-naoqi / naoqi_driver2

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

Connection refused when trying to connect to pepper robot running naoqi 2.9 #5

Closed K4belBr4nd closed 7 months ago

K4belBr4nd commented 7 months ago

Hello there,

I am experiencing issues connecting to Pepper robots running NAOqi 2.9 using ROS Humble. The error message [naoqi_driver_node-1] Connect error: 111: Connection refused is displayed, and the naoqi driver node shuts down immediately.

I've tried the provided dev dockerfile from the repository as well as my own dockerfile with the release packages using docker compose and running it directly on my host machine with both the source build and the release packages.

Any help would be much appreciated.

Log / Error Message

root@linuxkit-525400123456:/ws# ros2 launch naoqi_driver naoqi_driver.launch.py nao_ip:=192.168.0.108 password:=xxxx qi_listen_url:=0.0.0.0:56000
[INFO] [launch]: All log files can be found below /root/.ros/log/2024-01-31-08-18-17-235989-linuxkit-525400123456-282
[INFO] [launch]: Default logging verbosity is set to INFO
[INFO] [naoqi_driver_node-1]: process started with pid [283]
[naoqi_driver_node-1] Connect error: 111: Connection refused
[naoqi_driver_node-1] naoqi driver is shutting down..
[naoqi_driver_node-1] cannot publish data, at ./src/rmw_publish.cpp:62 during '__function__'
[naoqi_driver_node-1] [ERROR] [1706689100.345726297] [naoqi_driver.rclcpp]: Error in destruction of rcl subscription handle: Failed to delete datareader, at ./src/subscription.cpp:52, at ./src/rcl/subscription.c:184
[naoqi_driver_node-1] cannot publish data, at ./src/rmw_publish.cpp:62 during '__function__'
[naoqi_driver_node-1] Fail in delete datareader, at ./src/rmw_service.cpp:104 during '__function__'
[ERROR] [naoqi_driver_node-1]: process has died [pid 283, exit code -11, cmd '/opt/ros/humble/lib/naoqi_driver/naoqi_driver_node --ros-args --params-file /tmp/launch_params_cpsefmdf'].

Environment

install basic dependencies

RUN apt-get update -y \ && apt-get install -y git python3-vcstool

install naoqi driver libraries

RUN apt-get install -y ros-${ROS_DISTRO}-naoqi-libqi \ ros-${ROS_DISTRO}-naoqi-libqicore ros-${ROS_DISTRO}-naoqi-bridge-msgs \ ros-${ROS_DISTRO}-pepper-meshes \ ros-${ROS_DISTRO}-nao-meshes \ ros-${ROS_DISTRO}-naoqi-driver

create workspace

ENV WS=/ws COPY . $WS RUN apt install -y git python3-vcstool

Build the base Colcon workspace, installing dependencies first.

WORKDIR $WS

Install extra tools for development

RUN apt-get update && apt-get install -y --no-install-recommends \ gdb gdbserver vim libgmock-dev

Every bash instance should source the entrypoint

RUN echo "source ${WS}/docker/entrypoint.sh" >> /root/.bashrc SHELL [ "/bin/bash", "-c" ] ENTRYPOINT [ "/bin/bash" ]

FROM dev as dev-prebuilt RUN source /opt/ros/${ROS_DISTRO}/setup.bash \ && colcon build --symlink-install


```yaml
version: "3.9"
services:
  dev:
    image: naoqi-driver:dev-$ROS_DISTRO
    build:
      context: .
      dockerfile: docker/Dockerfile
      target: dev-prebuilt
      args:
        - ROS_DISTRO=$ROS_DISTRO
    ports:
      - "9559:9559"
      - "56000:56000"

    # Interactive shell
    stdin_open: true
    tty: true

    # Networking and IPC for ROS 2
    network_mode: host
    ipc: host

Steps to reproduce

  1. ssh into robot
  2. qicli call ALAutonomouslife.setState disable
  3. qicli call ALMotion.wakeUp
  4. exit ssh connection
  5. docker compose up --build
  6. enter docker container in new terminal via docker exec -it <container_name> bash
  7. launching naoqi_driver via ros2 launch naoqi_driver naoqi_driver.launch.py nao_ip:=192.168.0.108 password:=xxxx qi_listen_url:=0.0.0.0:56000

Additional Information

K4belBr4nd commented 7 months ago

Found the solution to my problem in the naoqi_driver repository for ROS1 and this issue. Explicitly using the port 9503 instead of 9559 fixes connection error.

I created a pull request to include a warning in the launch section of the README with some additional changes to the driver_helper.cpp from the ROS1 naoqi driver repo.