test_one_link.cpp
Go to the documentation of this file.
1 /*********************************************************************
2 * Software License Agreement (BSD License)
3 *
4 * Copyright (c) 2008, Willow Garage, Inc.
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
9 * are met:
10 *
11 * * Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
13 * * Redistributions in binary form must reproduce the above
14 * copyright notice, this list of conditions and the following
15 * disclaimer in the documentation and/or other materials provided
16 * with the distribution.
17 * * Neither the name of the Willow Garage nor the names of its
18 * contributors may be used to endorse or promote products derived
19 * from this software without specific prior written permission.
20 *
21 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
24 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
25 * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
26 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
27 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
28 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
29 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
31 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
32 * POSSIBILITY OF SUCH DAMAGE.
33 *********************************************************************/
34 
35 /* Author: Wim Meeussen */
36 
37 #include <string>
38 
39 #include <gtest/gtest.h>
40 #include <ros/ros.h>
42 #include <boost/thread/thread.hpp>
43 #include <urdf/model.h>
45 
47 
48 using namespace ros;
49 using namespace tf2_ros;
50 using namespace robot_state_publisher;
51 
52 #define EPS 0.01
53 
54 class TestPublisher : public testing::Test
55 {
56 public:
57  JointStateListener* publisher;
58 
59 protected:
62  {}
63 
66  {}
67 };
68 
69 
71 {
72  {
73  ros::NodeHandle n_tilde;
74  std::string robot_description;
75  ASSERT_TRUE(n_tilde.getParam("robot_description", robot_description));
76  }
77 
78 
79  ROS_INFO("Creating tf listener");
80  Buffer buffer;
81  TransformListener tf(buffer);
82 
83  // ROS_INFO("Publishing joint state to robot state publisher");
84  /*ros::NodeHandle n;
85  ros::Publisher js_pub = n.advertise<sensor_msgs::JointState>("test_one_link/joint_states", 100);
86  sensor_msgs::JointState js_msg;
87  for (unsigned int i=0; i<100; i++){
88  js_msg.header.stamp = ros::Time::now();
89  js_pub.publish(js_msg);
90  ros::spinOnce();
91  ros::Duration(0.1).sleep();
92  }*/
93 
94  ASSERT_TRUE(buffer.canTransform("link1", "link1", Time()));
95 
96  SUCCEED();
97 }
98 
99 int main(int argc, char** argv)
100 {
101  ros::init(argc, argv, "test_one_link");
102  testing::InitGoogleTest(&argc, argv);
103 
104  int res = RUN_ALL_TESTS();
105 
106  return res;
107 }
ROSCPP_DECL void init(int &argc, char **argv, const std::string &name, uint32_t options=0)
~TestPublisher()
Destructor.
#define ROS_INFO(...)
TestPublisher()
constructor
int SUCCEED
bool getParam(const std::string &key, std::string &s) const
virtual bool canTransform(const std::string &target_frame, const std::string &source_frame, const ros::Time &target_time, const ros::Duration timeout, std::string *errstr=NULL) const


robot_state_publisher
Author(s): Ioan Sucan , Jackie Kay , Wim Meeussen
autogenerated on Sun Feb 10 2019 03:51:46