Precision Landing with Realsense T265 Camera and AprilTag - Part 1/2

Hi @soldierofhell, you are right: to detect the target we only need one camera, thus the stereo matching is redundant. It would only become useful if stereo depth is needed for your application. As a blog post it would be fine to be a bit more general for other use cases, thus I have decided to keep the stereo matching part in the code. You can, of course, remove any parts as you wish.

Regarding the use of the two cameras at the same time: for the T265 has a very narrow stereo baseline (~5cm) the overlapping area between the rectified images is quite large. At landing altitude in my experiments (1m-5m), both of the cameras usually see the target at the same time, so using any of the two cameras would make no difference.

On the other hand, if you can make full use of the field-of-view (~163°) of the cameras, using both will make a lot of sense in that case.

Have a look at my use case above. I’m real interested in your precision landing work.

Hi @moonman,

If you are only concern about the precision landing task (using camera images and computer vision algorithm), I think landing on a boat is doable since the performance will mainly depend on the image and you can test that out straightforwardly. The detectable range will vary based on the size of the landing target, the illumination of the scene, the relative speed between the target / copter etc. For a static target, you can test the range with different paper sizes and extrapolate.

The precision flight (using VISLAM pose data), on the other hand, might not work well, or at all, because of the challenges that @ppoirier mentioned.

@LuckyBird I thought rather about combining two methods od distance calculaton: from known shape as in april tags detector and stereo distance. Especially in application like landing on this boat it might be of benefit

For flight I could probably just use gps follow and have a good gps on both the uav and gcs.

Because of high reflectivity of water and the lack of fixed features, I would recommend using IR-LOCK:

https://ardupilot.org/copter/docs/precision-landing-with-irlock.html

Hi, @LuckyBird, many thanks to your detailed introduction for your work!
I am following these setps to realize the precision landing with Ardupilot and a Jetson Nano as the companion computer, but I met some troubles and need your help.
When I start the script t265_precland_apriltags.py, it works OK in the first few tens of seconds. I can see the messages (landing_target, pose estimation, delta) in MAVLINK inspector, and there is a quadrotor icon in the map.
But few tens of seconds later, when I shake my drone, the quadrotor drone is disappear!, however, I can still watch the messages in MAVLINK inspector.
Do you know what caused this, Looking forward to your reply…
THANK YOU.

@Andrew5c maybe the connection (usb cable to the camera/ telemetry to the ground station) become unstable when you shake your drone. In the picture, the other messages also dropped to 0 Hz, which indicates that the telemetry might be the main problem.

If possible, can you use a usb cable to connect the flight controller and the ground station for telemetry, do the shaking again and see if the problem persists.

Yes, thanks, @LuckyBird, that’s probably the problem.
I used a USB cable to connect the pixhawk with my computer GCS just now, and done the same thing, shaked my drone, and the quadrotor icon is showing good. Unfortunately, there were still once time(1/3) the quadrotor disapeared. But overall, things are much better than before.
Thanks for your timely reply!

This project is very useful to me,and it works in my plane(F450 Pixhawk2.4.8, APM3.6.11).

But when I ported this part of the code, there was an error. I did not know the MavLink protocol very well. May I ask why?

File “apm_startup.py”, line 260, in
main()
File “apm_startup.py”, line 240, in main
1, # position_valid boolean
TypeError: landing_target_encode() takes 9 positional arguments but 15 were given

Sorry for the late reply. This probably means you need to change the mavlink protocol of the serial port to 2 (serial?_protocol is set to mavlink2 for that port).

Thanks for your reply.

If I want to make a visual landing with a normal camera, how to set the camera parameters in this code?My current camera is a wide-angle distortionless camera with a 110-degree field of view and a focal length of 2.8mm, not the Intel T265。

May I suggest you open a new thread as we won’t mix subject and keep focus on T265

1 Like

very sorry about that. I’m just trying to figure out what the camera parameters in this code mean, like focus,fov.

Hi @beyond21299, regarding the question about changing parameters for your camera:

  • I would suggest to start with reading up on the OpenCV’s fisheye camera model: https://docs.opencv.org/3.4/db/d58/group__calib3d__fisheye.html. All the parameters in the code would correspond to this model, so it helps to understand them first.
  • Once it is clear what the parameters mean, you can put your camera’s coefficient directly into these parameters. The first half of the program is there only to simplify the process of obtaining those two lines of code.

Hope this helps.

thank you very much,I’ll try.

I used raspberry PI 4 and T265 together for the precise and automatic landing of APM flight control.
But every time I charged raspberry PI, I had to plug the USB interface of T265 again to connect it to raspberry PI. Have you ever met this situation and how did you solve it?

@beyond21299 Get the latest linux kernel and the latest T265 device drivers from intel. The problem might have been fixed upstream. Intel knows about this problem for a long time now.

Thank you. I’ll try it later