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