1 #include <gtest/gtest.h> 5 #include <sensor_msgs/CameraInfo.h> 6 #include <opencv2/highgui/highgui.hpp> 9 #include <fiducial_msgs/FiducialArray.h> 10 #include <fiducial_msgs/FiducialTransformArray.h> 22 c_info.distortion_model =
"plumb_bob";
24 double data_D[] = {0.1349735087283542, -0.2335869827451621, 0.0006697030315075139, 0.004846737465872353, 0.0};
25 c_info.D = std::vector<double> (data_D, data_D +
sizeof(data_D)/
sizeof(
double));
27 c_info.K = {1006.126285753055, 0.0, 655.8639244150409, 0.0, 1004.015433012594, 490.6140221242933, 0.0, 0.0, 1.0};
28 c_info.R = {1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0};
29 c_info.P = {1021.54345703125, 0.0, 661.9091982335958, 0.0, 0.0, 1025.251953125, 490.6380671707448, 0.0, 0.0, 0.0, 1.0, 0.0};
81 fiducial_msgs::Fiducial& vertices =
fiducials.fiducials[0];
83 ASSERT_EQ(30, vertices.fiducial_id);
85 ASSERT_DOUBLE_EQ(788.7144775390625000, vertices.x0);
86 ASSERT_DOUBLE_EQ(424.7263488769531250, vertices.y0);
87 ASSERT_DOUBLE_EQ(797.6848144531250000, vertices.x1);
88 ASSERT_DOUBLE_EQ(664.1170654296875000, vertices.y1);
89 ASSERT_DOUBLE_EQ(552.2851562500000000, vertices.x2);
90 ASSERT_DOUBLE_EQ(668.5111083984375000, vertices.y2);
91 ASSERT_DOUBLE_EQ(551.7211303710937500, vertices.x3);
92 ASSERT_DOUBLE_EQ(426.8039855957031250, vertices.y3);
106 fiducial_msgs::Fiducial& vertices =
fiducials.fiducials[len-1];
108 ASSERT_EQ(34, vertices.fiducial_id);
110 ASSERT_DOUBLE_EQ(840.3661499023437500, vertices.x0);
111 ASSERT_DOUBLE_EQ(105.3488464355468750, vertices.y0);
112 ASSERT_DOUBLE_EQ(839.5590820312500000, vertices.x1);
113 ASSERT_DOUBLE_EQ(456.3438720703125000, vertices.y1);
114 ASSERT_DOUBLE_EQ(506.3190307617187500, vertices.x2);
115 ASSERT_DOUBLE_EQ(462.5921936035156250, vertices.y2);
116 ASSERT_DOUBLE_EQ(493.5599365234375000, vertices.x3);
117 ASSERT_DOUBLE_EQ(118.8109970092773437, vertices.y3);
131 fiducial_msgs::Fiducial& vertices =
fiducials.fiducials[len-1];
133 ASSERT_EQ(35, vertices.fiducial_id);
135 ASSERT_DOUBLE_EQ(863.0485839843750000, vertices.x0);
136 ASSERT_DOUBLE_EQ(120.1449050903320312, vertices.y0);
137 ASSERT_DOUBLE_EQ(861.0425415039062500, vertices.x1);
138 ASSERT_DOUBLE_EQ(459.1877746582031250, vertices.y1);
139 ASSERT_DOUBLE_EQ(532.6334838867187500, vertices.x2);
140 ASSERT_DOUBLE_EQ(463.8345336914062500, vertices.y2);
141 ASSERT_DOUBLE_EQ(524.2216186523437500, vertices.x3);
142 ASSERT_DOUBLE_EQ(126.8642807006835937, vertices.y3);
145 int main(
int argc,
char** argv)
148 testing::InitGoogleTest(&argc, argv);
149 ros::init(argc, argv,
"FiducialsVerticesTests");
150 return RUN_ALL_TESTS();
ros::Subscriber vertices_sub
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())
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)
sensor_msgs::CameraInfo c_info
std::string image_directory
void publish_image(std::string file)
TEST_F(FiducialsVerticesTests, fiducial_30)
image_transport::Publisher image_pub
void publish(const sensor_msgs::Image &message) const
Publisher advertise(const std::string &topic, uint32_t queue_size, bool latch=false)
int main(int argc, char **argv)
bool getParam(const std::string &key, std::string &s) const
image_transport::ImageTransport * it
fiducial_msgs::FiducialArray fiducials
ROSCPP_DECL void spinOnce()
ros::Publisher CameraInfoPub
sensor_msgs::ImagePtr toImageMsg() const
void vertices_callback(const fiducial_msgs::FiducialArray &f)