distance_manager.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 #ifndef DISTANCE_MANAGER_HPP_
19 #define DISTANCE_MANAGER_HPP_
20 
21 #include <vector>
22 #include <thread>
23 #include <mutex>
24 #include <boost/scoped_ptr.hpp>
26 
27 #include <ros/ros.h>
28 
30 #include <kdl/tree.hpp>
31 #include <kdl/frames.hpp>
32 
33 #include <Eigen/Dense>
34 
35 #include <tf/tf.h>
36 #include <tf/transform_listener.h>
37 #include <tf_conversions/tf_kdl.h>
39 
40 #include <sensor_msgs/JointState.h>
41 #include <moveit_msgs/CollisionObject.h>
42 #include "cob_srvs/SetString.h"
43 
48 
49 
51 {
52  private:
53  std::string root_frame_id_;
54  std::string chain_base_link_;
55  std::string chain_tip_link_;
56 
57  boost::scoped_ptr<ShapesManager> obstacle_mgr_;
58  boost::scoped_ptr<ShapesManager> object_of_interest_mgr_;
59 
60  std::vector<std::thread> self_collision_transform_threads_;
61  std::mutex mtx_;
62  std::mutex obstacle_mgr_mtx_;
64 
65  boost::scoped_ptr<AdvancedChainFkSolverVel_recursive> adv_chn_fk_solver_vel_;
67 
72  Eigen::Affine3d tf_cb_frame_bl_;
73 
74  std::vector<std::string> joints_;
75  std::vector<std::string> segments_;
78 
80 
81  static uint32_t seq_nr_;
82 
88  void buildObstacleMesh(const moveit_msgs::CollisionObject::ConstPtr& msg, const tf::StampedTransform& transform);
89 
95  void buildObstaclePrimitive(const moveit_msgs::CollisionObject::ConstPtr& msg, const tf::StampedTransform& transform);
96 
97  public:
102 
104 
105  inline const std::string getRootFrame() const
106  {
107  return this->root_frame_id_;
108  }
109 
113  void clear();
114 
119  void addObstacle(const std::string& id, PtrIMarkerShape_t s);
120 
125  void addObjectOfInterest(const std::string& id, PtrIMarkerShape_t s);
126 
130  void drawObstacles();
131 
135  void drawObjectsOfInterest();
136 
141  void jointstateCb(const sensor_msgs::JointState::ConstPtr& msg);
142 
147  void registerObstacle(const moveit_msgs::CollisionObject::ConstPtr& msg);
148 
153  int init();
154 
159  void transform();
160 
166  void transformSelfCollisionLinks(const std::string link_name);
167 
172  void calculate();
173 
180  bool registerLinkOfInterest(cob_srvs::SetString::Request& request,
181  cob_srvs::SetString::Response& response);
182 
187  Eigen::Affine3d getSynchedCbToBlTransform();
188 };
189 
190 #endif /* DISTANCE_MANAGER_HPP_ */
void addObstacle(const std::string &id, PtrIMarkerShape_t s)
std::vector< std::thread > self_collision_transform_threads_
std::mutex obstacle_mgr_mtx_
std::shared_ptr< IMarkerShape > PtrIMarkerShape_t
KDL::JntArray last_q_dot_
tf::TransformListener tf_listener_
std::string chain_base_link_
const std::string getRootFrame() const
ros::Publisher obstacle_distances_pub_
std::vector< std::string > joints_
ros::NodeHandle & nh_
XmlRpcServer s
void jointstateCb(const sensor_msgs::JointState::ConstPtr &msg)
void buildObstacleMesh(const moveit_msgs::CollisionObject::ConstPtr &msg, const tf::StampedTransform &transform)
boost::scoped_ptr< ShapesManager > object_of_interest_mgr_
std::string root_frame_id_
DistanceManager(ros::NodeHandle &nh)
boost::scoped_ptr< ShapesManager > obstacle_mgr_
bool registerLinkOfInterest(cob_srvs::SetString::Request &request, cob_srvs::SetString::Response &response)
std::vector< std::string > segments_
KDL::JntArray last_q_
boost::scoped_ptr< AdvancedChainFkSolverVel_recursive > adv_chn_fk_solver_vel_
LinkToCollision link_to_collision_
void transformSelfCollisionLinks(const std::string link_name)
Eigen::Affine3d tf_cb_frame_bl_
ros::Publisher marker_pub_
std::string chain_tip_link_
void buildObstaclePrimitive(const moveit_msgs::CollisionObject::ConstPtr &msg, const tf::StampedTransform &transform)
static uint32_t seq_nr_
void registerObstacle(const moveit_msgs::CollisionObject::ConstPtr &msg)
Eigen::Affine3d getSynchedCbToBlTransform()
void addObjectOfInterest(const std::string &id, PtrIMarkerShape_t s)


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