mavlink / mavros

MAVLink to ROS gateway with proxy for Ground Control Station
Other
905 stars 994 forks source link

PX4 not communicating via mavlink with mavros #1966

Closed iwishiwasaneagle closed 4 months ago

iwishiwasaneagle commented 4 months ago

This is only bug and feature tracker, please use it to report bugs or request features.


Issue details

MAVROS connecting to PX4, and the correct topics are showing up when running ros2 topic list. However, when subscribing via ros2 topic echowith varying QoS settings no data is printed. ros2 topic hzsimilarly does not show any information either.

Additional Information

MAVROS version and platform

Mavros: 2.8.0-1noble.20240703.180528 (installed via apt) ROS: jazzy Ubuntu: 24.04

Run using docker compose.

Dockerfile.mavros

FROM ros:jazzy

RUN apt-get update \
    && apt-get install -y ros-jazzy-mavros ros-jazzy-mavlink

RUN /opt/ros/jazzy/lib/mavros/install_geographiclib_datasets.sh

docker-compose.yml

services:
  px4:
    image: px4io/px4-dev-simulation-focal:latest
    volumes:
      - ./PX4-Autopilot:/src/PX4-Autopilot:rw
      - /tmp/.X11-unix:/tmp/.X11-unix:ro
    working_dir: /src/PX4-Autopilot
    environment:
      LOCAL_USER_ID: "$USER_ID"
      DISPLAY:
    env_file: docker/.env
    command: make px4_sitl_default gazebo
    stdin_open: true
    tty: true
    network_mode: "host"

  mavros:
    depends_on:
      - px4
    build:
      context: docker/
      dockerfile: Dockerfile.mavros
    command: ros2 launch mavros px4.launch fcu_url:="udp://@"
    env_file: docker/.env
    network_mode: "host"

.env

ROS_DOMAIN_ID=42
ROS_AUTOMATIC_DISCOVERY_RANGE=LOCALHOST

Autopilot type and version

[ ] ArduPilot [x ] PX4

Version: v1.15.0-beta1

Node logs

mavros-1  | [INFO] [launch]: All log files can be found below /root/.ros/log/2024-07-08-08-47-25-583944-jhlaptop-1
mavros-1  | [INFO] [launch]: Default logging verbosity is set to INFO
mavros-1  | [INFO] [mavros_node-1]: process started with pid [48]
mavros-1  | [mavros_node-1] [INFO] [1720428445.687451668] [mavros.mavros_node]: Starting mavros_node container
mavros-1  | [mavros_node-1] [INFO] [1720428445.687492767] [mavros.mavros_node]: FCU URL: udp://@
mavros-1  | [mavros_node-1] [INFO] [1720428445.687498990] [mavros.mavros_node]: GCS URL:
mavros-1  | [mavros_node-1] [INFO] [1720428445.687504744] [mavros.mavros_node]: UAS Prefix: /uas1
mavros-1  | [mavros_node-1] [INFO] [1720428445.687509306] [mavros.mavros_node]: Starting mavros router node
mavros-1  | [mavros_node-1] [INFO] [1720428445.692157891] [mavros.mavros_router]: Built-in SIMD instructions: SSE, SSE2
mavros-1  | [mavros_node-1] [INFO] [1720428445.692172358] [mavros.mavros_router]: Built-in MAVLink package version: 2024.6.6
mavros-1  | [mavros_node-1] [INFO] [1720428445.692181485] [mavros.mavros_router]: Known MAVLink dialects: common ardupilotmega ASLUAV AVSSUAS all csAirLink cubepilot development icarous matrixpilot paparazzi standard storm32 uAvionix ualberta
mavros-1  | [mavros_node-1] [INFO] [1720428445.692186646] [mavros.mavros_router]: MAVROS Router started
mavros-1  | [mavros_node-1] [INFO] [1720428445.692223209] [mavros.mavros_router]: Requested to add endpoint: type: 0, url: udp://@
mavros-1  | [mavros_node-1] [INFO] [1720428445.692236957] [mavros.mavros_router]: Endpoint link[1000] created
mavros-1  | [mavros_node-1] [INFO] [1720428445.692452832] [mavros.mavros_router]: link[1000] opened successfully
mavros-1  | [mavros_node-1] [INFO] [1720428445.692496998] [mavros.mavros_router]: Requested to add endpoint: type: 2, url: /uas1
mavros-1  | [mavros_node-1] [INFO] [1720428445.692510325] [mavros.mavros_router]: Endpoint link[1001] created
mavros-1  | [mavros_node-1] [INFO] [1720428445.694319388] [mavros.mavros_router]: link[1001] opened successfully
mavros-1  | [mavros_node-1] [INFO] [1720428445.694358506] [mavros.mavros_node]: Starting mavros uas node
mavros-1  | [mavros_node-1] [INFO] [1720428445.722642490] [mavros.mavros]: UAS Executor started, threads: 16
mavros-1  | [mavros_node-1] [INFO] [1720428445.730576229] [mavros.mavros]: Plugin actuator_control created
mavros-1  | [mavros_node-1] [INFO] [1720428445.730604635] [mavros.mavros]: Plugin actuator_control initialized
mavros-1  | [mavros_node-1] [INFO] [1720428445.733431166] [mavros.mavros]: Plugin altitude created
mavros-1  | [mavros_node-1] [INFO] [1720428445.733455530] [mavros.mavros]: Plugin altitude initialized
mavros-1  | [mavros_node-1] [INFO] [1720428445.738041993] [mavros.mavros]: Plugin command created
mavros-1  | [mavros_node-1] [INFO] [1720428445.738060930] [mavros.mavros]: Plugin command initialized
mavros-1  | [mavros_node-1] [INFO] [1720428445.743916592] [mavros.mavros]: Plugin ftp created
mavros-1  | [mavros_node-1] [INFO] [1720428445.743939726] [mavros.mavros]: Plugin ftp initialized
mavros-1  | [mavros_node-1] [INFO] [1720428445.747736968] [mavros.mavros]: Plugin geofence created
mavros-1  | [mavros_node-1] [INFO] [1720428445.747762383] [mavros.mavros]: Plugin geofence initialized
mavros-1  | [mavros_node-1] [INFO] [1720428445.754048418] [mavros.mavros]: Plugin global_position created
mavros-1  | [mavros_node-1] [INFO] [1720428445.754074219] [mavros.mavros]: Plugin global_position initialized
mavros-1  | [mavros_node-1] [INFO] [1720428445.757742065] [mavros.mavros]: Plugin home_position created
mavros-1  | [mavros_node-1] [INFO] [1720428445.757761239] [mavros.mavros]: Plugin home_position initialized
mavros-1  | [mavros_node-1] [INFO] [1720428445.762398245] [mavros.mavros]: Plugin imu created
mavros-1  | [mavros_node-1] [INFO] [1720428445.762424652] [mavros.mavros]: Plugin imu initialized
mavros-1  | [mavros_node-1] [INFO] [1720428445.766944952] [mavros.mavros]: Plugin local_position created
mavros-1  | [mavros_node-1] [INFO] [1720428445.766970920] [mavros.mavros]: Plugin local_position initialized
mavros-1  | [mavros_node-1] [INFO] [1720428445.771032910] [mavros.mavros]: Plugin manual_control created
mavros-1  | [mavros_node-1] [INFO] [1720428445.771055415] [mavros.mavros]: Plugin manual_control initialized
mavros-1  | [mavros_node-1] [INFO] [1720428445.775095024] [mavros.mavros]: Plugin nav_controller_output created
mavros-1  | [mavros_node-1] [INFO] [1720428445.775120707] [mavros.mavros]: Plugin nav_controller_output initialized
mavros-1  | [mavros_node-1] [INFO] [1720428445.779640089] [mavros.mavros]: Plugin param created
mavros-1  | [mavros_node-1] [INFO] [1720428445.779660873] [mavros.mavros]: Plugin param initialized
mavros-1  | [mavros_node-1] [INFO] [1720428445.784401598] [mavros.mavros]: Plugin rallypoint created
mavros-1  | [mavros_node-1] [INFO] [1720428445.784425913] [mavros.mavros]: Plugin rallypoint initialized
mavros-1  | [mavros_node-1] [INFO] [1720428445.789095366] [mavros.mavros]: Plugin rc_io created
mavros-1  | [mavros_node-1] [INFO] [1720428445.789121972] [mavros.mavros]: Plugin rc_io initialized
mavros-1  | [mavros_node-1] [INFO] [1720428445.793383473] [mavros.mavros]: Plugin setpoint_accel created
mavros-1  | [mavros_node-1] [INFO] [1720428445.793401950] [mavros.mavros]: Plugin setpoint_accel initialized
mavros-1  | [mavros_node-1] [INFO] [1720428445.798741975] [mavros.mavros]: Plugin setpoint_attitude created
mavros-1  | [mavros_node-1] [INFO] [1720428445.798761741] [mavros.mavros]: Plugin setpoint_attitude initialized
mavros-1  | [mavros_node-1] [INFO] [1720428445.805058499] [mavros.mavros]: Plugin setpoint_position created
mavros-1  | [mavros_node-1] [INFO] [1720428445.805080877] [mavros.mavros]: Plugin setpoint_position initialized
mavros-1  | [mavros_node-1] [INFO] [1720428445.811274533] [mavros.mavros]: Plugin setpoint_raw created
mavros-1  | [mavros_node-1] [INFO] [1720428445.811305642] [mavros.mavros]: Plugin setpoint_raw initialized
mavros-1  | [mavros_node-1] [INFO] [1720428445.817140603] [mavros.mavros]: Plugin setpoint_trajectory created
mavros-1  | [mavros_node-1] [INFO] [1720428445.817160150] [mavros.mavros]: Plugin setpoint_trajectory initialized
mavros-1  | [mavros_node-1] [INFO] [1720428445.822341438] [mavros.mavros]: Plugin setpoint_velocity created
mavros-1  | [mavros_node-1] [INFO] [1720428445.822360679] [mavros.mavros]: Plugin setpoint_velocity initialized
mavros-1  | [mavros_node-1] [INFO] [1720428445.830040438] [mavros.mavros]: Plugin sys_status created
mavros-1  | [mavros_node-1] [INFO] [1720428445.830078415] [mavros.mavros]: Plugin sys_status initialized
mavros-1  | [mavros_node-1] [INFO] [1720428445.835373256] [mavros.time]: TM: Timesync mode: MAVLINK
mavros-1  | [mavros_node-1] [INFO] [1720428445.836863792] [mavros.mavros]: Plugin sys_time created
mavros-1  | [mavros_node-1] [INFO] [1720428445.836887546] [mavros.mavros]: Plugin sys_time initialized
mavros-1  | [mavros_node-1] [INFO] [1720428445.844299415] [mavros.mavros]: Plugin waypoint created
mavros-1  | [mavros_node-1] [INFO] [1720428445.844335004] [mavros.mavros]: Plugin waypoint initialized
mavros-1  | [mavros_node-1] [INFO] [1720428445.849884709] [mavros.mavros]: Plugin wind_estimation created
mavros-1  | [mavros_node-1] [INFO] [1720428445.849907127] [mavros.mavros]: Plugin wind_estimation initialized
mavros-1  | [mavros_node-1] [INFO] [1720428445.850459816] [mavros.mavros]: Built-in SIMD instructions: SSE, SSE2
mavros-1  | [mavros_node-1] [INFO] [1720428445.850471300] [mavros.mavros]: Built-in MAVLink package version: 2024.6.6
mavros-1  | [mavros_node-1] [INFO] [1720428445.850475619] [mavros.mavros]: Known MAVLink dialects: common ardupilotmega ASLUAV AVSSUAS all csAirLink cubepilot development icarous matrixpilot paparazzi standard storm32 uAvionix ualberta
mavros-1  | [mavros_node-1] [INFO] [1720428445.850479396] [mavros.mavros]: MAVROS UAS via /uas1 started. MY ID 1.191, TARGET ID 1.1
mavros-1  | [mavros_node-1] [INFO] [1720428445.936112111] [mavros.mavros_router]: link[1001] detected remote address 1.191
mavros-1  | [mavros_node-1] [WARN] [1720428447.832120393] [mavros.sys]: VER: broadcast request timeout, retries left 4
mavros-1  | [mavros_node-1] [WARN] [1720428448.832699202] [mavros.sys]: VER: broadcast request timeout, retries left 3
mavros-1  | [mavros_node-1] [WARN] [1720428449.832305001] [mavros.sys]: VER: unicast request timeout, retries left 2
mavros-1  | [mavros_node-1] [WARN] [1720428450.832250676] [mavros.sys]: VER: unicast request timeout, retries left 1
mavros-1  | [mavros_node-1] [WARN] [1720428451.832141445] [mavros.sys]: VER: unicast request timeout, retries left 0
mavros-1  | [mavros_node-1] [WARN] [1720428452.832156882] [mavros.sys]: VER: your FCU don't support AUTOPILOT_VERSION, switched to default capabilities

Diagnostics

$ ros2 topic echo --once /diagnostics
header:
  stamp:
    sec: 1720428658
    nanosec: 691047766
  frame_id: ''
status:
- level: "\0"
  name: 'mavros_router: MAVROS Router'
  message: ok
  hardware_id: none
  values:
  - key: Endpoints
    value: '2'
  - key: Messages routed
    value: '2559'
  - key: Messages sent
    value: '2559'
  - key: Messages dropped
    value: '0'
- level: "\0"
  name: 'mavros_router: endpoint 1000: udp://@'
  message: ok
  hardware_id: none
  values:
  - key: Received packets
    value: '0'
  - key: Dropped packets
    value: '0'
  - key: Buffer overruns
    value: '0'
  - key: Parse errors
    value: '0'
  - key: Rx sequence number
    value: '0'
  - key: Tx sequence number
    value: '0'
  - key: Rx total bytes
    value: '0'
  - key: Tx total bytes
    value: '0'
  - key: Rx speed
    value: '0.000000'
  - key: Tx speed
    value: '0.000000'
  - key: Remotes count
    value: '1'
  - key: Remote [0]
    value: '0.0'
- level: "\0"
  name: 'mavros_router: endpoint 1001: /uas1'
  message: ok
  hardware_id: none
  values:
  - key: Remotes count
    value: '3'
  - key: Remote [0]
    value: '0.0'
  - key: Remote [1]
    value: '1.0'
  - key: Remote [2]
    value: '1.191'
---

Check ID

$ ros2 run mavros mav checkid
[ERROR] [1720428708.155507539] [mavpy_97dj]: wait for service time out: {topic}
Traceback (most recent call last):
  File "/opt/ros/jazzy/lib/python3.12/site-packages/mavros/cmd/__init__.py", line 34, in __getattr__
    return object.__getattribute__(self, key)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'CliClient' object has no attribute 'uas_settings'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/opt/ros/jazzy/lib/mavros/mav", line 14, in <module>
    cli()
  File "/usr/lib/python3/dist-packages/click/core.py", line 1157, in __call__
    return self.main(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/click/core.py", line 1078, in main
    rv = self.invoke(ctx)
         ^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/click/core.py", line 1688, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/click/core.py", line 1434, in invoke
    return ctx.invoke(self.callback, **ctx.params)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/click/core.py", line 783, in invoke
    return __callback(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/click/decorators.py", line 92, in new_func
    return ctx.invoke(f, obj, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/click/core.py", line 783, in invoke
    return __callback(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/ros/jazzy/lib/python3.12/site-packages/mavros/cmd/checkid.py", line 129, in checkid
    checker = Checker(client=client, follow=follow, watch_time=watch_time)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/ros/jazzy/lib/python3.12/site-packages/mavros/cmd/checkid.py", line 44, in __init__
    self.tgt_ids = client.uas_settings.target_ids
                   ^^^^^^^^^^^^^^^^^^^
  File "/opt/ros/jazzy/lib/python3.12/site-packages/mavros/cmd/__init__.py", line 36, in __getattr__
    return getattr(self.cli, key)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/functools.py", line 995, in __get__
    val = self.func(instance)
          ^^^^^^^^^^^^^^^^^^^
  File "/opt/ros/jazzy/lib/python3.12/site-packages/mavros/base.py", line 116, in uas_settings
    pd = call_get_parameters(node=self, node_name=self.mavros_ns, names=names)
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/ros/jazzy/lib/python3.12/site-packages/mavros/utils.py", line 75, in call_get_parameters
    wait_for_service(client, lg)
  File "/opt/ros/jazzy/lib/python3.12/site-packages/mavros/base.py", line 55, in wait_for_service
    raise ServiceWaitTimeout(topic)
mavros.base.ServiceWaitTimeout: mavros/get_parameters
[ros2run]: Process exited with failure 1

Mavlink status

pxh> mavlink status

instance #0:
        mavlink chan: #0
        type:           GENERIC LINK OR RADIO
        flow control: OFF
        rates:
          tx: 16970.1 B/s
          txerr: 0.0 B/s
          tx rate mult: 1.000
          tx rate max: 4000000 B/s
          rx: 0.0 B/s
          rx loss: 0.0%
        Received Messages:
          sysid:255, compid:190, Total: 2366 (lost: 0)
        FTP enabled: YES, TX enabled: YES
        mode: Normal
        Forwarding: On
        MAVLink version: 2
        transport protocol: UDP (18570, remote port: 14550)
        Broadcast enabled: NO
        partner IP: 127.0.0.1
        ping statistics:
          last: 16.00 ms
          mean: 8.55 ms
          max: 48.00 ms
          min: 16.00 ms
          dropped packets: 0

instance #1:
        mavlink chan: #1
        type:           GENERIC LINK OR RADIO
        flow control: OFF
        rates:
          tx: 25915.3 B/s
          txerr: 0.0 B/s
          tx rate mult: 1.000
          tx rate max: 4000000 B/s
          rx: 0.0 B/s
          rx loss: 0.0%
        FTP enabled: YES, TX enabled: YES
        mode: Onboard
        Forwarding: On
        MAVLink version: 2
        transport protocol: UDP (14580, remote port: 14540)
        Broadcast enabled: NO

instance #2:
        mavlink chan: #2
        type:           GENERIC LINK OR RADIO
        flow control: OFF
        rates:
          tx: 3820.7 B/s
          txerr: 0.0 B/s
          tx rate mult: 0.139
          tx rate max: 4000 B/s
          rx: 0.0 B/s
          rx loss: 0.0%
        FTP enabled: YES, TX enabled: YES
        mode: Onboard
        Forwarding: On
        MAVLink version: 2
        transport protocol: UDP (14280, remote port: 14030)
        Broadcast enabled: NO

instance #3:
        mavlink chan: #3
        type:           GENERIC LINK OR RADIO
        flow control: OFF
        rates:
          tx: 1344.6 B/s
          txerr: 0.0 B/s
          tx rate mult: 1.000
          tx rate max: 400000 B/s
          rx: 0.0 B/s
          rx loss: 0.0%
        FTP enabled: YES, TX enabled: YES
        mode: Gimbal
        Forwarding: Off
        MAVLink version: 2
        transport protocol: UDP (13030, remote port: 13280)
        Broadcast enabled: NO
iwishiwasaneagle commented 4 months ago

After adding the -p flag to px4-rc.mavlinkand re-running, it now seems that mavros is connecting to PX4 via mavlink On the mavros docker image I can echo the topics

Attaching to mavros-1
mavros-1  | [INFO] [launch]: All log files can be found below /root/.ros/log/2024-07-08-10-15-12-673480-jhlaptop-1
mavros-1  | [INFO] [launch]: Default logging verbosity is set to INFO
mavros-1  | [INFO] [mavros_node-1]: process started with pid [48]
mavros-1  | [mavros_node-1] [INFO] [1720433712.881072527] [mavros.mavros_node]: Starting mavros_node container
mavros-1  | [mavros_node-1] [INFO] [1720433712.881178725] [mavros.mavros_node]: FCU URL: udp://0.0.0.0:14540@
mavros-1  | [mavros_node-1] [INFO] [1720433712.881188740] [mavros.mavros_node]: GCS URL:
mavros-1  | [mavros_node-1] [INFO] [1720433712.881194554] [mavros.mavros_node]: UAS Prefix: /uas1
mavros-1  | [mavros_node-1] [INFO] [1720433712.881199696] [mavros.mavros_node]: Starting mavros router node
mavros-1  | [mavros_node-1] [INFO] [1720433712.889699385] [mavros.mavros_router]: Built-in SIMD instructions: SSE, SSE2
mavros-1  | [mavros_node-1] [INFO] [1720433712.889724952] [mavros.mavros_router]: Built-in MAVLink package version: 2024.6.6
mavros-1  | [mavros_node-1] [INFO] [1720433712.889733772] [mavros.mavros_router]: Known MAVLink dialects: common ardupilotmega ASLUAV AVSSUAS all csAirLink cubepilot development icarous matrixpilot paparazzi standard storm32 uAvionix ualberta
mavros-1  | [mavros_node-1] [INFO] [1720433712.889738183] [mavros.mavros_router]: MAVROS Router started
mavros-1  | [mavros_node-1] [INFO] [1720433712.889795596] [mavros.mavros_router]: Requested to add endpoint: type: 0, url: udp://0.0.0.0:14540@
mavros-1  | [mavros_node-1] [INFO] [1720433712.889810876] [mavros.mavros_router]: Endpoint link[1000] created
mavros-1  | [mavros_node-1] [INFO] [1720433712.890129058] [mavros.mavros_router]: link[1000] opened successfully
mavros-1  | [mavros_node-1] [INFO] [1720433712.890170654] [mavros.mavros_router]: Requested to add endpoint: type: 2, url: /uas1
mavros-1  | [mavros_node-1] [INFO] [1720433712.890180974] [mavros.mavros_router]: Endpoint link[1001] created
mavros-1  | [mavros_node-1] [INFO] [1720433712.891843787] [mavros.mavros_router]: link[1000] detected remote address 1.1
mavros-1  | [mavros_node-1] [INFO] [1720433712.893629592] [mavros.mavros_router]: link[1001] opened successfully
mavros-1  | [mavros_node-1] [INFO] [1720433712.893675159] [mavros.mavros_node]: Starting mavros uas node
mavros-1  | [mavros_node-1] [INFO] [1720433712.938457335] [mavros.mavros]: UAS Executor started, threads: 16
mavros-1  | [mavros_node-1] [INFO] [1720433712.956220131] [mavros.mavros]: Plugin actuator_control created
mavros-1  | [mavros_node-1] [INFO] [1720433712.956267995] [mavros.mavros]: Plugin actuator_control initialized
mavros-1  | [mavros_node-1] [INFO] [1720433712.961764809] [mavros.mavros]: Plugin altitude created
mavros-1  | [mavros_node-1] [INFO] [1720433712.961795788] [mavros.mavros]: Plugin altitude initialized
mavros-1  | [mavros_node-1] [INFO] [1720433712.973381695] [mavros.mavros]: Plugin command created
mavros-1  | [mavros_node-1] [INFO] [1720433712.973789053] [mavros.mavros]: Plugin command initialized
mavros-1  | [mavros_node-1] [INFO] [1720433712.985626881] [mavros.mavros]: Plugin ftp created
mavros-1  | [mavros_node-1] [INFO] [1720433712.985668425] [mavros.mavros]: Plugin ftp initialized
mavros-1  | [mavros_node-1] [INFO] [1720433712.992140907] [mavros.mavros]: Plugin geofence created
mavros-1  | [mavros_node-1] [INFO] [1720433712.992178618] [mavros.mavros]: Plugin geofence initialized
mavros-1  | [mavros_node-1] [INFO] [1720433713.001973467] [mavros.mavros]: Plugin global_position created
mavros-1  | [mavros_node-1] [INFO] [1720433713.002016889] [mavros.mavros]: Plugin global_position initialized
mavros-1  | [mavros_node-1] [INFO] [1720433713.007642496] [mavros.mavros]: Plugin home_position created
mavros-1  | [mavros_node-1] [INFO] [1720433713.007671678] [mavros.mavros]: Plugin home_position initialized
mavros-1  | [mavros_node-1] [INFO] [1720433713.014196017] [mavros.mavros]: Plugin imu created
mavros-1  | [mavros_node-1] [INFO] [1720433713.014231583] [mavros.mavros]: Plugin imu initialized
mavros-1  | [mavros_node-1] [INFO] [1720433713.025140295] [mavros.mavros]: Plugin local_position created
mavros-1  | [mavros_node-1] [INFO] [1720433713.025248583] [mavros.mavros]: Plugin local_position initialized
mavros-1  | [mavros_node-1] [INFO] [1720433713.033112738] [mavros.mavros]: Plugin manual_control created
mavros-1  | [mavros_node-1] [INFO] [1720433713.033145043] [mavros.mavros]: Plugin manual_control initialized
mavros-1  | [mavros_node-1] [INFO] [1720433713.040632839] [mavros.mavros]: Plugin nav_controller_output created
mavros-1  | [mavros_node-1] [INFO] [1720433713.040667398] [mavros.mavros]: Plugin nav_controller_output initialized
mavros-1  | [mavros_node-1] [INFO] [1720433713.050207302] [mavros.mavros]: Plugin param created
mavros-1  | [mavros_node-1] [INFO] [1720433713.050280184] [mavros.mavros]: Plugin param initialized
mavros-1  | [mavros_node-1] [INFO] [1720433713.064272491] [mavros.mavros]: Plugin rallypoint created
mavros-1  | [mavros_node-1] [INFO] [1720433713.064326027] [mavros.mavros]: Plugin rallypoint initialized
mavros-1  | [mavros_node-1] [INFO] [1720433713.075185597] [mavros.mavros]: Plugin rc_io created
mavros-1  | [mavros_node-1] [INFO] [1720433713.075237014] [mavros.mavros]: Plugin rc_io initialized
mavros-1  | [mavros_node-1] [INFO] [1720433713.084635979] [mavros.mavros]: Plugin setpoint_accel created
mavros-1  | [mavros_node-1] [INFO] [1720433713.084668065] [mavros.mavros]: Plugin setpoint_accel initialized
mavros-1  | [mavros_node-1] [INFO] [1720433713.095794907] [mavros.mavros]: Plugin setpoint_attitude created
mavros-1  | [mavros_node-1] [INFO] [1720433713.095827968] [mavros.mavros]: Plugin setpoint_attitude initialized
mavros-1  | [mavros_node-1] [INFO] [1720433713.105398039] [mavros.mavros]: Plugin setpoint_position created
mavros-1  | [mavros_node-1] [INFO] [1720433713.105484089] [mavros.mavros]: Plugin setpoint_position initialized
mavros-1  | [mavros_node-1] [INFO] [1720433713.120138527] [mavros.mavros]: Plugin setpoint_raw created
mavros-1  | [mavros_node-1] [INFO] [1720433713.120185409] [mavros.mavros]: Plugin setpoint_raw initialized
mavros-1  | [mavros_node-1] [INFO] [1720433713.132314671] [mavros.mavros]: Plugin setpoint_trajectory created
mavros-1  | [mavros_node-1] [INFO] [1720433713.132344143] [mavros.mavros]: Plugin setpoint_trajectory initialized
mavros-1  | [mavros_node-1] [INFO] [1720433713.146032651] [mavros.mavros]: Plugin setpoint_velocity created
mavros-1  | [mavros_node-1] [INFO] [1720433713.146085585] [mavros.mavros]: Plugin setpoint_velocity initialized
mavros-1  | [mavros_node-1] [INFO] [1720433713.159339820] [mavros.mavros]: Plugin sys_status created
mavros-1  | [mavros_node-1] [INFO] [1720433713.159388275] [mavros.mavros]: Plugin sys_status initialized
mavros-1  | [mavros_node-1] [INFO] [1720433713.166980548] [mavros.time]: TM: Timesync mode: MAVLINK
mavros-1  | [mavros_node-1] [INFO] [1720433713.168752737] [mavros.mavros]: Plugin sys_time created
mavros-1  | [mavros_node-1] [INFO] [1720433713.168781427] [mavros.mavros]: Plugin sys_time initialized
mavros-1  | [mavros_node-1] [INFO] [1720433713.179996954] [mavros.mavros]: Plugin waypoint created
mavros-1  | [mavros_node-1] [INFO] [1720433713.180042956] [mavros.mavros]: Plugin waypoint initialized
mavros-1  | [mavros_node-1] [INFO] [1720433713.188641283] [mavros.mavros]: Plugin wind_estimation created
mavros-1  | [mavros_node-1] [INFO] [1720433713.188676404] [mavros.mavros]: Plugin wind_estimation initialized
mavros-1  | [mavros_node-1] [INFO] [1720433713.189424663] [mavros.mavros]: Built-in SIMD instructions: SSE, SSE2
mavros-1  | [mavros_node-1] [INFO] [1720433713.189437629] [mavros.mavros]: Built-in MAVLink package version: 2024.6.6
mavros-1  | [mavros_node-1] [INFO] [1720433713.189441202] [mavros.mavros]: Known MAVLink dialects: common ardupilotmega ASLUAV AVSSUAS all csAirLink cubepilot development icarous matrixpilot paparazzi standard storm32 uAvionix ualberta
mavros-1  | [mavros_node-1] [INFO] [1720433713.189450042] [mavros.mavros]: MAVROS UAS via /uas1 started. MY ID 1.191, TARGET ID 1.1
mavros-1  | [mavros_node-1] [INFO] [1720433713.199281443] [mavros.imu]: IMU: Attitude quaternion IMU detected!
mavros-1  | [mavros_node-1] [INFO] [1720433713.203242983] [mavros.imu]: IMU: High resolution IMU detected!
mavros-1  | [mavros_node-1] [INFO] [1720433713.242647454] [mavros.mavros]: CON: Got HEARTBEAT, connected. FCU: PX4 Autopilot
mavros-1  | [mavros_node-1] [INFO] [1720433713.242733867] [mavros.mission]: WP: detected enable_partial_push: 0
mavros-1  | [mavros_node-1] [INFO] [1720433713.242846134] [mavros.mavros_router]: link[1001] detected remote address 1.191
mavros-1  | [mavros_node-1] [INFO] [1720433713.242890310] [mavros.imu]: IMU: High resolution IMU detected!
mavros-1  | [mavros_node-1] [INFO] [1720433713.258227516] [mavros.imu]: IMU: Attitude quaternion IMU detected!
mavros-1  | [mavros_node-1] [INFO] [1720433713.329696138] [mavros.mavros_router]: link[1000] detected remote address 255.190
mavros-1  | [mavros_node-1] [INFO] [1720433714.247140609] [mavros.geofence]: GF: Using MISSION_ITEM_INT
mavros-1  | [mavros_node-1] [INFO] [1720433714.247194919] [mavros.rallypoint]: RP: Using MISSION_ITEM_INT
mavros-1  | [mavros_node-1] [INFO] [1720433714.247215000] [mavros.mission]: WP: Using MISSION_ITEM_INT
mavros-1  | [mavros_node-1] [INFO] [1720433714.247230568] [mavros.sys]: VER: 1.1: Capabilities         0x000000000000e8ff
mavros-1  | [mavros_node-1] [INFO] [1720433714.247251010] [mavros.sys]: VER: 1.1: Flight software:     010f0080 (e04c53241a000000)
mavros-1  | [mavros_node-1] [INFO] [1720433714.247265326] [mavros.sys]: VER: 1.1: Middleware software: 010f0080 (e04c53241a000000)
mavros-1  | [mavros_node-1] [INFO] [1720433714.247277602] [mavros.sys]: VER: 1.1: OS software:         060800ff (d72688cba1396c88)
mavros-1  | [mavros_node-1] [INFO] [1720433714.247289068] [mavros.sys]: VER: 1.1: Board hardware:      00000001
mavros-1  | [mavros_node-1] [INFO] [1720433714.247300436] [mavros.sys]: VER: 1.1: VID/PID:             0000:0000
mavros-1  | [mavros_node-1] [INFO] [1720433714.247312877] [mavros.sys]: VER: 1.1: UID:                 4954414c44494e4f
mavros-1  | [mavros_node-1] [WARN] [1720433714.251114484] [mavros.cmd]: CMD: Unexpected command 520, result 0

However, I still can't subscribe to the nodes from other docker containers.

From the mavros container I can run

$ ros2 topic echo --once /mavros/battery
header:
  stamp:
    sec: 1720433951
    nanosec: 382872205
  frame_id: ''
voltage: 15.30000114440918
temperature: 0.0
current: 1.0
charge: .nan
capacity: .nan
design_capacity: .nan
percentage: 0.5
power_supply_status: 2
power_supply_health: 0
power_supply_technology: 3
present: true
cell_voltage:
- 15.30000114440918
cell_temperature: []
location: id0
serial_number: ''
---

but this just hangs from another container. Likewise, RQT node viewer (run from another container with --net=host) does not show anything even under `Nodes/Topics (all) mode.

Diagnostics

$ ros2 topic echo --once /diagnostics
header:
  stamp:
    sec: 1720434275
    nanosec: 887429415
  frame_id: ''
status:
- level: "\0"
  name: 'mavros_router: MAVROS Router'
  message: ok
  hardware_id: none
  values:
  - key: Endpoints
    value: '2'
  - key: Messages routed
    value: '257960'
  - key: Messages sent
    value: '257960'
  - key: Messages dropped
    value: '0'
- level: "\0"
  name: 'mavros_router: endpoint 1000: udp://0.0.0.0:14540@'
  message: ok
  hardware_id: none
  values:
  - key: Received packets
    value: '48969'
  - key: Dropped packets
    value: '0'
  - key: Buffer overruns
    value: '0'
  - key: Parse errors
    value: '0'
  - key: Rx sequence number
    value: '42'
  - key: Tx sequence number
    value: '0'
  - key: Rx total bytes
    value: '14678559'
  - key: Tx total bytes
    value: '320782'
  - key: Rx speed
    value: inf
  - key: Tx speed
    value: inf
  - key: Remotes count
    value: '5'
  - key: Remote [0]
    value: '0.0'
  - key: Remote [1]
    value: '1.0'
  - key: Remote [2]
    value: '1.1'
  - key: Remote [3]
    value: '255.0'
  - key: Remote [4]
    value: '255.190'
- level: "\0"
  name: 'mavros_router: endpoint 1001: /uas1'
  message: ok
  hardware_id: none
  values:
  - key: Remotes count
    value: '3'
  - key: Remote [0]
    value: '0.0'
  - key: Remote [1]
    value: '1.0'
  - key: Remote [2]
    value: '1.191'
---
iwishiwasaneagle commented 4 months ago

This issue was related to FastDDS when using localhost (see https://github.com/eProsima/Fast-DDS/issues/2956 and https://github.com/eProsima/Fast-DDS/issues/3475). Adding

ipc "host"
pid: "host"

solved this.