7 #include <gtest/gtest.h> 11 #include <sensor_msgs/CameraInfo.h> 12 #include <opencv2/highgui/highgui.hpp> 15 #include <geometry_msgs/PoseWithCovarianceStamped.h> 17 #include <fiducial_msgs/FiducialMapEntry.h> 18 #include <fiducial_msgs/FiducialMapEntryArray.h> 29 c_info.header.frame_id =
"camera";
32 c_info.distortion_model =
"plumb_bob";
34 double data_D[] = {0.1349735087283542, -0.2335869827451621,
35 0.0006697030315075139, 0.004846737465872353, 0.0};
37 c_info.D = std::vector<double> (data_D,
38 data_D +
sizeof(data_D)/
sizeof(
double));
40 c_info.K = {1006.126285753055, 0.0, 655.8639244150409,
41 0.0, 1004.015433012594, 490.6140221242933,
44 c_info.R = {1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0};
46 c_info.P = {1021.54345703125, 0.0, 661.9091982335958, 0.0,
47 0.0, 1025.251953125, 490.6380671707448, 0.0,
57 fiducial_msgs::FiducialMapEntryArray
map;
106 fiducial_msgs::FiducialMapEntryArray
map;
107 geometry_msgs::PoseWithCovarianceStamped
pose;
119 ASSERT_NEAR(0,
pose.pose.pose.position.x, 0.001);
120 ASSERT_NEAR(0,
pose.pose.pose.position.y, 0.001);
121 ASSERT_NEAR(0,
pose.pose.pose.position.z, 0.001);
123 ASSERT_NEAR(1,
pose.pose.pose.orientation.w, 0.001);
124 ASSERT_NEAR(0,
pose.pose.pose.orientation.x, 0.001);
125 ASSERT_NEAR(0,
pose.pose.pose.orientation.y, 0.001);
126 ASSERT_NEAR(0,
pose.pose.pose.orientation.z, 0.001);
128 ASSERT_LE(1,
map.fiducials.size());
130 const fiducial_msgs::FiducialMapEntry &
fid =
map.fiducials[0];
131 ASSERT_EQ(403, fid.fiducial_id);
132 ASSERT_NEAR(0.7611, fid.x, 0.001);
133 ASSERT_NEAR(0.2505, fid.y, 0.001);
134 ASSERT_NEAR(0.4028, fid.z, 0.001);
135 ASSERT_NEAR(1.5751, fid.rx, 0.001);
136 ASSERT_NEAR(-0.014, fid.ry, 0.001);
137 ASSERT_NEAR(-1.546, fid.rz, 0.001);
143 testing::InitGoogleTest(&argc, argv);
145 return RUN_ALL_TESTS();
void publish(const boost::shared_ptr< M > &message) const
Subscriber subscribe(const std::string &topic, uint32_t queue_size, void(T::*fp)(M), T *obj, const TransportHints &transport_hints=TransportHints())
void publish_image(std::string file)
ROSCPP_DECL void init(int &argc, char **argv, const std::string &name, uint32_t options=0)
Publisher advertise(const std::string &base_topic, uint32_t queue_size, bool latch=false)
int main(int argc, char **argv)
void pose_callback(const geometry_msgs::PoseWithCovarianceStamped &msg)
std::string image_directory
TEST_F(AutoInitTest, tag_403_d7_14cm)
void map_callback(const fiducial_msgs::FiducialMapEntryArray &msg)
sensor_msgs::CameraInfo c_info
void publish(const sensor_msgs::Image &message) const
fiducial_msgs::FiducialMapEntryArray map
image_transport::Publisher image_pub
image_transport::ImageTransport * it
Publisher advertise(const std::string &topic, uint32_t queue_size, bool latch=false)
ros::Publisher CameraInfoPub
bool getParam(const std::string &key, std::string &s) const
geometry_msgs::PoseWithCovarianceStamped pose
ROSCPP_DECL void spinOnce()
sensor_msgs::ImagePtr toImageMsg() const