link_to_collision.hpp
Go to the documentation of this file.
1 /*
2  * Copyright 2017 Fraunhofer Institute for Manufacturing Engineering and Automation (IPA)
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9 
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 
18 #include <stdint.h>
19 #include <unordered_map>
20 #include <vector>
21 
22 #include <Eigen/Dense>
23 
24 #include <ros/ros.h>
25 #include <urdf/model.h>
26 
27 #include <boost/shared_ptr.hpp>
28 #include <boost/scoped_ptr.hpp>
29 #include <boost/pointer_cast.hpp>
30 
31 #include <fcl/collision_object.h>
32 #include <fcl/collision.h>
33 #include <fcl/distance.h>
34 #include <fcl/collision_data.h>
35 
36 #include <std_msgs/ColorRGBA.h>
37 #include <geometry_msgs/Vector3.h>
38 #include <geometry_msgs/Quaternion.h>
39 #include <geometry_msgs/Pose.h>
40 
41 
46 
48 {
49  private:
50  typedef urdf::LinkConstSharedPtr PtrConstLink_t;
51  typedef urdf::LinkSharedPtr PtrLink_t;
52  typedef std::vector<PtrLink_t> VecPtrLink_t;
53  typedef urdf::CollisionSharedPtr PtrCollision_t;
54  typedef urdf::GeometrySharedPtr PtrGeometry_t;
55  typedef urdf::MeshSharedPtr PtrMesh_t;
56  typedef urdf::BoxSharedPtr PtrBox_t;
57  typedef urdf::SphereSharedPtr PtrSphere_t;
58  typedef urdf::CylinderSharedPtr PtrCylinder_t;
59  typedef std::unordered_map<std::string, std::vector<std::string> >::iterator MapIter_t;
60 
62  bool success_;
63  std::string root_frame_id_;
64  std::unordered_map<std::string, std::vector<std::string> > self_collision_map_;
65 
74  void createSpecificMarkerShape(const std::string& link_of_interest,
75  const geometry_msgs::Pose& pose,
76  const std_msgs::ColorRGBA& col,
77  const PtrGeometry_t& geometry,
78  PtrIMarkerShape_t& segment_of_interest_marker_shape);
79 
80 
86  void poseURDFToMsg(const urdf::Pose& urdf_pose, geometry_msgs::Pose& msg_pose);
87 
88  public:
89  typedef std::unordered_map<std::string, std::vector<std::string> > MapSelfCollisions_t;
90 
93 
94  inline MapSelfCollisions_t::iterator getSelfCollisionsIterBegin()
95  {
96  return this->self_collision_map_.begin();
97  }
98 
99  inline MapSelfCollisions_t::iterator getSelfCollisionsIterEnd()
100  {
101  return this->self_collision_map_.end();
102  }
103 
104  bool ignoreSelfCollisionPart(const std::string& link_of_interest, const std::string& self_collision_obstacle_link);
105 
112  bool initFile(const std::string& root_frame_id, const std::string& urdf_file_name);
113 
120  bool initParameter(const std::string& root_frame_id, const std::string& urdf_param);
121 
130  bool initSelfCollision(XmlRpc::XmlRpcValue& self_collision_params, boost::scoped_ptr<ShapesManager>& sm);
131 
132 
142  bool getMarkerShapeFromUrdf(const Eigen::Vector3d& abs_pos,
143  const Eigen::Quaterniond& quat_pos,
144  const std::string& link_of_interest,
145  PtrIMarkerShape_t& segment_of_interest_marker_shape);
146 
157  bool getMarkerShapeFromType(const uint32_t& shape_type,
158  const Eigen::Vector3d& abs_pos,
159  const Eigen::Quaterniond& quat_pos,
160  const std::string& link_of_interest,
161  const Eigen::Vector3d& dimension,
162  PtrIMarkerShape_t& segment_of_interest_marker_shape);
163 
172  bool getMarkerShapeFromType(const uint32_t& shape_type,
173  const geometry_msgs::Pose& pose,
174  const std::string& link_of_interest,
175  const Eigen::Vector3d& dimension,
176  PtrIMarkerShape_t& segment_of_interest_marker_shape);
177 
178 };
std::shared_ptr< IMarkerShape > PtrIMarkerShape_t
urdf::MeshSharedPtr PtrMesh_t
std::unordered_map< std::string, std::vector< std::string > > self_collision_map_
std::vector< PtrLink_t > VecPtrLink_t
MapSelfCollisions_t::iterator getSelfCollisionsIterBegin()
std::unordered_map< std::string, std::vector< std::string > >::iterator MapIter_t
MapSelfCollisions_t::iterator getSelfCollisionsIterEnd()
void poseURDFToMsg(const urdf::Pose &urdf_pose, geometry_msgs::Pose &msg_pose)
bool ignoreSelfCollisionPart(const std::string &link_of_interest, const std::string &self_collision_obstacle_link)
bool getMarkerShapeFromUrdf(const Eigen::Vector3d &abs_pos, const Eigen::Quaterniond &quat_pos, const std::string &link_of_interest, PtrIMarkerShape_t &segment_of_interest_marker_shape)
urdf::CylinderSharedPtr PtrCylinder_t
std::string root_frame_id_
std::unordered_map< std::string, std::vector< std::string > > MapSelfCollisions_t
bool initFile(const std::string &root_frame_id, const std::string &urdf_file_name)
urdf::LinkSharedPtr PtrLink_t
urdf::LinkConstSharedPtr PtrConstLink_t
bool initSelfCollision(XmlRpc::XmlRpcValue &self_collision_params, boost::scoped_ptr< ShapesManager > &sm)
bool getMarkerShapeFromType(const uint32_t &shape_type, const Eigen::Vector3d &abs_pos, const Eigen::Quaterniond &quat_pos, const std::string &link_of_interest, const Eigen::Vector3d &dimension, PtrIMarkerShape_t &segment_of_interest_marker_shape)
void createSpecificMarkerShape(const std::string &link_of_interest, const geometry_msgs::Pose &pose, const std_msgs::ColorRGBA &col, const PtrGeometry_t &geometry, PtrIMarkerShape_t &segment_of_interest_marker_shape)
first: link to be considered &#39;obstacle&#39;, second: links of component to be considered for self-collisi...
urdf::CollisionSharedPtr PtrCollision_t
urdf::SphereSharedPtr PtrSphere_t
bool initParameter(const std::string &root_frame_id, const std::string &urdf_param)
urdf::BoxSharedPtr PtrBox_t
urdf::GeometrySharedPtr PtrGeometry_t


cob_obstacle_distance
Author(s): Marco Bezzon
autogenerated on Thu Apr 8 2021 02:39:47