model_utils.h
Go to the documentation of this file.
00001 /*********************************************************************
00002 * Software License Agreement (BSD License)
00003 * 
00004 *  Copyright (c) 2010, 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 
00037 #ifndef _MODEL_UTILS_H_
00038 #define _MODEL_UTILS_H_
00039 
00040 #include <tf/tf.h>
00041 #include <planning_models/kinematic_state.h>
00042 #include <arm_navigation_msgs/RobotState.h>
00043 #include <arm_navigation_msgs/Constraints.h>
00044 #include <arm_navigation_msgs/OrderedCollisionOperations.h>
00045 
00046 #include <planning_environment/util/kinematic_state_constraint_evaluator.h>
00047 #include <arm_navigation_msgs/Shape.h>
00048 #include <visualization_msgs/Marker.h>
00049 #include <arm_navigation_msgs/LinkPadding.h>
00050 #include <collision_space/environment.h>
00051 #include <arm_navigation_msgs/AllowedCollisionMatrix.h>
00052 #include <planning_environment/models/collision_models.h>
00053 
00054 namespace planning_environment {
00055 
00056 //returns true if the joint_state_map sets all the joints in the state, 
00057 bool setRobotStateAndComputeTransforms(const arm_navigation_msgs::RobotState &robot_state,
00058                                        planning_models::KinematicState& state);
00059 
00060 void convertKinematicStateToRobotState(const planning_models::KinematicState& kinematic_state,
00061                                        const ros::Time& timestamp,
00062                                        const std::string& header_frame,
00063                                        arm_navigation_msgs::RobotState &robot_state);
00064 
00065 void applyOrderedCollisionOperationsToMatrix(const arm_navigation_msgs::OrderedCollisionOperations &ord,
00066                                              collision_space::EnvironmentModel::AllowedCollisionMatrix& acm);
00067 
00068 void convertFromACMToACMMsg(const collision_space::EnvironmentModel::AllowedCollisionMatrix& acm,
00069                             arm_navigation_msgs::AllowedCollisionMatrix& matrix);
00070 
00071 collision_space::EnvironmentModel::AllowedCollisionMatrix convertFromACMMsgToACM(const arm_navigation_msgs::AllowedCollisionMatrix& matrix);
00072 
00073 bool applyOrderedCollisionOperationsListToACM(const arm_navigation_msgs::OrderedCollisionOperations& ordered_coll,
00074                                               const std::vector<std::string>& object_names,
00075                                               const std::vector<std::string>& att_names,
00076                                               const planning_models::KinematicModel* model,
00077                                               collision_space::EnvironmentModel::AllowedCollisionMatrix& matrix);
00078 
00079 arm_navigation_msgs::AllowedCollisionMatrix 
00080 applyOrderedCollisionOperationsToCollisionsModel(const CollisionModels* cm,
00081                                                  const arm_navigation_msgs::OrderedCollisionOperations& ordered_coll,
00082                                                  const std::vector<std::string>& object_names,
00083                                                  const std::vector<std::string>& att_names);
00084 
00085 void getAllKinematicStateStampedTransforms(const planning_models::KinematicState& state,
00086                                            std::vector<geometry_msgs::TransformStamped>& trans_vector,
00087                                            const ros::Time& stamp); 
00088        
00089 bool doesKinematicStateObeyConstraints(const planning_models::KinematicState& state,
00090                                        const arm_navigation_msgs::Constraints& constraints,
00091                                        bool verbose = false);
00092 
00093 void setMarkerShapeFromShape(const arm_navigation_msgs::Shape &obj, visualization_msgs::Marker &mk);
00094 
00095 void setMarkerShapeFromShape(const shapes::Shape *obj, visualization_msgs::Marker &mk, double padding = 0.0);
00096 
00097 void convertFromLinkPaddingMapToLinkPaddingVector(const std::map<std::string, double>& link_padding_map,
00098                                                   std::vector<arm_navigation_msgs::LinkPadding>& link_padding_vector);
00099 
00100 void convertAllowedContactSpecificationMsgToAllowedContactVector(const std::vector<arm_navigation_msgs::AllowedContactSpecification>& acmv,
00101                                                                  std::vector<collision_space::EnvironmentModel::AllowedContact>& acv);
00102 
00103 void getCollisionMarkersFromContactInformation(const std::vector<arm_navigation_msgs::ContactInformation>& contacts,
00104                                                const std::string& world_frame_id,
00105                                                visualization_msgs::MarkerArray& arr,
00106                                                const std_msgs::ColorRGBA& color,
00107                                                const ros::Duration& lifetime);
00108 }
00109 #endif


planning_environment
Author(s): Ioan Sucan
autogenerated on Mon Dec 2 2013 12:34:43