test_chain.cpp
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2008, Willow Garage, Inc.
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions are met:
7  *
8  * * Redistributions of source code must retain the above copyright
9  * notice, this list of conditions and the following disclaimer.
10  * * Redistributions in binary form must reproduce the above copyright
11  * notice, this list of conditions and the following disclaimer in the
12  * documentation and/or other materials provided with the distribution.
13  * * Neither the name of the Willow Garage, Inc. nor the names of its
14  * contributors may be used to endorse or promote products derived from
15  * this software without specific prior written permission.
16  *
17  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
18  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
21  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
22  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
23  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
24  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
25  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
26  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
27  * POSSIBILITY OF SUCH DAMAGE.
28  */
29 
30 #include <gtest/gtest.h>
31 #include <vector>
32 #include <boost/scoped_ptr.hpp>
35 #include <kdl/chainfksolverpos_recursive.hpp>
36 
37 using namespace pr2_mechanism_model;
38 using namespace std;
39 
40 
41 // Just three links
42 class ShortChainTest : public testing::Test
43 {
44 protected:
46  virtual ~ShortChainTest() {}
47 
48  virtual void SetUp() {}
49 
50  virtual void TearDown() {}
51 
53 };
54 
55 TEST_F(ShortChainTest, FKShouldMatchOnShortChainWhenStraight)
56 {
57  TiXmlDocument urdf_xml;
58  urdf_xml.LoadFile("pr2.urdf");
59  TiXmlElement *root = urdf_xml.FirstChildElement("robot");
60  ASSERT_TRUE(root != NULL);
62  Robot model(&hw);
63  ASSERT_TRUE(model.initXml(root));
64  RobotState state(&model);
65 
66  // Test no longer valid because joint state is empty when actuators are not present
67  /*
68  // extract chain
69  Chain chain;
70  EXPECT_TRUE(chain.init(&state, "fl_caster_l_wheel_link", "r_gripper_palm_link"));
71  KDL::Chain kdl;
72  chain.toKDL(kdl);
73  unsigned int nr_segments = 13;
74  unsigned int nr_joints = 10;
75  ASSERT_EQ(nr_segments, kdl.getNrOfSegments());
76  ASSERT_EQ(nr_joints, kdl.getNrOfJoints());
77 
78  KDL::JntArray jnts(state.joint_states_.size());
79  chain.getPositions(jnts);
80  */
81 }
82 
83 int main(int argc, char **argv){
84  testing::InitGoogleTest(&argc, argv);
85  return RUN_ALL_TESTS();
86 }
virtual void TearDown()
Definition: test_chain.cpp:50
virtual ~ShortChainTest()
Definition: test_chain.cpp:46
int main(int argc, char **argv)
Definition: test_chain.cpp:83
TEST_F(ShortChainTest, FKShouldMatchOnShortChainWhenStraight)
Definition: test_chain.cpp:55
virtual void SetUp()
Definition: test_chain.cpp:48
pr2_hardware_interface::HardwareInterface hw
Definition: test_chain.cpp:52
bool initXml(TiXmlElement *root)
Initialize the robot model form xml.
Definition: robot.cpp:51
This class provides the controllers with an interface to the robot state.
Definition: robot.h:126
This class provides the controllers with an interface to the robot model.
Definition: robot.h:78


pr2_mechanism_model
Author(s): Eric Berger berger@willowgarage.com, Stuart Glaser, Wim Meeussen
autogenerated on Fri Jun 7 2019 22:04:19