voxl-mavlink-server GCS udp port
-
Is there any benefit to making the udp port the mavlink server uses to communicate with QGC/the groundstation configurable? Like by loading in a value from the config file else defaulting to 14550
Besides the udp ports used for the mavlink streams to/from px4 and voxl-mavlink-server (14556-14559) are there any other ports used by voxl services? I was probably going to just use 14560 - 14570 unless they're reserved for something else
Reason:
I'm trying to get a multi-vehicle (sentinels w/ latest sdk and microhard network) set up working and I'm noticing weird behavior when I try to connect to multiple vehicles in QGC. They (the vehicles) all have distinct mavlink sys ids and static ips on the same subnet but I noticed they're all using the same udp port to connect to the groundstation (hard coded in voxl-mavlink-server to 14550). I set up separate comm links in QGC for each vehicle with server address = <voxl-microhard-ip>:14550.
When I start up qgc with 4 vehicles running and I try to connect to one of the vehicles it randomly connects to two additional vehicles. Then when I try to connect the remaining vehicle it switches the first vehicles that connect to a "secondary comm link" and the connection profile name gets mapped to the wrong vehicles. When I restart QGC after that it connects to all vehicles at once regardless of which connection profile I connect to and the comm link profile names don't get shown next to the vehicle.
I'm assuming this is happening because they're all sending messages to the same udp port on the gcs pc. Doesn't seem like a big deal at the moment but I feel like it could lead to unexpected behavior if I try to interact with any of the vehicles through QGC. I'm not sure how QGC establishes the connection if it's actually binding a socket to the server address or just broadcasting locally on the designated port
-
@jmltt This sounds more like a QGC issue. Are you sure QGC supports what you are trying to do?
-
@Eric-Katzfey I'm just trying to connect to and monitor multiple vehicles, yes QGC supports that
I tested a modified voxl-mavlink-server with the configurable gcs udp port and assigned separate ports for each vehicle and it resolved the issue.
I don't think it's a qgc issue unless their link manager is designed to differentiate multiple vehicles publishing to the same udp port on the ground station. I can raise the issue on their forum as well though
I'm assuming 14560 - 14580 is a safe range, but is there any way to verify there are no conflicts short of going through every voxl service to check which publish/receive over udp?
-
I just realized you could also probably resolve this issue by leaving the gcs ip addresses blank in the config file for voxl-mavlink-server. That would force QGC to make a server side connection because there wouldn't be any heartbeats on the local port (I think QGC link manager checks local udp port first, hence the auto connection issue).
-
@jmltt Hi Man, so we are also trying to do something similar. We want to change the hard coded UDP port on the voxl crafts, it would be really helpful if you could share the modified voxl-mavlink-server with the configurable gcs udp port which worked for you. Thank you.
-
@ashwin I just added a parameter called qgc_udp_port to config_file.h/c in voxl-mavlink-server (you can use the same syntax as used for any of the other port number variables in the config file to add it) and then added some logic to the gcs_io.c file where it makes the connections and rebuilt voxl-mavlink-server locally. I don't have that version somewhere publically available, but the required changes are so minor you could easily update and rebuild voxl-mavlink-server yourself
In the gcs_io_init(void) function in gcs_io.c you could replace the line
si_me_gcs.sin_port = htons(GCS_UDP_PORT);
with something like
si_me_gcs.sin_port = htons((uint16_t)qgc_udp_port);
where qgc_udp_port is the variable you add to the config file. You'd also need to go the _add_connection(unsigned long ip) function and replace
connections[i].sockaddr.sin_port = htons(GCS_UDP_PORT);
with something like
connections[i].sockaddr.sin_port = htons((uint16_t)gcs_udp_publish_port);
I also added some logic to check that the user generated port number is within a valid range and only change it for each connection if it's not equal to the value defined by GCS_UDP_PORT (14550), but that's not strictly necessary.
This was all done for voxl-mavlink-server in SDK 1.3.5. I don't know how much the logic has changed in the more recent SDK versions, but I imagine these changes would carry over
-
@jmltt There were some places in voxl-mavlink-server where the system id was hardcoded to 1. This may have been causing problems when trying to enable multi-uav support in QGC. That has now been fixed and so it should be possible to use multi-uav in QGC now where each vehicle is assigned a separate system id. http://voxl-packages.modalai.com/dists/qrb5165/dev/binary-arm64/voxl-mavlink-server_1.4.12-202509181025_arm64.deb
-
@jmltt So reading the original issue that you were having back in November. The Deb file that Eric posted will solve the issue of mismatching communication links in QGC. I tested it and it works. The problem was that the voxl-mavlink-server was assigning every drone sys id 1 regardless of the MAV_SYS_ID parameter. This resulted in QGC assuming each of the drones were the same since the SYS ID on connection were the same.
Now as for why the drones were all connecting at once sounds like the autoconnect for UDP is enabled. The drones should not connect unless given the IP address + Port number in the comm link like you described. If QGC is setup to autoconnect to any UDP connections then that would explain why since all of the drone are set to communicate on 14550.
https://docs.qgroundcontrol.com/master/en/qgc-user-guide/settings_view/general.html#auto_connect
I understand why changing the port number would help prevent confusion but I don't think 4 drones using port 14550 is the issue as other have had multiple drones all on 14550 connected to a single QGC instance. There are issues if you are suing a simulation but not for physical drones.
-
@Aaron-Porter I'm sure the system id fix might have resolved the issue. I just find having separate ports for each vehicle to establish a connection over a cleaner option. This isn't an issue for me anymore, I was just responding to the question on the approach I used to resolve it
-
@jmltt I understand it is personal preference, I just wanted to give more detail on the issue that you were originally seeing incase anyone else ran into the same problem. Shouldn't happen in the future with the recent changes, but some still use older SDK versions.