Skip to content

Commit

Permalink
Merge pull request #38 from christianrauch/fix_homography_orientation
Browse files Browse the repository at this point in the history
fix orientation of tag frame estimated by homography method
  • Loading branch information
christianrauch authored Jul 7, 2024
2 parents fe69f58 + 73defb8 commit d65bc09
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/pose_estimation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,14 @@ homography(apriltag_detection_t* const detection, const std::array<double, 4>& i
apriltag_pose_t pose;
estimate_pose_for_tag_homography(&info, &pose);

// rotate frame such that z points in the opposite direction towards the camera
for(int i = 0; i < 3; i++) {
// swap x and y axes
std::swap(MATD_EL(pose.R, 0, i), MATD_EL(pose.R, 1, i));
// invert z axis
MATD_EL(pose.R, 2, i) *= -1;
}

return tf2::toMsg<apriltag_pose_t, geometry_msgs::msg::Transform>(const_cast<const apriltag_pose_t&>(pose));
}

Expand Down

0 comments on commit d65bc09

Please sign in to comment.