Advertisement
Guest User

svn diff old1

a guest
Nov 12th, 2012
145
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.29 KB | None | 0 0
  1. svn diff https://code.ros.org/svn/wg-ros-pkg/stacks/tabletop_object_perception/branches/0.4-branch-old1/tabletop_collision_map_processing/ https://code.ros.org/svn/wg-ros-pkg/stacks/tabletop_object_perception/branches/0.4-branch/tabletop_collision_map_processing/
  2. Index: include/tabletop_collision_map_processing/collision_map_interface.h
  3. ===================================================================
  4. --- include/tabletop_collision_map_processing/collision_map_interface.h (.../0.4-branch-old1/tabletop_collision_map_processing) (revision 55195)
  5. +++ include/tabletop_collision_map_processing/collision_map_interface.h (.../0.4-branch/tabletop_collision_map_processing) (revision 55195)
  6. @@ -93,6 +93,9 @@
  7. //! Client for getting the mesh for a database object
  8. ros::ServiceClient get_model_mesh_srv_;
  9.  
  10. + //! The topic for the point cloud used for static maps
  11. + std::string static_map_cloud_name_;
  12. +
  13. //! Counts the number of objects added to the map since the last reset
  14. int collision_object_current_id_;
  15.  
  16. @@ -113,6 +116,12 @@
  17. //! Connects all the services that it uses to their appropriate service names
  18. void connectServices();
  19.  
  20. + //! Only keep every point_skip_num_ points when adding a point cloud collision object
  21. + int point_skip_num_;
  22. +
  23. + //! Only keep every point_skip_num_ points when adding a point cloud collision object
  24. + int collision_box_size_;
  25. +
  26. public:
  27. //! Connects and waits for all needed services and action servers
  28. CollisionMapInterface();
  29. @@ -132,7 +141,7 @@
  30.  
  31. //! Sends collision geometry for a point cloud into the collision map
  32. void processCollisionGeometryForCluster(const sensor_msgs::PointCloud &cluster,
  33. - std::string &collision_name);
  34. + std::string &collision_name, float collision_size = -1.0);
  35.  
  36. //! Sends collision geometry for a bounding box into the collision map
  37. void processCollisionGeometryForBoundingBox(const object_manipulation_msgs::ClusterBoundingBox &box,
  38. Index: src/collision_map_interface.cpp
  39. ===================================================================
  40. --- src/collision_map_interface.cpp (.../0.4-branch-old1/tabletop_collision_map_processing) (revision 55195)
  41. +++ src/collision_map_interface.cpp (.../0.4-branch/tabletop_collision_map_processing) (revision 55195)
  42. @@ -69,6 +69,9 @@
  43. collision_map_reset_client_ = root_nh_.serviceClient<std_srvs::Empty>(RESET_COLLISION_MAP_NAME, true);
  44. cluster_bounding_box_client_ = root_nh_.serviceClient<object_manipulation_msgs::FindClusterBoundingBox>
  45. (CLUSTER_BOUNDING_BOX_NAME, true);
  46. + priv_nh_.param<std::string>("static_map_cloud_name", static_map_cloud_name_, "full_cloud_filtered");
  47. + priv_nh_.param<int>("point_skip_num", point_skip_num_, 1);
  48. + priv_nh_.param<int>("collision_box_size", collision_box_size_, 0.003);
  49. }
  50.  
  51. bool CollisionMapInterface::connectionsPresent()
  52. @@ -148,7 +151,7 @@
  53. void CollisionMapInterface::takeStaticMap()
  54. {
  55. collision_environment_msgs::MakeStaticCollisionMapGoal static_map_goal;
  56. - static_map_goal.cloud_source = "full_cloud_filtered";
  57. + static_map_goal.cloud_source = static_map_cloud_name_;
  58. static_map_goal.number_of_clouds = 2;
  59.  
  60. make_static_collision_map_client_.sendGoal(static_map_goal);
  61. @@ -245,7 +248,7 @@
  62. }
  63.  
  64. void CollisionMapInterface::processCollisionGeometryForCluster(const sensor_msgs::PointCloud &cluster,
  65. - std::string &collision_name)
  66. + std::string &collision_name, float collision_size)
  67. {
  68. ROS_INFO("Adding cluster with %u points to collision map", (unsigned int)cluster.points.size());
  69.  
  70. @@ -253,21 +256,25 @@
  71. many_boxes.operation.operation = mapping_msgs::CollisionObjectOperation::ADD;
  72. many_boxes.header = cluster.header;
  73. many_boxes.header.stamp = ros::Time::now();
  74. - unsigned int num_to_use = (unsigned int)(cluster.points.size()/100.0);
  75. + unsigned int num_to_use = (unsigned int)(cluster.points.size()/point_skip_num_);
  76. many_boxes.shapes.resize(num_to_use);
  77. many_boxes.poses.resize(num_to_use);
  78. +
  79. + if(collision_size < 0)
  80. + collision_size = collision_box_size_;
  81. +
  82. for(unsigned int i = 0; i < num_to_use; i++) {
  83. geometric_shapes_msgs::Shape shape;
  84. shape.type = geometric_shapes_msgs::Shape::BOX;
  85. shape.dimensions.resize(3);
  86. - shape.dimensions[0] = .005;
  87. - shape.dimensions[1] = .005;
  88. - shape.dimensions[2] = .005;
  89. + shape.dimensions[0] = collision_size;
  90. + shape.dimensions[1] = collision_size;
  91. + shape.dimensions[2] = collision_size;
  92. many_boxes.shapes[i]=shape;
  93. geometry_msgs::Pose pose;
  94. - pose.position.x = cluster.points[i*100].x;
  95. - pose.position.y = cluster.points[i*100].y;
  96. - pose.position.z = cluster.points[i*100].z;
  97. + pose.position.x = cluster.points[i*point_skip_num_].x;
  98. + pose.position.y = cluster.points[i*point_skip_num_].y;
  99. + pose.position.z = cluster.points[i*point_skip_num_].z;
  100. pose.orientation.x = 0;
  101. pose.orientation.y = 0;
  102. pose.orientation.z = 0;
  103. @@ -293,7 +300,7 @@
  104. {
  105. ROS_INFO("Waiting for %s service to come up", get_model_mesh_srv_name.c_str());
  106. }
  107. - if (!root_nh_.ok()) exit(0);
  108. + if (!root_nh_.ok()) return false;
  109. get_model_mesh_srv_ = root_nh_.serviceClient<household_objects_database_msgs::GetModelMesh>
  110. (get_model_mesh_srv_name, true);
  111. service_initialized = true;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement