chain_manager_tests.cpp
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2014-2015 Fetch Robotics Inc.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
18 #include <gtest/gtest.h>
19 
20 TEST(ChainManagerTests, test_rosparam_loading)
21 {
22  ros::NodeHandle nh("~");
23  robot_calibration::ChainManager manager(nh, 0.001);
24 
25  std::vector<std::string> chain_names = manager.getChains();
26  EXPECT_EQ(static_cast<size_t>(2), chain_names.size());
27 
28  std::vector<std::string> joint_names = manager.getChainJointNames("arm");
29  EXPECT_EQ(static_cast<size_t>(7), joint_names.size());
30  EXPECT_EQ("arm_lift_joint", joint_names[0]);
31  EXPECT_EQ("arm_shoulder_pan_joint", joint_names[1]);
32  EXPECT_EQ("arm_shoulder_lift_joint", joint_names[2]);
33  EXPECT_EQ("arm_upperarm_roll_joint", joint_names[3]);
34  EXPECT_EQ("arm_elbow_flex_joint", joint_names[4]);
35  EXPECT_EQ("arm_wrist_flex_joint", joint_names[5]);
36  EXPECT_EQ("arm_wrist_roll_joint", joint_names[6]);
37 
38  joint_names = manager.getChainJointNames("not_a_chain");
39  EXPECT_EQ(static_cast<size_t>(0), joint_names.size());
40 
41  joint_names = manager.getChainJointNames("head");
42  EXPECT_EQ(static_cast<size_t>(2), joint_names.size());
43  EXPECT_EQ("head_pan_joint", joint_names[0]);
44  EXPECT_EQ("head_tilt_joint", joint_names[1]);
45 
46  std::string group_name = manager.getPlanningGroupName("arm");
47  EXPECT_EQ("arm_group", group_name);
48 
49  group_name = manager.getPlanningGroupName("head");
50  EXPECT_EQ("", group_name);
51 }
52 
53 int main(int argc, char** argv)
54 {
55  ros::init(argc, argv, "chain_manager_tests");
56  testing::InitGoogleTest(&argc, argv);
57  return RUN_ALL_TESTS();
58 }
TEST(ChainManagerTests, test_rosparam_loading)
std::string getPlanningGroupName(const std::string &chain_name)
ROSCPP_DECL void init(int &argc, char **argv, const std::string &name, uint32_t options=0)
Manages moving joints to a new pose, determining when they are settled, and returning current joint_s...
Definition: chain_manager.h:37
std::vector< std::string > getChainJointNames(const std::string &chain_name)
Get the joint names associated with a chain. Mainly for testing.
int main(int argc, char **argv)
std::vector< std::string > getChains()
Get the names of chains. Mainly for testing.


robot_calibration
Author(s): Michael Ferguson
autogenerated on Tue Nov 3 2020 17:30:30