Hi, i wanted to make my own precison landing method for my arducopter
i know there are 2 methods, MAVlink based (aruco tags) and IR-LOCK, i have problems with both
with the vision based one is that i cant use it in fog, or low visilbity, and with IR-LOCK is that they dont deliver to my country, and i cant find an alternate
i was thinking to use MAVlink based but instad of aruco tags i use IR
if anyone has better idea on how to implement this, or any ideas in genral redarginf this, Please reachout.
so im using raspberry pi 4 B (8gb ram) wioth picam v1.3 to detect aruco tags for precision landing, the issue is, the image it receives is so blur, it doesnt even detect the tag, can anyone help me out with this?
note: everything else is working fine, i can see the landing target messages in the mavlink inspector
im providing my code here:
import cv2
import numpy as np
from pymavlink import mavutil
import time
import math
from picamera2 import Picamera2
from libcamera import controls
def detect_aruco_markers(frame, camera_matrix, dist_coeffs):
“”“Detect ArUco markers and estimate their pose with optimized processing”“”
if frame is None or frame.size == 0:
raise ValueError(“Empty frame received from the camera”)
gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)
dictionary = cv2.aruco.getPredefinedDictionary(cv2.aruco.DICT_4X4_50)
parameters = cv2.aruco.DetectorParameters()
detector = cv2.aruco.ArucoDetector(dictionary, parameters)
corners, ids, rejected = detector.detectMarkers(gray)
rvecs, tvecs = None, None
if ids is not None:
marker_size = 0.052
rvecs, tvecs = [], []
for i in range(len(corners)):
success, rvec, tvec = cv2.solvePnP(
objectPoints=np.array([[-marker_size/2, marker_size/2, 0],
[marker_size/2, marker_size/2, 0],
[marker_size/2, -marker_size/2, 0],
[-marker_size/2, -marker_size/2, 0]]),
imagePoints=corners[i][0],
cameraMatrix=camera_matrix,
distCoeffs=dist_coeffs)
if success:
rvecs.append(rvec)
tvecs.append(tvec)
return corners, ids, rvecs, tvecs
def send_landing_target(tvec, camera_matrix):
“”“Send landing target information to the flight controller”“”
def draw_markers_with_pose(image, corners, ids, rvecs, tvecs, camera_matrix, dist_coeffs):
“”“Draw detected markers and their pose information on the image”“”
if ids is None:
return image