Skip to content

Commit

Permalink
fix orientation of tag frame estimated by homography method
Browse files Browse the repository at this point in the history
  • Loading branch information
christianrauch committed Jul 2, 2024
1 parent fe69f58 commit 73defb8
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 73defb8

Please sign in to comment.