distance_manager.cpp
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 <limits>
19 #include <string>
20 #include <vector>
21 
23 
24 
25 #include <stdint.h>
26 
27 #include <ros/ros.h>
28 
29 #include <fcl/collision_object.h>
30 #include <fcl/collision.h>
31 #include <fcl/distance.h>
32 #include <fcl/collision_data.h>
33 
34 #include <std_msgs/Float64.h>
35 #include <visualization_msgs/Marker.h>
36 
37 #include "cob_control_msgs/ObstacleDistance.h"
38 #include "cob_control_msgs/ObstacleDistances.h"
39 
40 #include <boost/filesystem.hpp>
41 #include <boost/filesystem/path.hpp>
42 #include <boost/pointer_cast.hpp>
43 
46 
48 
49 #include <urdf/model.h>
50 
51 #include <shape_msgs/Mesh.h>
52 #include <shape_msgs/MeshTriangle.h>
53 #include <shape_msgs/SolidPrimitive.h>
54 
55 #define VEC_X 0
56 #define VEC_Y 1
57 #define VEC_Z 2
58 
59 
60 uint32_t DistanceManager::seq_nr_ = 0;
61 
62 DistanceManager::DistanceManager(ros::NodeHandle& nh) : nh_(nh), stop_sca_threads_(false)
63 {}
64 
66 {
67  this->clear();
68 }
69 
71 {
72  this->stop_sca_threads_ = false;
73 
74  // Latched and continue in case there is no subscriber at the moment for a marker
75  this->marker_pub_ = this->nh_.advertise<visualization_msgs::MarkerArray>("obstacle_distance/marker", 10, true);
76  this->obstacle_distances_pub_ = this->nh_.advertise<cob_control_msgs::ObstacleDistances>("obstacle_distance", 1);
77  obstacle_mgr_.reset(new ShapesManager(this->marker_pub_));
79  KDL::Tree robot_structure;
80  if (!kdl_parser::treeFromParam("/robot_description", robot_structure))
81  {
82  ROS_ERROR("Failed to construct kdl tree from parameter '/robot_description'.");
83  return -1;
84  }
85 
86  if (!nh_.getParam("joint_names", this->joints_))
87  {
88  ROS_ERROR("Failed to get parameter \"joint_names\".");
89  return -2;
90  }
91 
92  if (!nh_.getParam("root_frame", this->root_frame_id_))
93  {
94  ROS_ERROR("Failed to get parameter \"chain_base_link\".");
95  return -3;
96  }
97 
98  if (!nh_.getParam("chain_base_link", this->chain_base_link_))
99  {
100  ROS_ERROR("Failed to get parameter \"chain_base_link\".");
101  return -3;
102  }
103 
104  if (!nh_.getParam("chain_tip_link", this->chain_tip_link_))
105  {
106  ROS_ERROR("Failed to get parameter \"chain_tip_link\".");
107  return -4;
108  }
109 
110  robot_structure.getChain(this->chain_base_link_, this->chain_tip_link_, this->chain_);
111  if (chain_.getNrOfJoints() == 0)
112  {
113  ROS_ERROR("Failed to initialize kinematic chain");
114  return -5;
115  }
116 
117  for (uint16_t i = 0; i < chain_.getNrOfSegments(); ++i)
118  {
120  this->segments_.push_back(s.getName());
121  ROS_INFO_STREAM("Managing Segment Name: " << s.getName());
122  }
123 
127  if (!this->link_to_collision_.initParameter(this->root_frame_id_, "/robot_description"))
128  {
129  ROS_ERROR("Failed to initialize robot model from URDF by parameter \"/robot_description\".");
130  return -6;
131  }
132  else
133  {
135  bool success = false;
136  if (nh_.getParam("self_collision_map", scm))
137  {
138  success = this->link_to_collision_.initSelfCollision(scm, obstacle_mgr_);
139  }
140 
141  if (!success)
142  {
143  ROS_WARN("Parameter 'self_collision_map' not found or map empty.");
144  }
145 
146  for (LinkToCollision::MapSelfCollisions_t::iterator it = this->link_to_collision_.getSelfCollisionsIterBegin();
148  it++)
149  {
151  }
152  }
153 
154  return 0;
155 }
156 
158 {
159  this->stop_sca_threads_ = true;
160  for (std::vector<std::thread>::iterator it = this->self_collision_transform_threads_.begin();
161  it != this->self_collision_transform_threads_.end(); it++)
162  {
163  it->join();
164  }
165 
166  this->obstacle_mgr_->clear();
167  this->object_of_interest_mgr_->clear();
168 }
169 
170 
171 void DistanceManager::addObstacle(const std::string& id, PtrIMarkerShape_t s)
172 {
173  this->obstacle_mgr_->addShape(id, s);
174 }
175 
176 
178 {
179  this->object_of_interest_mgr_->addShape(id, s);
180 }
181 
182 
184 {
185  this->obstacle_mgr_->draw();
186 }
187 
188 
190 {
191  this->object_of_interest_mgr_->draw();
192 }
193 
194 
196 {
197  cob_control_msgs::ObstacleDistances obstacle_distances;
198 
199  // Transform needs to be calculated only once for robot structure
200  // and is same for all obstacles.
201  if (this->object_of_interest_mgr_->count() > 0)
202  {
203  KDL::FrameVel p_dot_out;
205  adv_chn_fk_solver_vel_->JntToCart(jnt_arr, p_dot_out);
206  }
207 
208  for (ShapesManager::MapIter_t it = this->object_of_interest_mgr_->begin(); it != this->object_of_interest_mgr_->end(); ++it)
209  {
210  std::string object_of_interest_name = it->first;
211  std::vector<std::string>::const_iterator str_it = std::find(this->segments_.begin(),
212  this->segments_.end(),
213  object_of_interest_name);
214  if (this->segments_.end() == str_it)
215  {
216  ROS_ERROR_STREAM("Could not find: " << object_of_interest_name << ". Skipping it ...");
217  continue;
218  }
219 
220  // Representation of segment_of_interest as specific shape
221  PtrIMarkerShape_t ooi = it->second;
222  uint16_t idx = str_it - this->segments_.begin();
223  geometry_msgs::Pose origin_p = ooi->getOriginRelToFrame();
224  KDL::Frame origin_f;
225  tf::poseMsgToKDL(origin_p, origin_f);
226 
227  // ******* Start Transformation part **************
228  KDL::FrameVel frame_vel = adv_chn_fk_solver_vel_->getFrameVelAtSegment(idx);
229  KDL::Frame frame_pos = frame_vel.GetFrame();
230  KDL::Frame frame_with_offset = frame_pos * origin_f;
231 
232  Eigen::Vector3d chainbase2frame_pos(frame_with_offset.p.x(),
233  frame_with_offset.p.y(),
234  frame_with_offset.p.z());
235 
236  Eigen::Affine3d tmp_tf_cb_frame_bl = this->getSynchedCbToBlTransform();
237  Eigen::Affine3d tmp_inv_tf_cb_frame_bl = tmp_tf_cb_frame_bl.inverse();
238  Eigen::Vector3d abs_jnt_pos = tmp_inv_tf_cb_frame_bl * chainbase2frame_pos;
239 
240  Eigen::Quaterniond q;
241  tf::quaternionKDLToEigen(frame_with_offset.M, q);
242  Eigen::Matrix3d x = (tmp_inv_tf_cb_frame_bl * q).rotation();
243  Eigen::Quaterniond q_1(x);
244  // ******* End Transformation part **************
245 
246  geometry_msgs::Vector3 v3;
247  geometry_msgs::Quaternion quat;
248  tf::quaternionEigenToMsg(q_1, quat);
249  tf::vectorEigenToMsg(abs_jnt_pos, v3);
250  ooi->updatePose(v3, quat);
251 
252  fcl::CollisionObject ooi_co = ooi->getCollisionObject();
253  fcl::FCL_REAL last_dist = std::numeric_limits<fcl::FCL_REAL>::max();
254  { // introduced the block to lock this critical section until block leaved.
255  std::lock_guard<std::mutex> lock(obstacle_mgr_mtx_);
256  for (ShapesManager::MapIter_t it = this->obstacle_mgr_->begin(); it != this->obstacle_mgr_->end(); ++it)
257  {
258  const std::string obstacle_id = it->first;
259  if (this->link_to_collision_.ignoreSelfCollisionPart(object_of_interest_name, obstacle_id))
260  {
261  // Ignore elements that can never be in collision
262  // (specified in parameter and parent / child frames)
263  continue;
264  }
265 
266  PtrIMarkerShape_t obstacle = it->second;
267  fcl::CollisionObject collision_obj = obstacle->getCollisionObject();
268  fcl::DistanceResult dist_result;
269  fcl::DistanceRequest dist_request(true, 5.0, 0.01);
270  fcl::FCL_REAL dist = fcl::distance(&ooi_co, &collision_obj, dist_request, dist_result);
271 
272 
273  Eigen::Vector3d abs_obst_vector(dist_result.nearest_points[1][VEC_X],
274  dist_result.nearest_points[1][VEC_Y],
275  dist_result.nearest_points[1][VEC_Z]);
276  Eigen::Vector3d obst_vector = tmp_tf_cb_frame_bl * abs_obst_vector;
277 
278  Eigen::Vector3d abs_jnt_pos_update(dist_result.nearest_points[0][VEC_X],
279  dist_result.nearest_points[0][VEC_Y],
280  dist_result.nearest_points[0][VEC_Z]);
281 
282  // vector from arm base link frame to nearest collision point on frame
283  Eigen::Vector3d rel_base_link_frame_pos = tmp_tf_cb_frame_bl * abs_jnt_pos_update;
284  ROS_DEBUG_STREAM("Link \"" << object_of_interest_name << "\": Minimal distance: " << dist_result.min_distance);
285  if (dist_result.min_distance < MIN_DISTANCE)
286  {
287  cob_control_msgs::ObstacleDistance od_msg;
288  od_msg.distance = dist_result.min_distance;
289  od_msg.link_of_interest = object_of_interest_name;
290  od_msg.obstacle_id = obstacle_id;
291  od_msg.header.frame_id = chain_base_link_;
292  od_msg.header.stamp = ros::Time::now();
293  od_msg.header.seq = seq_nr_;
294  tf::vectorEigenToMsg(obst_vector, od_msg.nearest_point_obstacle_vector);
295  tf::vectorEigenToMsg(rel_base_link_frame_pos, od_msg.nearest_point_frame_vector);
296  tf::vectorEigenToMsg(chainbase2frame_pos, od_msg.frame_vector);
297  obstacle_distances.distances.push_back(od_msg);
298  }
299  }
300  }
301  }
302 
303  if (obstacle_distances.distances.size() > 0)
304  {
305  this->obstacle_distances_pub_.publish(obstacle_distances);
306  }
307 }
308 
309 
311 {
312  while (!this->stop_sca_threads_)
313  {
314  try
315  {
316  tf::StampedTransform cb_transform_bl;
317  ros::Time time = ros::Time(0);
319  {
320  std::lock_guard<std::mutex> lock(mtx_);
322  tf::transformTFToEigen(cb_transform_bl, tf_cb_frame_bl_);
323  }
324  }
325  catch (tf::TransformException& ex)
326  {
327  ROS_ERROR("%s", ex.what());
328  }
329 
330  ros::Duration(0.1).sleep();
331  }
332 }
333 
334 
335 void DistanceManager::transformSelfCollisionLinks(const std::string link_name)
336 {
337  ROS_INFO_STREAM("Starting transform_listener thread for link name: " << link_name);
338  while (!this->stop_sca_threads_)
339  {
340  try
341  {
342  ros::Time time = ros::Time(0);
343  // https://github.com/ros-visualization/rviz/issues/702: TF listener is thread safe
344  if (tf_listener_.waitForTransform(root_frame_id_, link_name, time, ros::Duration(5.0)))
345  {
346  std::lock_guard<std::mutex> lock(obstacle_mgr_mtx_);
347  tf::StampedTransform stamped_transform;
348  geometry_msgs::Transform msg_transform;
349  tf_listener_.lookupTransform(root_frame_id_, link_name, time, stamped_transform);
350  PtrIMarkerShape_t shape_ptr;
351  if (this->obstacle_mgr_->getShape(link_name, shape_ptr))
352  {
353  geometry_msgs::Pose origin_p = shape_ptr->getOriginRelToFrame();
354  tf::Transform tf_origin_pose;
355  tf::poseMsgToTF(origin_p, tf_origin_pose);
356  tf::Transform updated_pose = tf::Transform(stamped_transform) * tf_origin_pose;
357  tf::transformTFToMsg(updated_pose, msg_transform);
358  shape_ptr->updatePose(msg_transform.translation, msg_transform.rotation);
359  }
360  }
361  }
362  catch (tf::TransformException& ex)
363  {
364  ROS_ERROR("%s", ex.what());
365  }
366 
367  ros::Duration(0.1).sleep();
368  }
369 }
370 
371 
372 void DistanceManager::jointstateCb(const sensor_msgs::JointState::ConstPtr& msg)
373 {
374  KDL::JntArray q_temp = last_q_;
375  KDL::JntArray q_dot_temp = last_q_dot_;
376  uint16_t count = 0;
377 
378  for (uint16_t j = 0; j < chain_.getNrOfJoints(); j++)
379  {
380  for (uint16_t i = 0; i < msg->name.size(); i++)
381  {
382  if (strcmp(msg->name[i].c_str(), joints_[j].c_str()) == 0)
383  {
384  q_temp(j) = msg->position[i];
385  q_dot_temp(j) = msg->velocity[i];
386  count++;
387  break;
388  }
389  }
390  }
391 
392  if (joints_.size() == count)
393  {
394  last_q_ = q_temp;
395  last_q_dot_ = q_dot_temp;
396  }
397  else
398  {
399  ROS_ERROR("jointstateCb: received unexpected 'joint_states'");
400  }
401 }
402 
403 
404 void DistanceManager::registerObstacle(const moveit_msgs::CollisionObject::ConstPtr& msg)
405 {
406  std::lock_guard<std::mutex> lock(obstacle_mgr_mtx_);
407 
408  const std::string frame_id = msg->header.frame_id;
409  tf::StampedTransform frame_transform_root;
410  Eigen::Affine3d tf_frame_root;
411 
412  if (msg->meshes.size() > 0 && msg->primitives.size() > 0)
413  {
414  ROS_ERROR_STREAM("registerObstacle: Can either build mesh or primitive but not both in one message for one id.");
415  return;
416  }
417 
418  if (msg->operation == msg->ADD && this->obstacle_mgr_->count(msg->id) > 0)
419  {
420  ROS_ERROR_STREAM("registerObstacle: Element " << msg->id << " exists already. ADD not allowed!");
421  return;
422  }
423 
424  try
425  {
426  ros::Time time = ros::Time(0);
427  tf_listener_.waitForTransform(root_frame_id_, msg->header.frame_id, time, ros::Duration(0.5));
428  tf_listener_.lookupTransform(root_frame_id_, msg->header.frame_id, time, frame_transform_root);
429  tf::transformTFToEigen(frame_transform_root, tf_frame_root);
430  }
431  catch (tf::TransformException& ex)
432  {
433  ROS_ERROR("TransformException: %s", ex.what());
434  return;
435  }
436 
437  if ((msg->type.db.length() > 0 && 0 < msg->mesh_poses.size()) ||
438  (msg->meshes.size() > 0 && msg->meshes.size() == msg->mesh_poses.size()))
439  {
440  this->buildObstacleMesh(msg, frame_transform_root);
441  }
442 
443  if (msg->primitives.size() > 0 && msg->primitives.size() == msg->primitive_poses.size())
444  {
445  this->buildObstaclePrimitive(msg, frame_transform_root);
446  }
447 
448  this->drawObstacles();
449 }
450 
451 
452 void DistanceManager::buildObstacleMesh(const moveit_msgs::CollisionObject::ConstPtr& msg, const tf::StampedTransform& transform)
453 {
454  uint32_t m_size = msg->mesh_poses.size();
455  const std::string package_file_name = msg->type.db; // using db field for package name instead of db json string
456 
457  if (msg->mesh_poses.size() > 1)
458  {
459  ROS_WARN("Currenty only one mesh per message is supported! So only the first one is processed ...");
460  m_size = 1;
461  }
462 
463  if (package_file_name.length() <= 0 && msg->mesh_poses.size() != msg->meshes.size())
464  {
465  ROS_ERROR("Mesh poses and meshes do not have the same size. If package resource string is empty then the sizes must be equal!");
466  return;
467  }
468 
469  if (msg->ADD == msg->operation)
470  {
471  for (uint32_t i = 0; i < m_size; ++i)
472  {
473  geometry_msgs::Pose p = msg->mesh_poses[i];
474  tf::Pose tf_p;
475  tf::poseMsgToTF(p, tf_p);
476  tf::Pose new_tf_p = transform * tf_p;
477  tf::poseTFToMsg(new_tf_p, p);
478  PtrIMarkerShape_t sptr_Bvh;
479  if (package_file_name.length() > 0)
480  {
481  sptr_Bvh.reset(new MarkerShape<BVH_RSS_t>(this->root_frame_id_,
482  package_file_name,
483  p,
485  }
486  else
487  {
488  shape_msgs::Mesh m = msg->meshes[i]; // is only filled in case of no package file name has been given
489  sptr_Bvh.reset(new MarkerShape<BVH_RSS_t>(this->root_frame_id_,
490  m,
491  p,
493  }
494 
495  this->addObstacle(msg->id, sptr_Bvh);
496  }
497  }
498  else if (msg->MOVE == msg->operation)
499  {
500  PtrIMarkerShape_t sptr;
501  for (uint32_t i = 0; i < m_size; ++i)
502  {
503  if (this->obstacle_mgr_->getShape(msg->id, sptr))
504  {
505  geometry_msgs::Pose p = msg->mesh_poses[i];
506  tf::Pose tf_p;
507  tf::poseMsgToTF(p, tf_p);
508  tf::Pose new_tf_p = transform * tf_p;
509  tf::poseTFToMsg(new_tf_p, p);
510  sptr->updatePose(p);
511  }
512  }
513  }
514  else if (msg->REMOVE == msg->operation)
515  {
516  this->obstacle_mgr_->removeShape(msg->id);
517  }
518  else
519  {
520  ROS_ERROR_STREAM("Operation not supported!");
521  }
522 }
523 
524 
525 void DistanceManager::buildObstaclePrimitive(const moveit_msgs::CollisionObject::ConstPtr& msg, const tf::StampedTransform& transform)
526 {
527  uint32_t p_size = msg->primitives.size();
528  if (msg->primitives.size() > 1)
529  {
530  ROS_WARN("Currenty only one primitive per message is supported! So only the first one is processed ...");
531  p_size = 1;
532  }
533 
534  if (msg->ADD == msg->operation)
535  {
536  for (uint32_t i = 0; i < p_size; ++i)
537  {
538  shape_msgs::SolidPrimitive sp = msg->primitives[i];
539  geometry_msgs::Pose p = msg->primitive_poses[i];
540  tf::Pose tf_p;
541  tf::poseMsgToTF(p, tf_p);
542  tf::Pose new_tf_p = transform * tf_p;
543  tf::poseTFToMsg(new_tf_p, p);
544 
545  PtrIMarkerShape_t sptr;
546  Eigen::Vector3d dim;
547  if (shape_msgs::SolidPrimitive::BOX == sp.type)
548  {
549  dim(FCL_BOX_X) = sp.dimensions[shape_msgs::SolidPrimitive::BOX_X];
550  dim(FCL_BOX_Y) = sp.dimensions[shape_msgs::SolidPrimitive::BOX_Y];
551  dim(FCL_BOX_Z) = sp.dimensions[shape_msgs::SolidPrimitive::BOX_Z];
552  }
553  else if (shape_msgs::SolidPrimitive::SPHERE == sp.type)
554  {
555  dim(FCL_RADIUS) = sp.dimensions[shape_msgs::SolidPrimitive::SPHERE_RADIUS];
556  }
557  else if (shape_msgs::SolidPrimitive::CYLINDER == sp.type)
558  {
559  dim(FCL_RADIUS) = sp.dimensions[shape_msgs::SolidPrimitive::CYLINDER_RADIUS];
560  dim(FCL_CYL_LENGTH) = sp.dimensions[shape_msgs::SolidPrimitive::CYLINDER_HEIGHT];
561  }
562  else
563  {
564  ROS_ERROR_STREAM("Shape type not supported: " << sp.type);
565  break;
566  }
567 
568  uint32_t shape_type = g_shapeMsgTypeToVisMarkerType.map_[sp.type];
570  p,
571  msg->id,
572  dim,
573  sptr);
574  this->addObstacle(msg->id, sptr);
575  }
576  }
577  else if (msg->MOVE == msg->operation)
578  {
579  PtrIMarkerShape_t sptr;
580  for (uint32_t i = 0; i < p_size; ++i)
581  {
582  if (this->obstacle_mgr_->getShape(msg->id, sptr))
583  {
584  geometry_msgs::Pose p = msg->primitive_poses[i];
585  tf::Pose tf_p;
586  tf::poseMsgToTF(p, tf_p);
587  tf::Pose new_tf_p = transform * tf_p;
588  tf::poseTFToMsg(new_tf_p, p);
589  sptr->updatePose(p);
590  }
591  }
592  }
593  else if (msg->REMOVE == msg->operation)
594  {
595  this->obstacle_mgr_->removeShape(msg->id);
596  }
597  else
598  {
599  ROS_ERROR_STREAM("Operation not supported!");
600  }
601 }
602 
603 
604 bool DistanceManager::registerLinkOfInterest(cob_srvs::SetString::Request& request,
605  cob_srvs::SetString::Response& response)
606 {
607  if (this->object_of_interest_mgr_->count(request.data) > 0)
608  {
609  response.success = true;
610  response.message = "Element " + request.data + " already registered.";
611  }
612  else
613  {
614  try
615  {
616  PtrIMarkerShape_t ooi;
617  Eigen::Quaterniond q;
618  Eigen::Vector3d v3;
619  if (this->link_to_collision_.getMarkerShapeFromUrdf(v3, q, request.data, ooi))
620  {
621  this->addObjectOfInterest(request.data, ooi);
622  response.success = true;
623  response.message = "Successfully registered element " + request.data + ".";
624  }
625  else
626  {
627  response.success = false;
628  response.message = "Failed to register element " + request.data + "!";
629  }
630  }
631  catch(...)
632  {
633  response.success = false;
634  response.message = "Failed to register element " + request.data + "!";
635  ROS_ERROR_STREAM(response.message);
636  }
637  }
638 
639  ROS_INFO_STREAM("DistanceManager::Registration: " << response.message);
640  return true;
641 }
642 
643 
645 {
646  std::lock_guard<std::mutex> lock(mtx_);
647  return this->tf_cb_frame_bl_;
648 }
void addObstacle(const std::string &id, PtrIMarkerShape_t s)
IMETHOD Frame GetFrame() const
std::vector< std::thread > self_collision_transform_threads_
std::mutex obstacle_mgr_mtx_
static void poseMsgToTF(const geometry_msgs::Pose &msg, Pose &bt)
#define FCL_RADIUS
Class to manage fcl::Shapes and connect with RVIZ marker type.
const Segment & getSegment(unsigned int nr) const
std::shared_ptr< IMarkerShape > PtrIMarkerShape_t
KDL::JntArray last_q_dot_
void publish(const boost::shared_ptr< M > &message) const
tf::TransformListener tf_listener_
std::string chain_base_link_
void transformTFToEigen(const tf::Transform &t, Eigen::Affine3d &e)
#define VEC_Y
ros::Publisher obstacle_distances_pub_
void quaternionEigenToMsg(const Eigen::Quaterniond &e, geometry_msgs::Quaternion &m)
std::vector< std::string > joints_
ros::NodeHandle & nh_
XmlRpcServer s
bool sleep() const
void jointstateCb(const sensor_msgs::JointState::ConstPtr &msg)
unsigned int getNrOfSegments() const
MapSelfCollisions_t::iterator getSelfCollisionsIterBegin()
void buildObstacleMesh(const moveit_msgs::CollisionObject::ConstPtr &msg, const tf::StampedTransform &transform)
#define FCL_CYL_LENGTH
#define MIN_DISTANCE
void quaternionKDLToEigen(const KDL::Rotation &k, Eigen::Quaterniond &e)
boost::scoped_ptr< ShapesManager > object_of_interest_mgr_
#define ROS_WARN(...)
double z() const
std::string root_frame_id_
Rotation M
bool waitForTransform(const std::string &target_frame, const std::string &source_frame, const ros::Time &time, const ros::Duration &timeout, const ros::Duration &polling_sleep_duration=ros::Duration(0.01), std::string *error_msg=NULL) const
MapSelfCollisions_t::iterator getSelfCollisionsIterEnd()
DistanceManager(ros::NodeHandle &nh)
const std::string & getName() const
boost::scoped_ptr< ShapesManager > obstacle_mgr_
bool registerLinkOfInterest(cob_srvs::SetString::Request &request, cob_srvs::SetString::Response &response)
std::unordered_map< std::string, PtrIMarkerShape_t >::iterator MapIter_t
double y() const
bool ignoreSelfCollisionPart(const std::string &link_of_interest, const std::string &self_collision_obstacle_link)
void vectorEigenToMsg(const Eigen::Vector3d &e, geometry_msgs::Vector3 &m)
double x() const
std::vector< std::string > segments_
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)
void poseMsgToKDL(const geometry_msgs::Pose &m, KDL::Frame &k)
Publisher advertise(const std::string &topic, uint32_t queue_size, bool latch=false)
unsigned int getNrOfJoints() const
KDL::JntArray last_q_
boost::scoped_ptr< AdvancedChainFkSolverVel_recursive > adv_chn_fk_solver_vel_
#define VEC_Z
#define ROS_DEBUG_STREAM(args)
void lookupTransform(const std::string &target_frame, const std::string &source_frame, const ros::Time &time, StampedTransform &transform) const
LinkToCollision link_to_collision_
static ShapeMsgTypeToVisMarkerType g_shapeMsgTypeToVisMarkerType
void transformSelfCollisionLinks(const std::string link_name)
bool getChain(const std::string &chain_root, const std::string &chain_tip, Chain &chain) const
KDL_PARSER_PUBLIC bool treeFromParam(const std::string &param, KDL::Tree &tree)
static void poseTFToMsg(const Pose &bt, geometry_msgs::Pose &msg)
#define ROS_INFO_STREAM(args)
Eigen::Affine3d tf_cb_frame_bl_
bool getParam(const std::string &key, std::string &s) const
ros::Publisher marker_pub_
std::string chain_tip_link_
std::unordered_map< uint8_t, uint32_t > map_
void buildObstaclePrimitive(const moveit_msgs::CollisionObject::ConstPtr &msg, const tf::StampedTransform &transform)
static uint32_t seq_nr_
static Time now()
#define VEC_X
void registerObstacle(const moveit_msgs::CollisionObject::ConstPtr &msg)
#define ROS_ERROR_STREAM(args)
Eigen::Affine3d getSynchedCbToBlTransform()
#define ROS_ERROR(...)
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)
static void transformTFToMsg(const Transform &bt, geometry_msgs::Transform &msg)
void addObjectOfInterest(const std::string &id, PtrIMarkerShape_t s)
bool initParameter(const std::string &root_frame_id, const std::string &urdf_param)


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