pr2_moveit_manipulation_tests.cpp
Go to the documentation of this file.
00001 #include <planning_scene_monitor/planning_scene_monitor.h>
00002 #include <kinematics_constraint_aware/kinematics_solver_constraint_aware.h>
00003 #include <kinematics_plugin_loader/kinematics_plugin_loader.h>
00004 #include <grasp_place_evaluation/grasp_evaluator_fast.h>
00005 
00006 #include <gtest/gtest.h>
00007 
00008 
00009 class MoveitManipulationTester : public testing::Test {
00010 
00011 protected:
00012 
00013 
00014   virtual void SetUp() {
00015     planning_scene_monitor_.reset(new planning_scene_monitor::PlanningSceneMonitor("robot_description"));
00016 
00017     planning_scene_diff_.reset(new planning_scene::PlanningScene(planning_scene_monitor_->getPlanningScene()));
00018 
00019     boost::shared_ptr<kinematics_plugin_loader::KinematicsPluginLoader>
00020       kinematics_plugin_loader(new kinematics_plugin_loader::KinematicsPluginLoader());
00021 
00022     kinematics_plugin_loader::KinematicsLoaderFn kinematics_allocator = kinematics_plugin_loader->getLoaderFunction();
00023 
00024     const planning_models::RobotModel::JointModelGroup* right_arm_group
00025       = planning_scene_diff_->getRobotModel()->getJointModelGroup("right_arm");
00026 
00027     const planning_models::RobotModel::JointModelGroup* left_arm_group
00028       = planning_scene_diff_->getRobotModel()->getJointModelGroup("left_arm");
00029 
00030     std::map<std::string, kinematics::KinematicsBasePtr> solver_map;
00031     solver_map["right_arm"] = kinematics_allocator(right_arm_group);
00032     solver_map["left_arm"] = kinematics_allocator(left_arm_group);
00033 
00034     grasp_evaluator_fast_.reset(new grasp_place_evaluation::GraspEvaluatorFast(planning_scene_diff_->getRobotModel(),
00035                                                                                solver_map));
00036 
00037     moveit_msgs::CollisionObject obj;
00038     obj.operation = moveit_msgs::CollisionObject::ADD;
00039     obj.id = "obj";
00040     obj.shapes.resize(1);
00041     obj.shapes[0].type = shape_msgs::Shape::CYLINDER;
00042     obj.shapes[0].dimensions.resize(2);
00043     obj.shapes[0].dimensions[0] = .02;
00044     obj.shapes[0].dimensions[1] = .1;
00045     obj.poses.resize(1);
00046     obj.poses.position.x = .5;
00047     obj.poses.position.y = -.15;
00048     obj.poses.position.z = .6;
00049     obj.poses.orientation.w = 1.0;
00050 
00051     planning_scene_diff_->processCollisionObjectMsg(obj);
00052   }
00053 
00054   virtual void TearDown() {
00055     grasp_evaluator_fast_.reset();
00056     planning_scene_diff_.reset();
00057     planning_scene_monitor_.reset();
00058   }
00059 
00060 protected:
00061 
00062   boost::shared_ptr<planning_scene_monitor::PlanningSceneMonitor> planning_scene_monitor_;
00063   boost::shared_ptr<planning_scene::PlanningScene> planning_scene_diff_;
00064   boost::shared_ptr<grasp_place_evaluation::GraspEvaluatorFast> grasp_evaluator_fast_;
00065 };
00066 
00067 // TEST_F(MoveitManipulationTester, GraspOK) {
00068 
00069 //   moveit_manipulation_msgs::
00070 
00071 // }
00072 
00073 int main(int argc, char** argv)
00074 {
00075   testing::InitGoogleTest(&argc, argv);
00076   ros::init(argc, argv, "pr2_moveit_manipulation_tests");
00077   return RUN_ALL_TESTS();
00078 }


pr2_test_moveit_manipulation
Author(s): Gil Jones
autogenerated on Mon Oct 6 2014 11:16:08