semantic_world.h
Go to the documentation of this file.
1 /*********************************************************************
2  * Software License Agreement (BSD License)
3  *
4  * Copyright (c) 2013, Willow Garage, Inc.
5  * All rights reserved.
6  *
7  * Redistribution and use in source and binary forms, with or without
8  * modification, are permitted provided that the following conditions
9  * are met:
10  *
11  * * Redistributions of source code must retain the above copyright
12  * notice, this list of conditions and the following disclaimer.
13  * * Redistributions in binary form must reproduce the above
14  * copyright notice, this list of conditions and the following
15  * disclaimer in the documentation and/or other materials provided
16  * with the distribution.
17  * * Neither the name of Willow Garage nor the names of its
18  * contributors may be used to endorse or promote products derived
19  * from this software without specific prior written permission.
20  *
21  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
24  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
25  * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
26  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
27  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
28  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
29  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
31  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
32  * POSSIBILITY OF SUCH DAMAGE.
33  *********************************************************************/
34 
35 /* Author: Sachin Chitta */
36 
37 #pragma once
38 
39 #include <ros/ros.h>
42 #include <object_recognition_msgs/TableArray.h>
43 #include <moveit_msgs/CollisionObject.h>
44 #include <boost/thread/mutex.hpp>
46 
47 namespace shapes
48 {
49 MOVEIT_CLASS_FORWARD(Shape); // Defines ShapePtr, ConstPtr, WeakPtr... etc
50 }
51 
52 namespace moveit
53 {
54 namespace semantic_world
55 {
56 MOVEIT_CLASS_FORWARD(SemanticWorld); // Defines SemanticWorldPtr, ConstPtr, WeakPtr... etc
57 
62 {
63 public:
65  typedef boost::function<void()> TableCallbackFn;
66 
71  SemanticWorld(const planning_scene::PlanningSceneConstPtr& planning_scene);
72 
76  object_recognition_msgs::TableArray getTablesInROI(double minx, double miny, double minz, double maxx, double maxy,
77  double maxz) const;
78 
82  std::vector<std::string> getTableNamesInROI(double minx, double miny, double minz, double maxx, double maxy,
83  double maxz) const;
84 
90  std::vector<geometry_msgs::PoseStamped> generatePlacePoses(const std::string& table_name,
91  const shapes::ShapeConstPtr& object_shape,
92  const geometry_msgs::Quaternion& object_orientation,
93  double resolution, double delta_height = 0.01,
94  unsigned int num_heights = 2) const;
95 
101  std::vector<geometry_msgs::PoseStamped> generatePlacePoses(const object_recognition_msgs::Table& table,
102  const shapes::ShapeConstPtr& object_shape,
103  const geometry_msgs::Quaternion& object_orientation,
104  double resolution, double delta_height = 0.01,
105  unsigned int num_heights = 2) const;
113  std::vector<geometry_msgs::PoseStamped> generatePlacePoses(const object_recognition_msgs::Table& table,
114  double resolution, double height_above_table,
115  double delta_height = 0.01, unsigned int num_heights = 2,
116  double min_distance_from_edge = 0.10) const;
117 
118  void clear();
119 
121 
122  visualization_msgs::MarkerArray getPlaceLocationsMarker(const std::vector<geometry_msgs::PoseStamped>& poses) const;
123 
124  void addTableCallback(const TableCallbackFn& table_callback)
125  {
126  table_callback_ = table_callback;
127  }
128 
129  std::string findObjectTable(const geometry_msgs::Pose& pose, double min_distance_from_edge = 0.0,
130  double min_vertical_offset = 0.0) const;
131 
132  bool isInsideTableContour(const geometry_msgs::Pose& pose, const object_recognition_msgs::Table& table,
133  double min_distance_from_edge = 0.0, double min_vertical_offset = 0.0) const;
134 
135 private:
136  shapes::Mesh* createSolidMeshFromPlanarPolygon(const shapes::Mesh& polygon, double thickness) const;
137 
138  shapes::Mesh* orientPlanarPolygon(const shapes::Mesh& polygon) const;
139 
140  void tableCallback(const object_recognition_msgs::TableArrayPtr& msg);
141 
142  void transformTableArray(object_recognition_msgs::TableArray& table_array) const;
143 
144  planning_scene::PlanningSceneConstPtr planning_scene_;
145 
147 
148  object_recognition_msgs::TableArray table_array_;
149 
150  std::vector<geometry_msgs::PoseStamped> place_poses_;
151 
152  std::map<std::string, object_recognition_msgs::Table> current_tables_in_collision_world_;
153 
154  // boost::mutex table_lock_;
155 
157 
159 
161 
163 };
164 } // namespace semantic_world
165 } // namespace moveit
moveit::semantic_world::SemanticWorld::isInsideTableContour
bool isInsideTableContour(const geometry_msgs::Pose &pose, const object_recognition_msgs::Table &table, double min_distance_from_edge=0.0, double min_vertical_offset=0.0) const
Definition: semantic_world.cpp:453
moveit::semantic_world::SemanticWorld::SemanticWorld
SemanticWorld(const planning_scene::PlanningSceneConstPtr &planning_scene)
A (simple) semantic world representation for pick and place and other tasks. Currently this is used o...
Definition: semantic_world.cpp:123
shapes
moveit::semantic_world::SemanticWorld::table_subscriber_
ros::Subscriber table_subscriber_
Definition: semantic_world.h:156
ros::Publisher
moveit::semantic_world::SemanticWorld::findObjectTable
std::string findObjectTable(const geometry_msgs::Pose &pose, double min_distance_from_edge=0.0, double min_vertical_offset=0.0) const
Definition: semantic_world.cpp:516
moveit::semantic_world::SemanticWorld::planning_scene_
planning_scene::PlanningSceneConstPtr planning_scene_
Definition: semantic_world.h:144
moveit::semantic_world::SemanticWorld::node_handle_
ros::NodeHandle node_handle_
Definition: semantic_world.h:146
ros.h
moveit::semantic_world::SemanticWorld::getTablesInROI
object_recognition_msgs::TableArray getTablesInROI(double minx, double miny, double minz, double maxx, double maxy, double maxz) const
Get all the tables within a region of interest.
Definition: semantic_world.cpp:237
shapes::MOVEIT_CLASS_FORWARD
MOVEIT_CLASS_FORWARD(Shape)
moveit::semantic_world::SemanticWorld::orientPlanarPolygon
shapes::Mesh * orientPlanarPolygon(const shapes::Mesh &polygon) const
Definition: semantic_world.cpp:565
shapes::Mesh
moveit::semantic_world::SemanticWorld::tableCallback
void tableCallback(const object_recognition_msgs::TableArrayPtr &msg)
Definition: semantic_world.cpp:529
moveit::semantic_world::SemanticWorld::planning_scene_diff_publisher_
ros::Publisher planning_scene_diff_publisher_
Definition: semantic_world.h:162
moveit::semantic_world::SemanticWorld::TableCallbackFn
boost::function< void()> TableCallbackFn
The signature for a callback on receiving table messages.
Definition: semantic_world.h:65
moveit::semantic_world::SemanticWorld::transformTableArray
void transformTableArray(object_recognition_msgs::TableArray &table_array) const
Definition: semantic_world.cpp:542
moveit::semantic_world::SemanticWorld::addTableCallback
void addTableCallback(const TableCallbackFn &table_callback)
Definition: semantic_world.h:124
moveit::semantic_world::SemanticWorld::getTableNamesInROI
std::vector< std::string > getTableNamesInROI(double minx, double miny, double minz, double maxx, double maxy, double maxz) const
Get all the tables within a region of interest.
Definition: semantic_world.cpp:254
moveit::semantic_world::SemanticWorld::place_poses_
std::vector< geometry_msgs::PoseStamped > place_poses_
Definition: semantic_world.h:150
moveit::semantic_world::SemanticWorld::collision_object_publisher_
ros::Publisher collision_object_publisher_
Definition: semantic_world.h:158
moveit::semantic_world::SemanticWorld::generatePlacePoses
std::vector< geometry_msgs::PoseStamped > generatePlacePoses(const std::string &table_name, const shapes::ShapeConstPtr &object_shape, const geometry_msgs::Quaternion &object_orientation, double resolution, double delta_height=0.01, unsigned int num_heights=2) const
Generate possible place poses on the table for a given object. This chooses appropriate values for mi...
Definition: semantic_world.cpp:278
moveit::semantic_world::MOVEIT_CLASS_FORWARD
MOVEIT_CLASS_FORWARD(SemanticWorld)
moveit::semantic_world::SemanticWorld::table_array_
object_recognition_msgs::TableArray table_array_
Definition: semantic_world.h:148
moveit::semantic_world::SemanticWorld::getPlaceLocationsMarker
visualization_msgs::MarkerArray getPlaceLocationsMarker(const std::vector< geometry_msgs::PoseStamped > &poses) const
Definition: semantic_world.cpp:133
moveit::semantic_world::SemanticWorld::addTablesToCollisionWorld
bool addTablesToCollisionWorld()
Definition: semantic_world.cpp:160
moveit::semantic_world::SemanticWorld::visualization_publisher_
ros::Publisher visualization_publisher_
Definition: semantic_world.h:158
moveit::semantic_world::SemanticWorld
A (simple) semantic world representation for pick and place and other tasks.
Definition: semantic_world.h:61
moveit::semantic_world::SemanticWorld::table_callback_
TableCallbackFn table_callback_
Definition: semantic_world.h:160
planning_scene.h
moveit
class_forward.h
moveit::semantic_world::SemanticWorld::createSolidMeshFromPlanarPolygon
shapes::Mesh * createSolidMeshFromPlanarPolygon(const shapes::Mesh &polygon, double thickness) const
Definition: semantic_world.cpp:622
shapes::ShapeConstPtr
std::shared_ptr< const Shape > ShapeConstPtr
planning_scene
moveit::semantic_world::SemanticWorld::clear
void clear()
Definition: semantic_world.cpp:271
ros::NodeHandle
ros::Subscriber
moveit::semantic_world::SemanticWorld::current_tables_in_collision_world_
std::map< std::string, object_recognition_msgs::Table > current_tables_in_collision_world_
Definition: semantic_world.h:152


perception
Author(s): Ioan Sucan , Jon Binney , Suat Gedikli
autogenerated on Wed Feb 21 2024 03:26:19