Understanding Architecture with Companion Computer and Dronekit-Python

Let’s consider the following scenario:

A UAV has a companion computer (CC) connected via UART. By running mavproxy.py on the CC, is it possible to set the --out parameter to define the IP_ADDRESS/PORT to whom telemetry is redirected. A GCS having that IP_ADDRESS can connect to the CC by initializing the vehicle object using DroneKit. Via the instance vehicle, it is possible to access lots of properties and methods, for example, to check the current battery level or navigate to a certain position.

Let’s suppose the code running on the GCS has to perform some actions based on external triggers. For example, the CC has a camera onboard. When a certain object is recognized, the UAV needs to stop any movement to take a photo or eventually return-to-home

In my understanding, any action performed using a dronekit-python script is running locally on the GCS. If the link is lost, no reaction is possible because the GCS doesn’t know what happened.

This is not ideal because the benefits of having a CC are lost. I assume I’m doing something wrong or I simply forgot to consider some basics.

The goal would be to have a script ABC.py to perform some actions, which is located on the UAV. Via GCS only high level instructions should be sent, for example start running ABC.py or stop it.

What is the preferred architecture to accomplish that?

Thanks! Emanuel

1 Like

Usually the dronekit scripts on the CC do all the work. The GCS is only for monitoring. I have no clue why you are running the scripts on the GCS

That’s why I’m asking :grimacing: :grimacing: basically, how would you start a script on the CC? If I run dronekit on the GCS, I can take-off/land or upload a mission that will be executed by the UAV, by executing it on the GCS after the object vehicle is created. But let’s assume the script is on the CC … how do you run it or stop it? Is it correct to SSH into the CC in order to run it or what?

One example: we run a mongoose webserver linked to dronekit or mavros.
The result is that we connect to that webserver and controll the drone with a browser. It is not simple, but it is also not rocket science. and it works.

Hi, I wanted to understand this a bit better, there’s a web server running on the companion computer.
The backend on this server implements the logic and communications with the flight controller via dronekit/mavros.
This also serves a frontend to the user on the ground via a browser through which the user can control necessary actions.

Is my understanding correct? Thanks!

yes, it is correct …

HI. I am pretty nob, so I just want to make sure what I am doing make sesnse. I have a pi connected to the cube. I have the antenna in telm 1 and the pi in telm 2. I also have the controller connected with the reciber to the cube pins. My question is on fly the cc run dronekit to improve the flight controler and then, the computer on ground is only used for monitoring. It is like that?

Yes it it like that. Improve and extend, yes.