# Need help connecting companion computer using Ethernet on RPi

**URL:** <https://discuss.px4.io/t/need-help-connecting-companion-computer-using-ethernet-on-rpi/42247>\
**Category:** ROS 1 / ROS 2\
**Created:** [November 1, 2024, 4:19pm UTC](https://discuss.px4.io/t/need-help-connecting-companion-computer-using-ethernet-on-rpi/42247 "2024-11-01T16:19:39Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![psvs](https://discuss.px4.io/letter_avatar_proxy/v4/letter/p/839c29/32.png) [@psvs](https://discuss.px4.io/u/psvs)\
**Post date:** [November 1, 2024, 4:19pm UTC](https://discuss.px4.io/t/need-help-connecting-companion-computer-using-ethernet-on-rpi/42247/1 "2024-11-01T16:19:39Z")

</div>

Hi guys, I am trying to connect my autopilot with my companion computer using the ethernet cable.

**Details of the hardware:**  
Autopilot: Pixhawk 6x with firmware version 1.15.1  
Companion computer: Raspberry Pi 4B running Ubuntu 24.04  
Connected using an Ethernet cable

I have followed the steps from [https://docs.px4.io/main/en/advanced\_config/ethernet\_setup.html#ros-2-setup-example](https://docs.px4.io/main/en/advanced_config/ethernet_setup.html#ros-2-setup-example) and [https://px4.io/get-the-pixhawk-raspberry-pi-cm4-baseboard-by-holybro-talking-with-px4/](https://px4.io/get-the-pixhawk-raspberry-pi-cm4-baseboard-by-holybro-talking-with-px4/).  
However, XRCE-Agent is unable to communicate with the client.

```auto
uavpi2@raspberrypi:~$ MicroXRCEAgent udp4 -p 8888
[1727457933.486357] info | UDPv4AgentLinux.cpp | init | running... | port: 8888
[1727457933.487239] info | Root.cpp | set_verbose_level | logger setup | verbose_level: 4

```

On the client side, I get:

```auto
uxrce_dds_client status
INFO [uxrce_dds_client] Running, disconnected
INFO [uxrce_dds_client] Using transport: udp
INFO [uxrce_dds_client] Agent IP: 10.41.10.1
INFO [uxrce_dds_client] Agent port: 8888
INFO [uxrce_dds_client] Custom participant: no
INFO [uxrce_dds_client] Localhost only: no
INFO [uxrce_dds_client] timesync converged: false
uxrce_dds_client: cycle: 0 events, 0us elapsed, 0.00us avg, min 0us max 0us 0.000us rms
uxrce_dds_client: cycle interval: 0 events, 0.00us avg, min 0us max 0us 0.000us rms

```

Also, I am able to ping from both the devices.

```auto
nsh> ping 10.41.10.1
PING 10.41.10.1 56 bytes of data
56 bytes from 10.41.10.1: icmp_seq=0 time=0.0 ms
56 bytes from 10.41.10.1: icmp_seq=1 time=0.0 ms
56 bytes from 10.41.10.1: icmp_seq=2 time=0.0 ms
56 bytes from 10.41.10.1: icmp_seq=3 time=0.0 ms
56 bytes from 10.41.10.1: icmp_seq=4 time=1.0 ms
56 bytes from 10.41.10.1: icmp_seq=5 time=1.0 ms
56 bytes from 10.41.10.1: icmp_seq=6 time=0.0 ms
56 bytes from 10.41.10.1: icmp_seq=7 time=0.0 ms
56 bytes from 10.41.10.1: icmp_seq=8 time=0.0 ms
56 bytes from 10.41.10.1: icmp_seq=9 time=0.0 ms
10 packets transmitted, 10 received, 0% packet loss, time 10010 ms
rtt min/avg/max/mdev = 0.000/0.200/1.000/0.400 ms

```

```auto
uavpi2@raspberrypi:~$ ping 10.41.10.2
PING 10.41.10.2 (10.41.10.2) 56(84) bytes of data.
64 bytes from 10.41.10.2: icmp_seq=1 ttl=64 time=0.577 ms
64 bytes from 10.41.10.2: icmp_seq=2 ttl=64 time=0.157 ms
64 bytes from 10.41.10.2: icmp_seq=3 ttl=64 time=1.34 ms
^C
--- 10.41.10.2 ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2083ms
rtt min/avg/max/mdev = 0.157/0.692/1.344/0.491 ms

```

My IP settings on the client (autopilot)

```auto
nsh> netman show
DEVICE=eth0
BOOTPROTO=fallback
NETMASK=255.255.255.0
IPADDR=10.41.10.2
ROUTER=10.41.10.254
DNS=10.41.10.254

```

My IP settings on the agent (companion computer)

```auto
uavpi2@raspberrypi:~$ ifconfig
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
        inet 10.41.10.1 netmask 255.255.255.0 broadcast 10.41.10.255
        inet6 fe80::a263:3d00:389b:3425 prefixlen 64 scopeid 0x20<link>
        ether e4:5f:01:ca:97:5c txqueuelen 1000 (Ethernet)
        RX packets 5043 bytes 332097 (332.0 KB)
        RX errors 0 dropped 0 overruns 0 frame 0
        TX packets 301 bytes 17282 (17.2 KB)
        TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

```

Also my MAV2 settings are

 ![Screenshot from 2024-11-01 21-52-23](https://discuss.px4.io/uploads/default/original/3X/1/b/1bdb2eda6d4ea33fb23abf560845cc62b63b119e.png)

Can someone please help me establish the XRCE communication?

---

<div class="post-metadata">

**Author:** ![farhang](https://discuss.px4.io/user_avatar/discuss.px4.io/farhang/32/17881_2.png) [@farhang](https://discuss.px4.io/u/farhang)\
**Post date:** [November 1, 2024, 8:21pm UTC](https://discuss.px4.io/t/need-help-connecting-companion-computer-using-ethernet-on-rpi/42247/2 "2024-11-01T20:21:34Z")

</div>

Hey,

Thanks for bringing this up! I need to update the [docs](https://docs.px4.io/main/en/companion_computer/holybro_pixhawk_rpi_cm4_baseboard.html) for that.

Meanwhile, could you try to see if Jetson docs work?

> **[Holybro Pixhawk Jetson Baseboard | PX4 Guide (main)](https://docs.px4.io/main/en/companion_computer/holybro_pixhawk_jetson_baseboard.html#xrce-client-serial-port-setup)**
>
> PX4 User and Developer Guide

There should be a trick here probably. RPi does not have internal switch so I need to reproduce this and see how you should set the network up.

Plz let me know how it goes!

---

<div class="post-metadata">

**Author:** ![psvs](https://discuss.px4.io/letter_avatar_proxy/v4/letter/p/839c29/32.png) [@psvs](https://discuss.px4.io/u/psvs)\
**Post date:** [November 1, 2024, 9:18pm UTC](https://discuss.px4.io/t/need-help-connecting-companion-computer-using-ethernet-on-rpi/42247/3 "2024-11-01T21:18:56Z")

</div>

Hi! Thanks for replying.  
I have gone through the docs, and I believe I have implemented it as it is described, except for the place where I did not disable MAVLink on the PX4 `Ethernet` port.  
I have corrected this. However, the issue still persists.

```auto
uavpi2@raspberrypi:~$ MicroXRCEAgent udp4 -p 8888
[1727459881.812800] info | UDPv4AgentLinux.cpp | init | running... | port: 8888
[1727459881.815358] info | Root.cpp | set_verbose_level | logger setup | verbose_level: 4

```

The updated parameters are:

 ![Screenshot from 2024-11-02 02-46-27](https://discuss.px4.io/uploads/default/original/3X/c/e/cee68b05c24040e076682c05655aeb769ff8aa54.png)

 ![Screenshot from 2024-11-02 02-46-36](https://discuss.px4.io/uploads/default/original/3X/c/7/c73cb970721cba79dabc908a721be8ed405936ed.png)

---

<div class="post-metadata">

**Author:** ![farhang](https://discuss.px4.io/user_avatar/discuss.px4.io/farhang/32/17881_2.png) [@farhang](https://discuss.px4.io/u/farhang)\
**Post date:** [November 2, 2024, 8:29pm UTC](https://discuss.px4.io/t/need-help-connecting-companion-computer-using-ethernet-on-rpi/42247/4 "2024-11-02T20:29:33Z")

</div>

could you share the output of `dmesg` on nuttx shell and output of `ip route` on your pi?

The next step you can try:

- Disable `UAVCAN_ENABLE` by setting it to 0 and reboot Pixhawk see if the agent loads correctly.

---

<div class="post-metadata">

**Author:** ![psvs](https://discuss.px4.io/letter_avatar_proxy/v4/letter/p/839c29/32.png) [@psvs](https://discuss.px4.io/u/psvs)\
**Post date:** [November 2, 2024, 8:58pm UTC](https://discuss.px4.io/t/need-help-connecting-companion-computer-using-ethernet-on-rpi/42247/5 "2024-11-02T20:58:23Z")

</div>

Here is the output from Nuttx shell

```auto
nsh> dmesg
HW arch: PX4_FMU_V6X
HW type: V6X
HW FMUM ID: 0x008
HW BASE ID: 0x000
PX4 git-hash: 93eef0c78719a9ac972d46593262c76c978ed3c4
PX4 version: 1.15.1 0 (17760512)
OS: NuttX
OS version: Release 11.0.0 (184549631)
OS git-hash: 5d74bc138955e6f010a38e0f87f34e9a9019aecc
Build datetime: Oct 27 2024 15:57:00
Build uri: localhost
Build variant: default
Toolchain: GNU GCC, 13.2.1 20231009
PX4GUID: 000600000000303736303532510c00480020
MCU: STM32H7[4|5]xxx, rev. V
INFO [param] selected parameter default file /fs/mtd_params
INFO [param] importing from '/fs/mtd_params'
INFO [parameters] BSON document size 3220 bytes, decoded 3220 bytes (INT32:66, FLOAT:89)
INFO [param] selected parameter backup file /fs/microsd/parameters_backup.bson
Board architecture defaults: /etc/init.d/rc.board_arch_defaults
Board defaults: /etc/init.d/rc.board_defaults
Loading airframe: /etc/init.d/airframes/4001_quad_x
INFO [dataman] data manager file '/fs/microsd/dataman' size is 68528 bytes
INFO [px4io] IO FW CRC match
Board sensors: /etc/init.d/rc.board_sensors
icm45686 #0 on SPI bus 3
icm45686 #1 on SPI bus 2
icm45686 #2 on SPI bus 1 rotation 10
bmm150 #0 on I2C bus 4 (external) address 0x10
WARN [SPI_I2C] ist8310: no instance started (no device on bus?)
icp201xx #0 on I2C bus 4 (external) address 0x64
bmp388 #0 on I2C bus 2 (external) address 0x76
WARN [SPI_I2C] ms5611: no instance started (no device on bus?)
WARN [vehicle_angular_velocity] no gyro selected, using sensor_gyro_fifo:0 3407898
ekf2 [558:237]
Board mavlink: /etc/init.d/rc.board_mavlink
Starting Main GPS on /dev/ttyS7
Starting MAVLink on /dev/ttyS6
INFO [mavlink] mode: Normal, data rate: 1200 B/s on /dev/ttyS6 @ 57600B
Starting UXRCE-DDS Client on ethernet
INFO [uxrce_dds_client] init UDP agent IP:10.41.10.1, port:8888
INFO [cdcacm_autostart] Starting CDC/ACM autostart
INFO [logger] logger started (mode=all)
INFO [uavcan] Node ID 1, bitrate 1000000

NuttShell (NSH) NuttX-11.0.0
nsh> sercon: Registering CDC/ACM serial driver
sercon: Successfully registered the CDC/ACM serial driver
WARN [health_and_arming_checks] Preflight Fail: No connection to the ground control station    
INFO [cdcacm_autostart] Starting mavlink on /dev/ttyACM0 (SYS_USB_AUTO=2)
INFO [mavlink] mode: Onboard, data rate: 100000 B/s on /dev/ttyACM0 @ 2000000B
INFO [mavlink] Starting mavlink shell

```

and here is the output from rpi

```auto
uavpi2@raspberrypi:~$ ip route
default via 10.41.10.254 dev eth0 proto static metric 100 
default via 192.168.41.176 dev wlan0 proto dhcp src 192.168.41.2 metric 600 
10.41.10.0/24 dev eth0 proto kernel scope link src 10.41.10.1 metric 100 
192.168.41.0/24 dev wlan0 proto kernel scope link src 192.168.41.2 metric 600

```

I have tried disabling `UAVCAN` and rebooting Pixhawk, but nothing has changed on the agent side.

---

<div class="post-metadata">

**Author:** ![farhang](https://discuss.px4.io/user_avatar/discuss.px4.io/farhang/32/17881_2.png) [@farhang](https://discuss.px4.io/u/farhang)\
**Post date:** [November 3, 2024, 1:50am UTC](https://discuss.px4.io/t/need-help-connecting-companion-computer-using-ethernet-on-rpi/42247/6 "2024-11-03T01:50:43Z")

</div>

could you enable your mavlink instance for ethernet?

---

<div class="post-metadata">

**Author:** ![psvs](https://discuss.px4.io/letter_avatar_proxy/v4/letter/p/839c29/32.png) [@psvs](https://discuss.px4.io/u/psvs)\
**Post date:** [November 3, 2024, 1:26pm UTC](https://discuss.px4.io/t/need-help-connecting-companion-computer-using-ethernet-on-rpi/42247/7 "2024-11-03T13:26:25Z")

</div>

I’ve tried that.

```auto
nsh> mavlink status

instance #0:
    mavlink chan: #0
    type: GENERIC LINK OR RADIO
    flow control: ON
    rates:
      tx: 781.2 B/s
      txerr: 0.0 B/s
      tx rate mult: 0.329
      tx rate max: 1200 B/s
      rx: 0.0 B/s
      rx loss: 0.0%
    FTP enabled: YES, TX enabled: YES
    mode: Normal
    Forwarding: On
    MAVLink version: 1
    transport protocol: serial (/dev/ttyS6 @57600)

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

instance #2:
    GCS heartbeat valid
    mavlink chan: #2
    type: USB CDC
    flow control: ON
    rates:
      tx: 21228.4 B/s
      txerr: 0.0 B/s
      tx rate mult: 1.000
      tx rate max: 100000 B/s
      rx: 621.2 B/s
      rx loss: 0.0%
    Received Messages:
      sysid:255, compid:190, Total: 17532 (lost: 0)
        msgid: 126, Rate: 0.1 Hz, last 0.04s ago
        msgid: 4, Rate: 1.0 Hz, last 0.66s ago
        msgid: 0, Rate: 1.0 Hz, last 0.39s ago
        msgid: 69, Rate: 25.0 Hz, last 0.06s ago
    FTP enabled: YES, TX enabled: YES
    mode: Onboard
    Forwarding: On
    MAVLink version: 2
    transport protocol: serial (/dev/ttyACM0 @2000000)
    ping statistics:
      last: 1.12 ms
      mean: 1.01 ms
      max: 21.32 ms
      min: 0.16 ms
      dropped packets: 0

```

---

<div class="post-metadata">

**Author:** ![psvs](https://discuss.px4.io/letter_avatar_proxy/v4/letter/p/839c29/32.png) [@psvs](https://discuss.px4.io/u/psvs)\
**Post date:** [November 3, 2024, 1:38pm UTC](https://discuss.px4.io/t/need-help-connecting-companion-computer-using-ethernet-on-rpi/42247/8 "2024-11-03T13:38:41Z")

</div>

I have also tried testing with the [all\_params](https://github.com/mavlink/MAVSDK-Python/blob/e69aab8213918e6947453e764aac639d764b6fa4/examples/all_params.py) file mavsdk. Even that was not working.

```auto
uavpi2@raspberrypi:~/tests$ python3 all_params.py 

```

---

<div class="post-metadata">

**Author:** ![farhang](https://discuss.px4.io/user_avatar/discuss.px4.io/farhang/32/17881_2.png) [@farhang](https://discuss.px4.io/u/farhang)\
**Post date:** [November 3, 2024, 9:12pm UTC](https://discuss.px4.io/t/need-help-connecting-companion-computer-using-ethernet-on-rpi/42247/9 "2024-11-03T21:12:20Z")

</div>

`sudo ip route del default via 10.41.10.254 dev eth0`

This first route does not seem right. Please also try the command above and lmk. Just be sure you don have it appearing again. This will do a momentary removal of that route.

So you may want to check again your `ip route` after.

---

<div class="post-metadata">

**Author:** ![psvs](https://discuss.px4.io/letter_avatar_proxy/v4/letter/p/839c29/32.png) [@psvs](https://discuss.px4.io/u/psvs)\
**Post date:** [November 4, 2024, 8:15am UTC](https://discuss.px4.io/t/need-help-connecting-companion-computer-using-ethernet-on-rpi/42247/10 "2024-11-04T08:15:13Z")

</div>

Hey, I’ve tried that. But didn’t work out.

_I found the issue, though. It seems my firewall was blocking the udp traffic. I created a rule to allow the traffic, and it worked._

Also, there seems to be an error in the [PX4 documentation](https://docs.px4.io/main/en/advanced_config/ethernet_setup.html#px4-mavlink-serial-port-configuration).

```auto
network:
  version: 2
  renderer: NetworkManager
  ethernets:
      enp2s0:
          addresses:
              - 10.41.10.1/24
          nameservers:
              addresses: [10.41.10.1]
          routes:
              - to: 10.41.10.1
                via: 10.41.10.1

```

The route destination should be `0.0.0.0/0` instead of `10.41.10.1`. Please confirm.

Thanks again for your inputs.

---

<div class="post-metadata">

**Author:** ![farhang](https://discuss.px4.io/user_avatar/discuss.px4.io/farhang/32/17881_2.png) [@farhang](https://discuss.px4.io/u/farhang)\
**Post date:** [November 4, 2024, 2:55pm UTC](https://discuss.px4.io/t/need-help-connecting-companion-computer-using-ethernet-on-rpi/42247/11 "2024-11-04T14:55:55Z")

</div>

Thank you,

But you mentioned you followed [Jetson Docs](https://docs.px4.io/main/en/companion_computer/holybro_pixhawk_jetson_baseboard.html#ethernet-setup-using-netplan) as well, right?

I think it is same as what you mentioned which is same as removing the route tempoarily from the command I mentioned earlier.

I will update the docs.

---

<div class="post-metadata">

**Author:** ![psvs](https://discuss.px4.io/letter_avatar_proxy/v4/letter/p/839c29/32.png) [@psvs](https://discuss.px4.io/u/psvs)\
**Post date:** [November 4, 2024, 3:17pm UTC](https://discuss.px4.io/t/need-help-connecting-companion-computer-using-ethernet-on-rpi/42247/12 "2024-11-04T15:17:14Z")

</div>

Yeah, the documentation in [jetson docs](https://docs.px4.io/main/en/companion_computer/holybro_pixhawk_jetson_baseboard.html#ethernet-setup-using-netplan) is fine. I was able to ping from both devices following that. In my case firewall was the issue.

---

<div class="post-metadata">

**Author:** ![rroche](https://discuss.px4.io/user_avatar/discuss.px4.io/rroche/32/17635_2.png) [@rroche](https://discuss.px4.io/u/rroche)\
**Post date:** [November 4, 2024, 4:31pm UTC](https://discuss.px4.io/t/need-help-connecting-companion-computer-using-ethernet-on-rpi/42247/13 "2024-11-04T16:31:22Z")

</div>


