How to use Precision Landing feature with companion computer?

Okay, if you’re using the same code above:

def send_land_message(x, y):
msg = vehicle.message_factory.landing_target_encode(
0, # time_boot_ms (not used)
0, # target num
0, # frame
(x-horizontal_resolution/2)*horizontal_fov/horizontal_resolution,
(y-vertical_resolution/2)*vertical_fov/vertical_resolution,
0, # altitude. Not supported.
0,0) # size of target in radians
vehicle.send_mavlink(msg)
vehicle.flush()

The variable which you should keep updating is ‘x’ and ‘y’ which are the co-ordinate information of your landing target in the image or video your python code is processing, in rcmackay9’s video, I’m guessing he is detecting circles, so he identifies the circle and he finds the center co-ordinate of the circle within the image and this is the ‘x’ and ‘y’ co-ordinate, so in the code the ‘x’ and ‘y’ variables keep updating so you have to run the above function again in a continuous loop so the copter knows where it has to go, horizontal_resolution and vertical_resolution are the resolution of your image, horizontal_fov and vertical_fov is how much your camera can see in terms of degrees, for a Pi camera v1.3 its 54 by 41 degrees. The rest of the parameters in the function I have yet to look into it. Try looking in this, you’ll get the idea of how the code should work. Hope this helps.

https://github.com/squilter/target-land/blob/master/target_land.py

1 Like

Hello,
Here is my ‘‘instruction picture’’ showing how to make
squilter’s target_land.py works on SITL with an ODROID


So basically, if its working in SITL, it should work in the FIELD… Real test are comming :slight_smile:

1 Like

Great work, I did this in school as a project. This is a demo video.

2 Likes

PERRRRRRRRRRRFECT !!!
Great Job , keep on !

I have the ZED and TX1 as well but the Zed is on a gimbal. Are you using a different carrier board?

Such cool work! It’s exactly what I wanted. Can it be ported to quadplane? I’m just about to finish a Skywalker quadplane and I’d love to have precision landing capability.

1 Like

Good question, this would be great for quadplane!
You might want to take a look at vision_landing, it’s another method for precision landing:
http://discuss.ardupilot.org/t/maverick-vision-landing/18168

2 Likes

@HjorturG
i need to know something from you because the docs is very confusing.

In the structure of your MavLink message, why the sixth value is put to zero with a hashtag for the altitude … shouldn’t this be the distance between the center of the camera and the center of the detected landing target ?

Hi! Im trying to visualize the m255 landing target but there is no such parameter in qgroundcontrol.

Do you know if this changed?

What program do you use and which MAVLink message are you sending to FC (or SITL) ?

Im using squilter target_land.py

Im connected to qgroundcontrol via radio baud 57600, using a real drone (Pixhawk2.1 arducopter v3.65

I did some prints in the program and I know the camera is seeing the target and getting the values, the problem is I dont know how to monitor them on the Qgroundcontrol. The M255 is not available in the analyzer

def send_land_message(x, y):
msg = vehicle.message_factory.landing_target_encode(
0, # time_boot_ms (not used)
0, # target num
0, # frame
(x-horizontal_resolution/2)*horizontal_fov/horizontal_resolution,
(y-vertical_resolution/2)*vertical_fov/vertical_resolution,
0, # altitude. Not supported.
0,0) # size of target in radians
vehicle.send_mavlink(msg)
vehicle.flush()

Your message looks ok , You had the PLND_ENABLED and PLND_TYPE to 1.0 (Companion Computer) and mavlink message is passing OK from CC to FC ?

Then you should be able to read Landing_target.angle (M255 is relative == search Widget with LANDING)

Yes I have PLND Enabled and Type to 1

I dont know if the message is going through to the FC, when i search “landing” in qgroundcontrol analyzer nothing appears

Unless something changed in the code, that was working ok. Have you tried sending static values of x-y just to make sure?

Yes but still i cant find anything with those parameters :frowning:

X and Y values should range from -1 to 1 right?

Can you share your camera values please? FOV and size

1 Like

Looking at my lab picture it was 0,6 to -0,6 and the camera was a Logitech C920
After I worked with JeVois so the GoV did not applied the same way.

Here is the link from my github : https://github.com/patrickpoirier51/JeVois--Python-Tracking
Thats about all there is to it

2 Likes

Awesome thanks!! The Jevois calculates the height? Or how are you getting the Z value?

1 Like

Yes you can measure distance with Aruco tag but in this case, Z is used to pass the tag ID so you can filter/match the tag with a specific command

Can you please Share your PID values? I got the pY and pX to the FC but its not doing the corrections as it should.

I dont have them as this project is quite old and the initial platform has been rebuild
I i remember well , I slightly over-damped the vehicle.

1 Like