test_tf_listener_singleton.cpp
Go to the documentation of this file.
2 #include <ros/ros.h>
3 #include <gtest/gtest.h>
4 
5 
6 TEST(TfListenerSingleton, testLookupTransformWithDuration){
7  boost::mutex mutex;
8  tf::TransformListener* tf_listener;
9 
10  mutex.lock();
11  tf_listener = new tf::TransformListener(ros::Duration(30.0));
12  mutex.unlock();
13 
14  std::string from_frame("base");
15  std::string to_frame("head");
16  tf::StampedTransform transform;
18  /*listener=*/tf_listener,
19  /*to_frame=*/to_frame,
20  /*from_frame=*/from_frame,
21  /*time=*/ros::Time(),
22  /*duration=*/ros::Duration(1.0));
23  ASSERT_STREQ("base", transform.frame_id_.c_str());
24  ASSERT_STREQ("head", transform.child_frame_id_.c_str());
25  ASSERT_EQ(0, transform.getOrigin().getX());
26  ASSERT_EQ(0, transform.getOrigin().getY());
27  ASSERT_EQ(1, transform.getOrigin().getZ());
28  ASSERT_EQ(0, transform.getRotation().getX());
29  ASSERT_EQ(0, transform.getRotation().getY());
30  ASSERT_EQ(0, transform.getRotation().getZ());
31  ASSERT_EQ(1, transform.getRotation().getW());
32 }
33 
34 int main(int argc, char **argv){
35  ros::init(argc, argv, "simple_lookup_transform");
36  testing::InitGoogleTest(&argc, argv);
37  return RUN_ALL_TESTS();
38 }
tf::StampedTransform lookupTransformWithDuration(tf::TransformListener *listener, const std::string &to_frame, const std::string &from_frame, const ros::Time &stamp, ros::Duration duration)
ROSCPP_DECL void init(int &argc, char **argv, const std::string &name, uint32_t options=0)
TFSIMD_FORCE_INLINE const tfScalar & getY() const
TFSIMD_FORCE_INLINE const tfScalar & getW() const
TFSIMD_FORCE_INLINE const tfScalar & getZ() const
std::string child_frame_id_
TFSIMD_FORCE_INLINE Vector3 & getOrigin()
int main(int argc, char **argv)
Quaternion getRotation() const
TFSIMD_FORCE_INLINE const tfScalar & getX() const
TEST(TfListenerSingleton, testLookupTransformWithDuration)
std::string frame_id_


jsk_recognition_utils
Author(s):
autogenerated on Mon May 3 2021 03:03:03