Precision landing ROS2 Foxy + Apriltags

Hello everyone. We are trying to integrate precision land using fiducial marker into our system running mainly on ROS2 Foxy. It seems we cannot make it work somehow. Only official docs I found on this topic is Precision Landing and Loiter with IR-LOCK — Copter documentation here and it uses IR-Lock and it does not mention fiducial option.

So we tried to follow LuckyBird’s post here Precision Landing with ROS, Realsense T265 Camera and AprilTag 3 - Part 2⁄2. We deducted that there are 3 options of how to work with landing target plugin:

  • sending /tf.
  • publish PoseStamped msg on /mavros/landing_target/pose topic.
  • publish LandingTarget msg on /mavros/landing_target/raw topic

We tried /mavros/landing_target/raw and /mavros/landing_target/pose options so far and it seems, that nothing works.


This is the test of PoseStamped approach:

void LandPose::callback_detections(const interfaces_nvapriltag::msg::AprilTagDetectionArray::SharedPtr msg){
    geometry_msgs::msg::PoseStamped msg_land_pose;
    
    msg_land_pose.header=msg->header;
    msg_land_pose.pose=msg->detections[0].pose.pose.pose;

    land_pose_pub_->publish(msg_land_pose);
}

Keep in mind, that msg variable has following structure:

#AprilTagDetection
string family
int32 id
geometry_msgs/Point center      # centre in (x,y) pixel coordinates
geometry_msgs/Point[4] corners  # corners of tag ((x1,y1),(x2,y2),...)
geometry_msgs/PoseWithCovarianceStamped pose
#AprilTagDetectionArray
std_msgs/Header header
AprilTagDetection[] detections

LandingTarget approach:

void LandTarget::callback_detections(const interfaces_nvapriltag::msg::AprilTagDetectionArray::SharedPtr msg){
    mavros_msgs::msg::LandingTarget msg_land_trgt;
    
    msg_land_trgt.header=msg->header;
    msg_land_trgt.frame=12; //MAV_FRAME_BODY_FRD
    msg_land_trgt.type=2; //LANDING_TARGET_TYPE_VISION_FIDUCIAL
    msg_land_trgt.pose.position.x=msg->detections[0].pose.pose.pose.position.x;
    msg_land_trgt.pose.position.y=msg->detections[0].pose.pose.pose.position.y;
    msg_land_trgt.pose.position.z=msg->detections[0].pose.pose.pose.position.z;  

    land_trgt_pub_->publish(msg_land_trgt);
}

Topics are published properly and if I understand it correctly, once topics are populated and then it is switch to LAND mode, vehicle should perform precision land. For the testing we are using Gazebo classic 11, ROS2 Foxy and khancyrs’s ardupilot_gazebo repo GitHub - khancyr/ardupilot_gazebo. As I mentioned, apriltag detection is working properly in simulation.

We also changed ArduPilot params accordingly:

param set PLND_ENABLED = 1
param set PLND_TYPE = 1

Could you please elaborate why it is not working?

Thank you :slight_smile:

Hi, mate.

Have you solved your problem?

By the way, which version of Copter do you use?

Hi, not really.

We ended up using our own mavlink-ROS2 adapter (wrapper) and this way it works. It worked with pymavlink too. Anything except Mavros.