Precision with companion computer not working , April Tag (Aruco Marker), Dronekit python

@ppoirier actually i dont want the rc to be used for the obstacle avoidance setup i only need to perform obstacle avoidance with my raspberrypi3 with ultrasonic sensor or lidar

if the above not posibble please guide me to make obstacle avoiance using raspberry pi 3 and pixhawk3 and also TFmini/ultrasonic sensor in autonomous drone delivery project for my college

Ultrasound is outdated and has too many false positives. Do like Patrick told you and get some infrared, laser or stereo camera sensors.

Thank you @amilcarlucas @ppoirier @rishabsingh3003

I had a tf mini now can i follow the above method for obstacle avoidance

How you fixed the precision landing problem. Iam using Raspberry 3b+ with pi cam. The vehicle not responding to landing_target_encode() function.

Did you fixed the precision landing problem? I am trying to do precision landing using companion computer and aruco marker , no response from .landing_target_encode function. Any idea?

def send_land_message(x,y):
msg = vehicle.message_factory.landing_target_encode(
0,
0,
mavutil.mavlink.MAV_FRAME_BODY_OFFSET_NED,
x,
y,
0,
0,
0,)
vehicle.send_mavlink(msg)
vehicle.flush()

Have you tried and made it work? I am also trying the same even precise_land
is not working. Please help @ppoirier @rishabsingh3003 @amilcarlucas

I am using raspberry pi 4 with imx camera, and pixhawk 6x with 4.5.1 firmware ardupilot.
The code is detecting the aruco marker but not making any movement

You are not explaining what you did. How can we help you if you do not do that?

I tried running 2 python code, in first i manual took flight on POSHOLD mode with the same script running the script is detecting the aruco markers also the drone seems decending for some secs but dosent land any time, just kee hovering, secondly i tried a code with auto takeoff in guided mode and then landing in same mode but that also not working ( code is: GitHub - 8OL-Robotics/precision-landing: A suite of python scripts to perform precision landing of a drone on an aruco marker, the PID controller, IO, estimators are all decoupled for hotswapping methods of control and sources of pose.)

Changed the parameter:
PLND_ENABLED=1
PLND_TYPE=companion computer

Use LOITER, not POSHOLD

I would start by going back to ArduCopter 4.3.8 because anything after that gives me problems with precision landing. I made a post here:

Any code or repository you can suggest? is my code looks good for precision landing?
Also,
I want to implement a mission and then land the drone precisely on aruco marker what steps should i follow?
I am using a single 72 id aruco marker for landing should i use multiple aruco markers?

Code is not sending any landing target message to drone because when I checked MAVLink Inspector in QGC, there were no landing target messages.

I tried Loiter mode,
Firstly after running the script i took off the drone in Loiter mode, assigned a switch for PrecLoiter and Land
After taking off to a certain height, i pressed the PrecLoiter switch and then switched to LAND mode.
The problem is i can’t see the LANDING_TARGET message everytime even if aruco is being detected, in 10 flights i saw it only in 3 flight. In one of flight the drone landed on aruco, i dont know wheater it was a coincidence or the precision landing was working. Please help

@amilcarlucas @ppoirier @rishabsingh3003

Test aruco detection on the ground with the companion computer. It MUST produce LANDING_TARGET MAVLink messages. After that start test flights.

You were right the landing target is being published on ground also. After the publishing i took a flight but the drone didn’t performed. It performed well only one time in 6 of the flights
Attaching the flight error video and images for refrence:
video

PARAMETERS MODIFIED:
PLND_ACC_P_NSE 2.5
PLND_ALT_MAX 5.0
PLND_ALT_MIN 1.0
PLND_BUS -1
PLND_CAM_POS_X 0.0
PLND_CAM_POS_Y 0.0
PLND_CAM_POS_Z 0.0
PLND_ENABLED 1
PLND_EST_TYPE 0
PLND_LAG 0.019999999552965164
PLND_LAND_OFS_X 0.0
PLND_LAND_OFS_Y 0.0
PLND_OPTIONS 0
PLND_RET_BEHAVE 0
PLND_RET_MAX 8
PLND_STRICT 1
PLND_TIMEOUT 7.0
PLND_TYPE 1
PLND_XY_DIST_MAX 0.0
PLND_YAW_ALIGN 0.0

function for land message:
def send_land_message_v2(x_rad=0, y_rad=0, dist_m=0, x_m=0,y_m=0,z_m=0, time_usec=0, target_num=0):
msg = vehicle.message_factory.landing_target_encode(
int(time_usec), # time target data was processed, as close to sensor capture as possible
target_num, # target num, not used
mavutil.mavlink.MAV_FRAME_BODY_NED, # frame, not used
int(x_rad), # X-axis angular offset, in radians
int(y_rad), # Y-axis angular offset, in radians
int(dist_m), # distance, in meters
0, # Target x-axis size, in radians
0, # Target y-axis size, in radians
int(x_m), # x float X Position of the landing target on MAV_FRAME
int(y_m), # y float Y Position of the landing target on MAV_FRAME
int(z_m), # z float Z Position of the landing target on MAV_FRAME
(1,0,0,0), # q float[4] Quaternion of landing target orientation (w, x, y, z order, zero-rotation is 1, 0, 0, 0)
2, # type of landing target: 2 = Fiducial marker
1, # position_valid boolean
)
print (msg)
vehicle.send_mavlink(msg)

Is it looks right?

The lighting conditions are not optimal and it works fine indoors, but not outdoors. Correct that.

What if i want to do it outdoor ? Should i use multiple aruco? Because we are working on a project where it have to land on a charging pod in well light conditions

Our company has been doing outdoor landings 24/7 for the past 5 years using Aruco markers.
Woks fine in sunny, rainy, day and night, Moon or no Moon .
And many others do the same. It is a solvable Problem. You just need to get your camera to work outdoors.