Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030 #include <gtest/gtest.h>
00031 #include <tf/transform_listener.h>
00032 #include <sys/time.h>
00033
00034
00035 void seed_rand()
00036 {
00037
00038 timeval temp_time_struct;
00039 gettimeofday(&temp_time_struct,NULL);
00040 srand(temp_time_struct.tv_usec);
00041 };
00042
00043 void generate_rand_vectors(double scale, uint64_t runs, std::vector<double>& xvalues, std::vector<double>& yvalues, std::vector<double>&zvalues)
00044 {
00045 seed_rand();
00046 for ( uint64_t i = 0; i < runs ; i++ )
00047 {
00048 xvalues[i] = 1.0 * ((double) rand() - (double)RAND_MAX /2.0) /(double)RAND_MAX;
00049 yvalues[i] = 1.0 * ((double) rand() - (double)RAND_MAX /2.0) /(double)RAND_MAX;
00050 zvalues[i] = 1.0 * ((double) rand() - (double)RAND_MAX /2.0) /(double)RAND_MAX;
00051 }
00052 }
00053
00054
00055 using namespace tf;
00056
00057
00058 TEST(transform_listener, resolve)
00059 {
00060 ros::NodeHandle n("~");
00061 tf::TransformListener tl;
00062
00063
00064 EXPECT_STREQ("id", tl.resolve("id").c_str());
00065
00066 n.setParam("tf_prefix", "a_tf_prefix");
00067 tf::TransformListener tp;
00068
00069 std::string prefix_str = tf::getPrefixParam(n);
00070
00071 EXPECT_STREQ("a_tf_prefix", prefix_str.c_str());
00072
00073 EXPECT_STREQ("a_tf_prefix/id", tf::resolve(prefix_str, "id").c_str());
00074
00075 EXPECT_STREQ("a_tf_prefix/id", tp.resolve("id").c_str());
00076
00077
00078 }
00079
00080
00081 int main(int argc, char **argv){
00082 testing::InitGoogleTest(&argc, argv);
00083 ros::init(argc, argv, "transform_listener_unittest");
00084 return RUN_ALL_TESTS();
00085 }