PX4 ros2 presicion landing target pose

Currently I am programming a multicopter and using Aruco markers for vision based landing.
I am trying to utilise precision landing as mentioned in this link:
precision_landing

I came across this post: Precision landing using external computer vision · Issue #18025 · PX4/PX4-Autopilot · GitHub and read that you can use landing_target_pose
to achieve landing based on the pose of the Aruco marker.

However, I am not sure how do i publish this message on my Offboard computer

Do i just publish a topic such as /fmu/in/landing_target_pose on my offboard computer or are there any additonal steps needed such as configuring the px4 firmware?

Currently the PX4 flight controller, once connected to the Microxrce dds bridge, does not have a landing pose topic so im not sure what to do

Did you manage to make it work? I’m also stuck trying to figure it out. From all the documentation of PX4-ROS2, I think we need to modify the dds_topics.yaml file in the PX4 software to expose that uORB topic to ROS2, Ive added the following lines to the subscription side:
image
But when I bring up the node that is detecting the AprilTag markers and publishing the LandingTargetPose messages to /fmu/in/landing_target_pose and switch the drone to precland in gazebo with “commander mode auto:precland” the drone does not react to the marker.

Hi I have not yet gotten it to work. I am not very sure how to expose the landing pose topic onto the dds bridge yet.

May I ask how does the dds.yaml work? Do we have to write the topics in this yaml file and then build to get a new firmware for the px4 flight controller?

Did some digging around and I edited the dds_topics.yaml PX4-Autopilot/src/modules/uxrce_dds_client/dds_topics.yaml at 1dacb4cdef2d7145754fc788fa8dc482eed74b40 · PX4/PX4-Autopilot · GitHub

To enable precision landing, I refered to Precision Landing | PX4 Guide (main) and added
CONFIG_DRIVERS_IRLOCK=y to both PX4-Autopilot/boards/px4/sitl/default.px4board and PX4-Autopilot/boards/px4/fmu-v6x/default.px4board
This is so that I can test sitl with gazebo as well as add the config to my actual flight controller

For sitl, when I ran make px4_sitl gz_x500 I encountered a series of compilation issues, I suspect this is because there is no I2c module specified on the sitl board. Not sure how to fix this part.

When I built my own flight controller firmware with make px4_fmu-v6x_default the firmware builds fine but I have yet to test prec landing on an actual flight

Note that without CONFIG_DRIVERS_IRLOCK=y, the follow behaviour is observed in the sim:
It goes to the set altitude for initiating the precision landing, waits the specified time, then can’t locate the IR lock in the specified time, so times out and initiates normal landing instead.

some good links I have encountered and would be useful in the future:

I had a conversation the Dronecode Discord with @dakejahl here :https://discord.com/channels/1022170275984457759/1030186476153085993/1263275092624806031
I’m trying to publish the IrLockReport messages to the FC using ROS2, and letting the landing _target_estimator generate the LandingTargetPose internally, but Im stuck aswell, I can see that the IrlockReport is getting read by the FC with the listener command in the pxh console and the landing target pose message is getting generated but the uav is not descending in precland mode but I see messages that its switching approach modes.
Im pretty sure that im filling the IrlockReport message correctly, I’m going to test in a real UAV to rule out a bug in gazebo and ill report how it went. Did you manege to get it working on your side?

If you can share your code, both PX4 and ROS2. I can take a look and test it out.

ROS2:
In the ROS2 workspace I have 3 packages. Aside from the px4_msgs package, there’s a sensors pkg that has the april_tag_detector node, that subscribes to the /camera topic coming from gazebo and publishes the detections, and a precland_controller node, that takes the detections and publishes the IrlockReport in it’s callback. And finally I have a interfaces pkg that has custom msgs for the AprilTagDetections. I don’t have a launch for the simulation so to run everything I do the following:
make px4_sitl gz_x500_mono_cam
then I lift the gz bridge in another terminal:
ros2 run ros_gz_bridge parameter_bridge /camera@sensor_msgs/msg/Image@gz.msgs.Image
then run the agent:
MicroXRCEAgent udp4 -p 8888
then in a terminal each I lift both nodes:
ros2 run caleuche_uav_sensors april_tag_detector
ros2 run caleuche_uav_sensors precland_controller
then in the gazebo world I place a wamv_apriltag_array object and in the PX4 console I start the landing_target_estimator

PX4
I’m running the main branch of PX4, with some modifications made to the models in /PX4-Autopilot/Tools/simulation/gz/models, as I’m using the x_500_mono_cam to test I modified the .sdf at /PX4-Autopilot/Tools/simulation/gz/models/x500_mono_cam/model.sdf to have the camera pointing straight down:
image
I also modified the mono_cam model to be 1280x720 changing the width and height in /PX4-Autopilot/Tools/simulation/gz/models/mono_cam/model.sdf. To have a Apriltag to test I added new model in /PX4-Autopilot/Tools/simulation/gz/models/wamv_apriltag_array
Finally to expose the IrlockReport topic to ROS2 I modified the dds_topics.yaml:
image

Install and Setup

To install, clone the repo, build and source, the only weird dependency that might cause error is opencv-contrib, it’s an older version that supports AprilTag detection and pose estimation in Python, install with:
pip3 install opencv-contrib-python==4.6.0.66
And in the px4_sim_models copy the wamv_apriltag_array into the path described in PX4.

I think that covers all, throw any question my way!
Thanks.

@dakejahl Could it be because SITL does not have the IrLock drivers, as @monkescripts pointed out?

I also found a question (Q3) from a PX4 Q&A, that mentioned that the precision landing was not being maintained and maybe was broken PX4 Community Q&A: June 14, 2023
Has anyone been able to implement precision landing successfully in release/1.14?