44 #ifndef APRILTAGS2_ROS_COMMON_FUNCTIONS_H 45 #define APRILTAGS2_ROS_COMMON_FUNCTIONS_H 56 #include <eigen3/Eigen/Dense> 57 #include <eigen3/Eigen/Geometry> 58 #include <opencv2/opencv.hpp> 59 #include <opencv2/imgproc/imgproc.hpp> 60 #include <opencv2/core/core.hpp> 65 #include "apriltags2_ros/AprilTagDetection.h" 66 #include "apriltags2_ros/AprilTagDetectionArray.h" 74 const std::string& param_name,
const T & default_val)
77 pnh.
param<T>(param_name, param_val, default_val);
94 std::string &frame_name) :
97 frame_name_(frame_name) {}
99 double size() {
return size_; }
100 int id() {
return id_; }
123 tags_.push_back(member);
124 id2idx_[
id] = tags_.size()-1;
127 std::string
name ()
const {
return name_; }
130 std::vector<int> ids;
131 for (
unsigned int i = 0; i < tags_.size(); i++) {
132 ids.push_back(tags_[i].
id);
138 std::vector<double> sizes;
139 for (
unsigned int i = 0; i < tags_.size(); i++) {
140 sizes.push_back(tags_[i].
size);
144 int memberID (
int tagID) {
return tags_[id2idx_[tagID]].id; }
145 double memberSize (
int tagID) {
return tags_[id2idx_[tagID]].size; }
146 cv::Matx44d
memberT_oi (
int tagID) {
return tags_[id2idx_[tagID]].T_oi; }
151 std::vector<TagBundleMember >
tags_;
158 static int idComparison(
const void* first,
const void* second);
161 void removeDuplicates();
194 std::map<int, StandaloneTagDescription> parseStandaloneTags(
196 std::vector<TagBundleDescription > parseTagBundles(
198 double xmlRpcGetDouble(
200 double xmlRpcGetDoubleWithDefault(
202 double defaultValue)
const;
204 bool findStandaloneTagDescription(
206 bool printWarning =
true);
208 geometry_msgs::PoseWithCovarianceStamped makeTagPose(
209 const Eigen::Matrix4d& transform,
210 const Eigen::Quaternion<double> rot_quaternion,
211 const std_msgs::Header& header);
214 AprilTagDetectionArray detectTags(
216 const sensor_msgs::CameraInfoConstPtr& camera_info);
225 Eigen::Matrix4d getRelativeTransform(
226 std::vector<cv::Point3d > objectPoints,
227 std::vector<cv::Point2d > imagePoints,
228 double fx,
double fy,
double cx,
double cy)
const;
231 std::vector<cv::Point2d >& imagePoints)
const;
232 void addObjectPoints(
double s, cv::Matx44d
T_oi,
233 std::vector<cv::Point3d >& objectPoints)
const;
241 #endif // APRILTAGS2_ROS_COMMON_FUNCTIONS_H
bool param(const std::string ¶m_name, T ¶m_val, const T &default_val) const