00001 /* 00002 * Software License Agreement (Apache License) 00003 * 00004 * Copyright (c) 2014, Southwest Research Institute 00005 * 00006 * Licensed under the Apache License, Version 2.0 (the "License"); 00007 * you may not use this file except in compliance with the License. 00008 * You may obtain a copy of the License at 00009 * 00010 * http://www.apache.org/licenses/LICENSE-2.0 00011 * 00012 * Unless required by applicable law or agreed to in writing, software 00013 * distributed under the License is distributed on an "AS IS" BASIS, 00014 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00015 * See the License for the specific language governing permissions and 00016 * limitations under the License. 00017 */ 00018 00019 #include "descartes_moveit/moveit_state_adapter.h" 00020 #include <descartes_trajectory_test/robot_model_test.hpp> 00021 #include "moveit/robot_model_loader/robot_model_loader.h" 00022 #include <gtest/gtest.h> 00023 00024 using namespace descartes_moveit; 00025 using namespace descartes_trajectory; 00026 using namespace descartes_core; 00027 00028 using testing::Types; 00029 00030 namespace descartes_trajectory_test 00031 { 00032 // This variable must be global in order for the test to pass. 00033 // Destructing the robot model results in a boost mutex exception: 00034 // --- 00035 // /usr/include/boost/thread/pthread/pthread_mutex_scoped_lock.hpp:26: 00036 // boost::pthread::pthread_mutex_scoped_lock::pthread_mutex_scoped_lock(pthread_mutex_t*): 00037 // Assertion `!pthread_mutex_lock(m)' failed. 00038 // --- 00039 00040 robot_model_loader::RobotModelLoaderPtr robot_; 00041 00042 template <> 00043 RobotModelPtr CreateRobotModel<descartes_moveit::MoveitStateAdapter>() 00044 { 00045 ROS_INFO_STREAM("Construction descartes robot model"); 00046 descartes_core::RobotModelPtr descartes_model_; 00047 descartes_model_ = descartes_core::RobotModelPtr(new descartes_moveit::MoveitStateAdapter()); 00048 EXPECT_TRUE(descartes_model_->initialize("robot_description", "manipulator", "base_link", "tool0")); 00049 ROS_INFO_STREAM("Descartes robot model constructed"); 00050 00051 descartes_model_->setCheckCollisions(true); 00052 EXPECT_TRUE(descartes_model_->getCheckCollisions()); 00053 ROS_INFO_STREAM("Descartes robot enabled collision checks"); 00054 00055 return descartes_model_; 00056 } 00057 00058 template <class T> 00059 class MoveitRobotModelTest : public descartes_trajectory_test::RobotModelTest<T> 00060 { 00061 }; 00062 00063 INSTANTIATE_TYPED_TEST_CASE_P(MoveitRobotModelTest, RobotModelTest, MoveitStateAdapter); 00064 00065 } // descartes_moveit_test