00001 /********************************************************************* 00002 * Software License Agreement (BSD License) 00003 * 00004 * Copyright (c) 2008, Willow Garage, Inc. 00005 * All rights reserved. 00006 * 00007 * Redistribution and use in source and binary forms, with or without 00008 * modification, are permitted provided that the following conditions 00009 * are met: 00010 * 00011 * * Redistributions of source code must retain the above copyright 00012 * notice, this list of conditions and the following disclaimer. 00013 * * Redistributions in binary form must reproduce the above 00014 * copyright notice, this list of conditions and the following 00015 * disclaimer in the documentation and/or other materials provided 00016 * with the distribution. 00017 * * Neither the name of Willow Garage, Inc. nor the names of its 00018 * contributors may be used to endorse or promote products derived 00019 * from this software without specific prior written permission. 00020 * 00021 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 00022 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 00023 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 00024 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 00025 * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 00026 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 00027 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 00028 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 00029 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 00030 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 00031 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 00032 * POSSIBILITY OF SUCH DAMAGE. 00033 *********************************************************************/ 00034 00037 #ifndef OMPL_ROS_H_ 00038 #define OMPL_ROS_H_ 00039 00040 // ROS 00041 #include <ros/console.h> 00042 #include <ros/ros.h> 00043 00044 // Planning environment and models 00045 #include <planning_environment/models/collision_models_interface.h> 00046 00047 // OMPL ROS Interface 00048 #include <ompl_ros_interface/planners/ompl_ros_rpy_ik_task_space_planner.h> 00049 #include <ompl_ros_interface/planners/ompl_ros_joint_planner.h> 00050 #include <ompl_ros_interface/helpers/ompl_ros_conversions.h> 00051 00052 // Diagnostics Message 00053 #include <ompl_ros_interface/OmplPlannerDiagnostics.h> 00054 00055 namespace ompl_ros_interface 00056 { 00061 class OmplRos 00062 { 00063 public: 00064 00065 OmplRos(); 00066 ~OmplRos(); 00067 00071 void run(void); 00072 00076 boost::shared_ptr<ompl_ros_interface::OmplRosPlanningGroup>& getPlanner(const std::string &group_name, 00077 const std::string &planner_config_name); 00078 00079 private: 00080 00085 bool computePlan(arm_navigation_msgs::GetMotionPlan::Request &request, 00086 arm_navigation_msgs::GetMotionPlan::Response &response); 00087 00091 bool getGroupNamesFromParamServer(const std::string ¶m_server_prefix, 00092 std::vector<std::string> &group_names); 00093 00094 bool initialize(const std::string ¶m_server_prefix); 00095 00096 bool initializePlanningMap(const std::string ¶m_server_prefix, 00097 const std::vector<std::string> &group_names); 00098 00099 bool initializePlanningInstance(const std::string ¶m_server_prefix, 00100 const std::string &group_name, 00101 const std::string &planner_config_name); 00105 std::map<std::string,boost::shared_ptr<ompl_ros_interface::OmplRosPlanningGroup> > planner_map_; 00106 00107 // ROS interface 00108 boost::shared_ptr<ompl_ros_interface::OmplRosPlanningGroup> empty_ptr; 00109 ros::ServiceServer plan_path_service_; 00110 planning_environment::CollisionModelsInterface *collision_models_interface_; 00111 ros::NodeHandle node_handle_; 00112 std::string default_planner_config_; 00113 bool publish_diagnostics_; 00114 ros::Publisher diagnostic_publisher_; 00115 00116 }; 00117 } 00118 00119 #endif //OMPL_ROS_H_