thanks for kind comments! I feel the pressure now
Regarding the “server poll function”. I have currently no good solution to restore a lost MAVLink connection due to a IP change. What I’ve done so far is pretty basic:
On booting the RPi it starts a phyton script. This script has a never ending loop that does 3 main things:
1, it contacts the Azure server to reports its IP and tell the server it is alive
2, it checks to see if there are incomming commands, if there are it downloads details and executes them. The commands are simple string executed as shell commands on the RPi. It reports back the status and result of running the command.
3, call the API of the modem to get status on connection like signal strength and type of connection (4G 3G etc), this is reported to the azure server
Typical commands are:
Start stop Arducopter with the correct IP
Start stop Video stream with the different quality
I’ve written a small .Net application that is running on my PC. It polls the Azure Server to report IP of PC, send commands for starting and stopping Arducopter, change video quality, display GSM connection quality on drone etc.
Arducopter is connecting directly via IP and MAVlink to the Mission Planner on my PC.
Both the modem on my PC and the modem on my quad has its own IP and allows incoming traffic. A special APN in the setup of the SIM card was required to get this to work. This setting, and if it is possible at all, depends on your subscription and network provider. In a normal modem connection you will share the IP with many others and you will not be able to connect directly to your device with just the IP.
The IP is different every time I boot the modem, but remains constant once I am connected. It does not seem to change over time or change of location (base station). I’ve left it on for days, and had it in my car.
However, I’m a little nervous about this. A change of IP would at the moment result in a loss of the MAVLink connection. So I have to make sure a loss of MAVlink connection will trigger RTH.
I’m no expert on Linux and arducopter but here are some solutions I’ve thought of:
Send a command to Arducopter to change the IP it is connecting to. From what I understand this is not possible without starting and stopping it. I can do that through my Azure Server, but it is not a good idea to start and stop Arducopter while it is in the air…
Run MAVProxy on RPi. In this setup the PC would connect to the RPi and not the other way around. But from what I understand running MAVProxy requires quite a lot of resources. I have not had time to test this.
Run MAVProxy on the Azure Server, but I’m not sure it is a good idea to be 100% relying on the Azure server as they do reboot from time to time. As a relay for commands it is ok, but to support a realtime connection I think it is better to connect directly from the RPi to the PC.
Set up a VPN connection. This should work I think, but I know little about network setup on Linux and have not had time to look into this.
For now, I will live with the direct connection and settle with making sure a change in IP triggers a RTH.
(Bernt Christian: I’ll make a video of everything once I have it all connected again)