# VOXL-CAM is not connecting to QGC through UDP

Source: https://forum.modalai.com/topic/1235/voxl-cam-is-not-connecting-to-qgc-through-udp
Category: Flight Core and Legacy VOXL (https://forum.modalai.com/category/9/flight-core-and-legacy-voxl)
Tags: voxl-cam
Posted: 2022-08-24 09:48:33 UTC by Anubhav
Replies: 9 · Views: 1782

## Anubhav · 2022-08-24 09:48:33 UTC

Hi, 

I am trying to connect my voxl-cam to QGC through UDP but it's not getting connected, but getting connected through usb-jst connector after enabling pixhwak device in QGC. I have also ensured to restart voxl-vision-px4 and mavlink-server in voxl after starting QGC, and also made sure IP of host computer is same in voxl-vision-px4.conf. 

1.voxl-cam IP:

```
voxl:~$ ifconfig
lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:56 errors:0 dropped:0 overruns:0 frame:0
          TX packets:56 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:4568 (4.4 KiB)  TX bytes:4568 (4.4 KiB)

wlan0     Link encap:Ethernet  HWaddr 18:47:3D:B1:C3:97  
          inet addr:192.168.1.25  Bcast:192.168.1.255  Mask:255.255.255.0
          inet6 addr: fe80::1a47:3dff:feb1:c397/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:5658 errors:0 dropped:0 overruns:0 frame:0
          TX packets:1903 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:3000 
          RX bytes:417901 (408.1 KiB)  TX bytes:305791 (298.6 KiB)

```
2. Host Computer IP:
```
anubhav@anubhav-GF63-Thin-9SC:~$ ifconfig
docker0: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
        inet 172.17.0.1  netmask 255.255.0.0  broadcast 172.17.255.255
        ether 02:42:96:95:a4:c4  txqueuelen 0  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

enp3s0: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
        ether 00:d8:61:e2:a7:ea  txqueuelen 1000  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 1000  (Local Loopback)
        RX packets 25312  bytes 2340106 (2.3 MB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 25312  bytes 2340106 (2.3 MB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

wlo1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.1.27  netmask 255.255.255.0  broadcast 192.168.1.255
        inet6 fe80::2402:5fde:9588:ae6c  prefixlen 64  scopeid 0x20<link>
        ether 0c:7a:15:e2:60:44  txqueuelen 1000  (Ethernet)
        RX packets 245416  bytes 129734829 (129.7 MB)
        RX errors 0  dropped 5  overruns 0  frame 0
        TX packets 181430  bytes 36023858 (36.0 MB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

```
3. IP of QGC mentioned in voxl-vision-px4.conf 
```
voxl:~$ cat /etc/modalai/voxl-vision-px4.conf 
/**
 * VOXL Vision PX4 Configuration File
 *
 */
{
	"qgc_ip":	"192.168.1.27",
	"en_localhost_mavlink_udp":	true,
	"en_secondary_qgc":	false,
	"secondary_qgc_ip":	"192.168.1.214",
	"qgc_udp_port_number":	14550,
	"localhost_udp_port_number":	14551,
	"udp_mtu":	512,
	"en_vio":	true,
	"en_voa":	true,
	"en_send_vio_to_qgc":	false,
	"en_send_voa_to_qgc":	false,
	"en_set_clock_from_gps":	true,
	"en_force_onboard_mav1_mode":	true,
	"en_reset_px4_on_error":	true,
	"qvio_auto_reset_quality":	0.00050000002374872565,
	"horizon_cal_tolerance":	0.300000011920929,
	"voa_upper_bound_m":	-0.15000000596046448,
	"voa_lower_bound_m":	0.15000000596046448,
	"offboard_mode":	"figure_eight",
	"follow_tag_id":	0,
	"figure_eight_move_home":	true,
	"en_tag_fixed_frame":	false,
	"fixed_frame_filter_len":	5,
	"en_transform_mavlink_pos_setpoints_from_fixed_frame":	false
}

```
Can tell me how can I solve this problem?

## Reply by Anubhav · 2022-08-25 06:09:33 UTC

@Matthew-Booker 
Hi, 
we have followed the tutorial 'https://docs.modalai.com/voxl-vision-px4-telemetry/' and in the you tube link attached 'https://youtu.be/gaV4ubIYFzs' we noticed the message 'Added new UDP connection to IP'.
when we executed the command 'voxl-vision-px4 --debug_udp_recv' we didn't get the above message.

```
voxl:~$ voxl-vision-px4 --debug_udp_recv
Enabling UDP recv debugging
loading our own config file
=================================================================
Parameters as loaded from config file:
qgc_ip:                     192.168.1.27
en_localhost_mavlink_udp    1
en_secondary_qgc:           0
secondary_qgc_ip:           192.168.1.214
qgc_udp_port_number:        14550
localhost_udp_port_number:  14551
udp_mtu:                    512
en_vio:                     1
en_voa:                     1
en_send_vio_to_qgc:         1
en_send_voa_to_qgc:         0
en_set_clock_from_gps:      1
en_force_onboard_mav1_mode: 1
en_reset_px4_on_error:      1
qvio_auto_reset_quality:    0.000500
horizon_cal_tolerance:      0.300000
voa_upper_bound_m:          -0.150000
voa_lower_bound_m:          0.150000
offboard_mode:              figure_eight
follow_tag_id:              0
figure_eight_move_home:     1
en_tag_fixed_frame:         0
fixed_frame_filter_len:     5
en_transform_mavlink_pos_setpoints_from_fixed_frame:0
=================================================================
loading extrinsics config file
exising instance of voxl-vision-px4 found, attempting to stop it
starting geometry module
starting px4 monitor
starting px4 mavlink
starting udp mavlink
Adding manual QGC IP address to udp connection list: 192.168.1.27
Added new UDP connection to 192.168.1.27
starting px4 shell
starting fixed pose input
starting vio manager
starting tag manager
starting voa manager
starting offboard figure eight
starting control input pipe
Init complete, entering main loop
Connected to voxl-mavlink-server
Connected to voxl-dfs-server
Connected to voxl-qvio-server
updating to use imu: imu1
done updating transforms to use imu: imu1
Connected to TOF
UDP recv msg ID:   0 sysid:255 from port: 14550 IP: 192.168.1.27 
UDP recv msg ID:   0 sysid:255 from port: 14550 IP: 192.168.1.27 
UDP recv msg ID:   0 sysid:255 from port: 14550 IP: 192.168.1.27 
UDP recv msg ID:   0 sysid:255 from port: 14550 IP: 192.168.1.27 
UDP recv msg ID:   0 sysid:255 from port: 14550 IP: 192.168.1.27 

```
But we were able to ping the Ip's of both voxl-cam and host pc.

How do we rectify it?

## Reply by Anubhav · 2022-08-25 09:52:33 UTC

@tom 
I have already followed the thread given [here](https://forum.modalai.com/topic/186/voxl-not-connecting-to-qgc/3?_=1661439207245)
Here is my output of the command ```systemctl status -l voxl-vision-px4```
```
voxl:~$ systemctl status -l voxl-vision-px4
● voxl-vision-px4.service - voxl-vision-px4
   Loaded: loaded (/usr/bin/voxl-vision-px4; enabled; vendor preset: enabled)
   Active: active (running) since Thu 1970-01-01 00:00:07 UTC; 1min 29s ago
 Main PID: 2029 (voxl-vision-px4)
   CGroup: /system.slice/voxl-vision-px4.service
           └─2029 /usr/bin/voxl-vision-px4

Jan 01 00:00:09 apq8096 voxl-vision-px4[2029]: Connected to voxl-qvio-server
Jan 01 00:00:09 apq8096 voxl-vision-px4[2029]: updating to use imu: imu1
Jan 01 00:00:09 apq8096 voxl-vision-px4[2029]: done updating transforms to use imu: imu1
Jan 01 00:00:09 apq8096 voxl-vision-px4[2029]: Connected to voxl-dfs-server
Jan 01 00:00:09 apq8096 voxl-vision-px4[2029]: Connected to voxl-mavlink-server
Jan 01 00:00:10 apq8096 voxl-vision-px4[2029]: VIO reported failure
Jan 01 00:01:10 apq8096 voxl-vision-px4[2029]: Disconnected from voxl-qvio-server
Jan 01 00:01:11 apq8096 voxl-vision-px4[2029]: Connected to voxl-qvio-server
Jan 01 00:01:11 apq8096 voxl-vision-px4[2029]: updating to use imu: imu1
Jan 01 00:01:11 apq8096 voxl-vision-px4[2029]: done updating transforms to use imu: imu1

```
And I have already disabled my system firewall. 
```
anubhav@anubhav-GF63-Thin-9SC:~$ sudo ufw status
[sudo] password for anubhav: 
Status: inactive

```
and also tried flashing firmware again.
Still it's not getting connected to QGC.

QGC output in terminal

```
anubhav@anubhav-GF63-Thin-9SC:~/Downloads$ ./QGroundControl.AppImage 
Settings location "/home/anubhav/.config/QGroundControl.org/QGroundControl.ini" Is writable?: true
Filter rules "*Log.debug=false\nGStreamerAPILog.debug=true\nqt.qml.connections=false"
System reported locale: QLocale(English, Latin, India) ; Name "en_IN" ; Preffered (used in maps):  "en-IN"
LocalizationLog: Qt lib localization for "en_IN" is not present
LocalizationLog: Error loading source localization for "en_IN"
LocalizationLog: Error loading json localization for "en_IN"
serialnmea: No known GPS device found. Specify the COM port via QT_NMEA_SERIAL_PORT.
VideoReceiverLog: Stop called on empty URI
VideoReceiverLog: Stop called on empty URI
MAVLinkLogManagerLog: MAVLink logs directory: "/home/anubhav/Documents/QGroundControl/Logs"
Map Cache in: "/home/anubhav/.cache/QGCMapCache300" / "qgcMapCache.db"
qml: QGCCorePlugin(0x5644b7af97a0) []
setCurrentPlanViewSeqNum
setCurrentPlanViewSeqNum
_recalcFlightPathSegments homePositionValid false
_recalcFlightPathSegments homePositionValid false
Adding target QHostAddress("192.168.1.26") 14550
"v4.2.0"

```

## Reply by Anubhav · 2022-08-29 03:26:20 UTC

Anyone knows how to rectify above problem, please help. 
Thank you.

## Reply by modaltb (ModalAI staff) · 2022-08-30 15:52:36 UTC

@Anubhav ,

What about checking `voxl-inspect-services` and check for the `voxl-mavlink-server` ?

https://gitlab.com/voxl-public/voxl-sdk/services/voxl-mavlink-server

There's a `voxl-configure-mavlink-server` that can be used if not running.

## Reply by Anubhav · 2022-08-30 18:25:27 UTC

Hi @modaltb,
I had checked for voxl-mavlink-server in voxl-inspect-services, it was enabled and running. also configured both voxl-mavlink-server and voxl-vision-px4 but it didn't got connected to QGC through UDP.

## Reply by Anubhav · 2022-08-31 13:49:43 UTC

Hi @modaltb,
As mentioned [here](https://gitlab.com/voxl-public/voxl-sdk/services/voxl-mavlink-server) I have deployed the voxl-mavlink-server in voxl-cam, I used following command in voxl-cross
```./install_build_deps.sh apq8096 staging``` 
```./build.sh apq8096```
```./make_package.sh ipk```
and at last successfully deployed it to voxl-cam .
I have run "voxl-mavlink-server" command and it's showing **"PX4 is disconnected from UART"** . output is attached below.
```
voxl:~$ voxl-mavlink-server 
loading our own config file
=================================================================
Parameters as loaded from config file:
px4_uart_bus:               5
px4_uart_baudrate:          921600
udp_port_to_px4:            14556
udp_port_from_px4:          14557
=================================================================
exising instance of voxl-mavlink-server found, attempting to stop it
Successfully opened mavparser
Init complete, entering main loop
PX4 DISCONNECTED FROM UART

```
**Is because of this issue voxl-cam is not connecting to QGC over UDP?**

This is the first time I run ```voxl-mavlink-server``` command previous to this I was using ```
systemctl start voxl-mavlink-server``` and in ```voxl-inspect-services``` it used to show voxl-mavlink-server is runnig. and I didn't get message PX4 DISCONNECTED FROM UART when I run ```
voxl-vision-px4 --debug_udp_recv```.
Below I have attached output of ```voxl-vision-px4 --debug_udp_recv``` 

```
voxl:~$ voxl-vision-px4 --debug_udp_recv
Enabling UDP recv debugging
detected platform APQ8096
loading our own config file
=================================================================
Parameters as loaded from config file:
config file version:        1
qgc_ip:                     192.168.1.27
en_secondary_qgc:           0
secondary_qgc_ip:           192.168.1.214
qgc_udp_port_number:        14550
udp_mtu:                    512
en_localhost_mavlink_udp    1
localhost_udp_port_number:  14551
en_vio:                     1
en_voa:                     1
en_send_vio_to_qgc:         0
en_send_voa_to_qgc:         0
voa_upper_bound_m:          -0.150000
voa_lower_bound_m:          0.150000
en_set_clock_from_gps:      1
en_force_onboard_mav1_mode: 1
en_reset_px4_on_error:      1
qvio_auto_reset_quality:    0.000500
horizon_cal_tolerance:      0.300000
offboard_mode:              figure_eight
follow_tag_id:              0
figure_eight_move_home:     1
en_tag_fixed_frame:         0
fixed_frame_filter_len:     5
en_transform_mavlink_pos_setpoints_from_fixed_frame:0
=================================================================
loading extrinsics config file
starting geometry module
starting px4 monitor
starting px4 mavlink
Connected to voxl-mavlink-server
starting udp mavlink
Adding manual QGC IP address to udp connection list: 192.168.1.27
Added new UDP connection to 192.168.1.27
starting px4 shell
starting fixed pose input
starting vio manager
Connected to voxl-qvio-server
updating to use imu: imu1
done updating transforms to use imu: imu1
starting tag manager
starting voa manager
ERROR validating VIO data received through pipe: read partial packet
read 156 bytes, but it should be a multiple of 324
starting offboard figure eight
starting control input pipe
Init complete, entering main loop
Connected to TOF
```

Thanks!

## Reply by modaltb (ModalAI staff) · 2022-08-31 15:16:47 UTC

@Anubhav ,

When you connect the JST to USB cable, and get a connection from QGC to the Flight Core (eg "getting connected through usb-jst connector after enabling pixhwak device in QGC").

Can you go to Analyze Tools > MAVLink Console and run `mavlink status`.

For example, I have a VOXL2 here in this screen shot, and it's connected to a Flight Core, but it's not working yet, as in this case the Flight Core is transmitting data but not receiving data.  I also see that "MAVLink version: 1" is there which to me normally indicates no bi-directional comms has occurred yet.

```
instance #1:
    mavlink chan: #1
    type:        GENERIC LINK OR RADIO
    flow control: ON
    rates:
      tx: 221.9 B/s
      txerr: 0.0 B/s
      tx rate mult: 0.682
      tx rate max: 1200 B/s
      rx: 0.0 B/s
      rx loss: 0.0%
    FTP enabled: YES, TX enabled: YES
    mode: Normal
    MAVLink version: 1
    transport protocol: serial (/dev/ttyS6 @57600)
```
You can also see the serial port used in "transport protocol" `serial (/dev/ttyS6 @57600)` this shows that this MAVLink instance is setup for /dev/ttyS6 --> UART7 --> Flight Core J5 [here](https://docs.modalai.com/flight-core-datasheets-connectors/#j5---telemetry-connector) on my setup.

For me, I enable voxl-mavlink-server on the VOXL side, then I get action, as seen here:

```

instance #1:
    mavlink chan: #1
    type:        GENERIC LINK OR RADIO
    flow control: ON
    rates:
      tx: 20.9 B/s
      txerr: 0.0 B/s
      tx rate mult: 0.682
      tx rate max: 1200 B/s
      rx: 20.9 B/s
      rx loss: 0.0%
      received from sysid: 0 compid: 197: 14, lost: 0, last 292 ms ago
    FTP enabled: YES, TX enabled: YES
    mode: Normal
    MAVLink version: 2
    transport protocol: serial (/dev/ttyS6 @57600)
```

OK, back to VOXL-CAM and your issue (above was shown to you as to how I troubleshoot these connection issues).

**For VOXL-CAM**, the Flight Core connects to the VOXL using [Flight Core J1](https://docs.modalai.com/flight-core-datasheets-connectors/#j1---voxl-communications-interface-connector) which is UART5 / `/dev/ttyS4`

This is TELEM2 by default, and should have the following:
  - MAV_1_CONFIG 102
  - MAV_1_MODE 2
  - SER_TEL2_BAUD 921600

So you should be able to find a mavlink instance after running `mavlink status` and hopefully you see a node with:

``` 
transport protocol: serial (/dev/ttyS4 @921600)
```

## Reply by Anubhav · 2022-09-01 07:17:06 UTC

Hi @modaltb,

I have connected voxl-cam to QGC by enabling pixhawk device in QGC. And run mavlink status command in mavlink console.  I have attached the output below, it's after enabling and starting ```voxl-mavlink-server```.
```
nsh> mavlink status

instance #0:
    GCS heartbeat:    137312 us ago
    mavlink chan: #0
    type:        USB CDC
    flow control: OFF
    rates:
      tx: 21.913 kB/s
      txerr: 0.000 kB/s
      tx rate mult: 1.000
      tx rate max: 800000 B/s
      rx: 0.046 kB/s
    FTP enabled: YES, TX enabled: YES
    mode: Config
    MAVLink version: 2
    transport protocol: serial (/dev/ttyACM0 @2000000)
    ping statistics:
      last: 0.39 ms
      mean: 0.34 ms
      max: 840.70 ms
      min: 0.17 ms
      dropped packets: 0

instance #1:
    mavlink chan: #1
    type:        GENERIC LINK OR RADIO
    flow control: OFF
    rates:
      tx: 0.911 kB/s
      txerr: 0.000 kB/s
      tx rate mult: 1.000
      tx rate max: 1200 B/s
      rx: 0.000 kB/s
    FTP enabled: YES, TX enabled: YES
    mode: Normal
    MAVLink version: 1
    transport protocol: serial (/dev/ttyS6 @57600)

instance #2:
    mavlink chan: #2
    type:        GENERIC LINK OR RADIO
    flow control: ON
    rates:
      tx: 12.740 kB/s
      txerr: 0.000 kB/s
      tx rate mult: 1.000
      tx rate max: 46080 B/s
      rx: 0.000 kB/s
    FTP enabled: YES, TX enabled: YES
    mode: Onboard
    MAVLink version: 1
    transport protocol: serial (/dev/ttyS4 @921600)
```
* For instance #2 I am able to see node with ```transport protocol: serial (/dev/ttyS4 
  @921600)```.
* In instance #2 it's showing MAVLink version: 1. Why in this case there is uni-directional communication? Note: above output is after enabling and starting both ```
voxl-mavlink-server ```and ```voxl-vision-px4```.
* But in instance #0 it's showing MAVLink version: 2. So there is a bi-directional communication when connected to USB-JST connector. Is it right?

I have also tried mavlink status command after enabling both pixhawk and udp devices but the output was same as above.

Thanks!

## Reply by modaltb (ModalAI staff) · 2022-09-01 15:46:31 UTC

This `rx: 0.000 kB/s` instance 2 tells me it's not getting any data from VOXL....   This is the connection that provides that link:

![c24bf1be-8000-458a-9380-a633cdb51ab3-image.png](https://forum.modalai.com/assets/uploads/files/1662047065492-c24bf1be-8000-458a-9380-a633cdb51ab3-image.png) 

Can you confirm that this connection is in place?

You have
```
px4_uart_bus:               5
px4_uart_baudrate:          921600
```

For voxl-mavlink-server which is correct.  5 = BLSP5 = J12 on VOXL1.  It's configured for 921600.  Your Flight Core is configured correctly too.  So the last thing I would think to do is to probe with an oscilliscope if possible on that connector I pointed out and see if you have bi-directional data.
