Main Page
Namespaces
Namespace List
Namespace Members
All
Functions
Typedefs
Classes
Class List
Class Hierarchy
Class Members
All
a
c
g
i
j
l
m
n
p
r
s
t
u
~
Functions
a
c
g
j
p
r
s
t
u
~
Variables
Files
File List
File Members
All
Functions
Variables
Macros
test
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
>
41
#include <
tf2_ros/transform_listener.h
>
42
#include <boost/thread/thread.hpp>
43
#include <
urdf/model.h
>
44
#include <
kdl_parser/kdl_parser.hpp
>
45
46
#include "
robot_state_publisher/joint_state_listener.h
"
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
:
61
TestPublisher
()
62
{}
63
65
~TestPublisher
()
66
{}
67
};
68
69
70
TEST_F
(
TestPublisher
,
test
)
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
}
ros::init
ROSCPP_DECL void init(const M_string &remappings, const std::string &name, uint32_t options=0)
TestPublisher::TestPublisher
TestPublisher()
constructor
Definition:
test_one_link.cpp:61
ros
ros::NodeHandle::getParam
bool getParam(const std::string &key, bool &b) const
ros.h
robot_state_publisher::JointStateListener
Definition:
joint_state_listener.h:89
joint_state_listener.h
main
int main(int argc, char **argv)
Definition:
test_one_link.cpp:99
test
tf2_ros::TransformListener
tf2_ros::Buffer::canTransform
virtual bool canTransform(const std::string &target_frame, const ros::Time &target_time, const std::string &source_frame, const ros::Time &source_time, const std::string &fixed_frame, const ros::Duration timeout, std::string *errstr=NULL) const
TestPublisher
Definition:
test_joint_states_bag.cpp:59
tf2_ros
model.h
tf2_ros::Buffer
robot_state_publisher
Definition:
joint_state_listener.h:52
kdl_parser.hpp
transform_listener.h
ros::Time
TestPublisher::~TestPublisher
~TestPublisher()
Destructor.
Definition:
test_one_link.cpp:65
tf
ROS_INFO
#define ROS_INFO(...)
ros::NodeHandle
TEST_F
TEST_F(TestPublisher, test)
Definition:
test_one_link.cpp:70
robot_state_publisher
Author(s): Ioan Sucan
, Jackie Kay
, Wim Meeussen
autogenerated on Mon Aug 12 2024 02:09:28