Now we are trying to realize reliable auto landing via a companion computer. One solution we are exploring is to use a sonar or lidar to obtain cm-level relative height, and the companion computer acquires the date via serial port through PX4 FC, and issues “disarmed” command when the detected height is within certain range (say, 3cm).
We would like to know whether it is a feasible solution. Furthermore, we would like to know whether a companion computer has the ability to send mode-type command like “land” via the serial port to PX4 FC to directly drive the PX4 FC to excute the land motion.
It is feasible with Dronecode SDK. I would recommend to have a look at the documentation and the examples, there are things similar to what you want to achieve. Many computers can be used as companion computers as long as they have a serial port and support linux. The choice largely depends on the geometrical requirements and the processing power needed. Beaglebone, Raspberry Pi, Nvidia TX2 are common.
Thanks, Charles. I will check and let you know the result.
And do you know we how to use a companion computer to send mode-type command like “land” via the serial port to PX4 FC? If so, I could rely on the FC’s land detector to realize.
Dronecode needs to run on your companion computer. You can connect the companion computer to the FC through the telem2 port. You can see basic instructions in the docs. I am also working on this platform, which you can use as a reference. The setup scripts for the Raspberry Pi are particularly useful, as I found that setting up everything on a companion computer quite involving (it can take a few weeks to figure out everything if you don’t have too much experience). You won’t need all the mocap stuff for your drone. You can test your scripts with the simulator before running them with the real drone.
For the code to takeoff and land, you can look at this.