1 #include <gtest/gtest.h> 5 #include <sensor_msgs/CameraInfo.h> 6 #include <opencv2/highgui/highgui.hpp> 9 #include <fiducial_msgs/FiducialTransformArray.h> 21 c_info.distortion_model =
"plumb_bob";
23 double data_D[] = {0.1349735087283542, -0.2335869827451621, 0.0006697030315075139, 0.004846737465872353, 0.0};
24 c_info.D = std::vector<double> (data_D, data_D +
sizeof(data_D)/
sizeof(
double));
26 c_info.K = {1006.126285753055, 0.0, 655.8639244150409, 0.0, 1004.015433012594, 490.6140221242933, 0.0, 0.0, 1.0};
27 c_info.R = {1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0};
28 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};
78 ASSERT_EQ(30,
transforms.transforms[0].fiducial_id);
80 ASSERT_NEAR(0.0111652960709,
transforms.transforms[0].transform.translation.x, 0.05);
81 ASSERT_NEAR(0.0345085728175,
transforms.transforms[0].transform.translation.y, 0.05);
82 ASSERT_NEAR(0.6496505488590,
transforms.transforms[0].transform.translation.z, 0.05);
84 ASSERT_NEAR(0.9971363567790,
transforms.transforms[0].transform.rotation.x, 0.05);
85 ASSERT_NEAR(-0.007139744467,
transforms.transforms[0].transform.rotation.y, 0.05);
86 ASSERT_NEAR(0.0201383049329,
transforms.transforms[0].transform.rotation.z, 0.05);
87 ASSERT_NEAR(0.0725434953236,
transforms.transforms[0].transform.rotation.w, 0.05);
98 ASSERT_EQ(34,
transforms.transforms[0].fiducial_id);
100 ASSERT_NEAR(0.00557772645364,
transforms.transforms[0].transform.translation.x, 0.05);
101 ASSERT_NEAR(-0.0921505293117,
transforms.transforms[0].transform.translation.y, 0.05);
102 ASSERT_NEAR(0.459902136894,
transforms.transforms[0].transform.translation.z, 0.05);
104 ASSERT_NEAR(0.997516008884,
transforms.transforms[0].transform.rotation.x, 0.05);
105 ASSERT_NEAR(-0.00861731470528,
transforms.transforms[0].transform.rotation.y, 0.05);
106 ASSERT_NEAR(-0.0332893760892,
transforms.transforms[0].transform.rotation.z, 0.05);
107 ASSERT_NEAR(-0.0614765918635,
transforms.transforms[0].transform.rotation.w, 0.05);
118 ASSERT_EQ(35,
transforms.transforms[0].fiducial_id);
120 ASSERT_NEAR(0.0181760973715,
transforms.transforms[0].transform.translation.x, 0.05);
121 ASSERT_NEAR(-0.0915359838771,
transforms.transforms[0].transform.translation.y, 0.05);
122 ASSERT_NEAR(0.470431107885,
transforms.transforms[0].transform.translation.z, 0.05);
124 ASSERT_NEAR(0.998738802658,
transforms.transforms[0].transform.rotation.x, 0.05);
125 ASSERT_NEAR(-0.00669542019471,
transforms.transforms[0].transform.rotation.y, 0.05);
126 ASSERT_NEAR(-0.00914052301956,
transforms.transforms[0].transform.rotation.z, 0.05);
127 ASSERT_NEAR(-0.0489124345408,
transforms.transforms[0].transform.rotation.w, 0.05);
130 int main(
int argc,
char** argv)
133 testing::InitGoogleTest(&argc, argv);
134 ros::init(argc, argv,
"FiducialsTransformTests");
135 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())
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)
void publish(const sensor_msgs::Image &message) const
Publisher advertise(const std::string &topic, uint32_t queue_size, bool latch=false)
bool getParam(const std::string &key, std::string &s) const
ROSCPP_DECL void spinOnce()
sensor_msgs::ImagePtr toImageMsg() const