moveit_config_data.h
Go to the documentation of this file.
00001 /*********************************************************************
00002  * Software License Agreement (BSD License)
00003  *
00004  *  Copyright (c) 2012, 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 the Willow Garage 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 
00035 /* Author: Dave Coleman */
00036 
00037 #ifndef MOVEIT_MOVEIT_SETUP_ASSISTANT_TOOLS_MOVEIT_CONFIG_DATA_
00038 #define MOVEIT_MOVEIT_SETUP_ASSISTANT_TOOLS_MOVEIT_CONFIG_DATA_
00039 
00040 #include <boost/shared_ptr.hpp>
00041 #include <srdfdom/model.h> // use their struct datastructures
00042 #include <urdf/model.h> // to share throughout app
00043 #include <moveit/setup_assistant/tools/srdf_writer.h> // for writing srdf data
00044 #include <moveit/planning_scene/planning_scene.h> // for getting kinematic model
00045 #include <moveit/collision_detection/collision_matrix.h> // for figuring out if robot is in collision
00046 
00047 namespace moveit_setup_assistant
00048 {
00049 
00050 // ******************************************************************************************
00051 // Constants
00052 // ******************************************************************************************
00053 
00054 // Used for loading kinematic model
00055 static const std::string ROBOT_DESCRIPTION = "robot_description";
00056 static const std::string MOVEIT_ROBOT_STATE = "moveit_robot_state";
00057 
00058 // Default kin solver values
00059 static const double DEFAULT_KIN_SOLVER_SEARCH_RESOLUTION_ = 0.005;
00060 static const double DEFAULT_KIN_SOLVER_TIMEOUT_ = 0.005;
00061 static const int    DEFAULT_KIN_SOLVER_ATTEMPTS_ = 3;
00062 
00063 
00064 // ******************************************************************************************
00065 // Structs
00066 // ******************************************************************************************
00067 
00071 struct GroupMetaData
00072 {
00073   std::string kinematics_solver_; // Name of kinematics plugin to use
00074   double kinematics_solver_search_resolution_; // resolution to use with solver
00075   double kinematics_solver_timeout_; // solver timeout
00076   int kinematics_solver_attempts_; // solver attempts
00077 };
00078 
00079 // ******************************************************************************************
00080 // Forward Declarations
00081 // ******************************************************************************************
00082 //class urdf::Model;
00083 
00084 // ******************************************************************************************
00085 // Class
00086 // ******************************************************************************************
00087 class MoveItConfigData
00088 {
00089 public:
00090   MoveItConfigData();
00091   ~MoveItConfigData();
00092 
00093   // All of the data needed for creating a MoveIt Configuration Files
00094 
00095   // ******************************************************************************************
00096   // URDF Data
00097   // ******************************************************************************************
00098 
00100   std::string urdf_path_;
00101 
00103   std::string urdf_pkg_name_;
00104 
00106   std::string urdf_pkg_relative_path_;
00107 
00109   bool urdf_from_xacro_;
00110 
00112   boost::shared_ptr<urdf::Model> urdf_model_;
00113 
00114   // ******************************************************************************************
00115   // SRDF Data
00116   // ******************************************************************************************
00117 
00119   std::string srdf_path_;
00120 
00122   std::string srdf_pkg_relative_path_;
00123 
00125   SRDFWriterPtr srdf_;
00126 
00127   // ******************************************************************************************
00128   // Other Data
00129   // ******************************************************************************************
00130 
00132   std::map<std::string, GroupMetaData> group_meta_data_;
00133 
00135   std::string setup_assistant_path_;
00136 
00138   std::string config_pkg_path_;
00139 
00141   std::string template_package_path_;
00142 
00144   bool debug_;
00145 
00147   collision_detection::AllowedCollisionMatrix allowed_collision_matrix_;
00148 
00150   std::time_t config_pkg_generated_timestamp_;
00151 
00152   // ******************************************************************************************
00153   // Public Functions
00154   // ******************************************************************************************
00155 
00157   robot_model::RobotModelConstPtr getRobotModel();
00158 
00160   void updateRobotModel();
00161 
00163   planning_scene::PlanningScenePtr getPlanningScene();
00164 
00171   srdf::Model::Group* findGroupByName( const std::string &name );
00172 
00174   void loadAllowedCollisionMatrix();
00175 
00176   // ******************************************************************************************
00177   // Public Functions for outputting configuration and setting files
00178   // ******************************************************************************************
00179   bool outputSetupAssistantFile( const std::string& file_path );
00180   bool outputOMPLPlanningYAML( const std::string& file_path );
00181   bool outputKinematicsYAML( const std::string& file_path );
00182   bool outputJointLimitsYAML( const std::string& file_path );
00183 
00189   std::string decideProjectionJoints(std::string planning_group);
00190 
00196   bool inputKinematicsYAML( const std::string& file_path );
00197 
00204   bool inputSetupAssistantYAML( const std::string& file_path );
00205 
00214   std::string appendPaths( const std::string &path1, const std::string &path2 );
00215 
00216 private:
00217 
00218   // ******************************************************************************************
00219   // Private Vars
00220   // ******************************************************************************************
00221 
00222   // Shared kinematic model
00223   robot_model::RobotModelPtr kin_model_;
00224   robot_model::RobotModelConstPtr kin_model_const_;
00225 
00226   // Shared planning scene
00227   planning_scene::PlanningScenePtr planning_scene_;
00228 };
00229 
00231 typedef boost::shared_ptr<MoveItConfigData> MoveItConfigDataPtr;
00232 
00233 
00234 } // namespace
00235 
00236 #endif


moveit_setup_assistant
Author(s): Dave Coleman
autogenerated on Mon Oct 6 2014 02:32:27