found_object_handler.hpp
Go to the documentation of this file.
1 
18 #pragma once
19 
20 // Global Inclusion
21 #include <boost/shared_ptr.hpp>
22 #include <vector>
23 #include <map>
24 #include <list>
25 #include <eigen3/Eigen/Geometry>
26 
27 
28 // ROS Main Inclusion
29 #include <ros/ros.h>
30 
31 
32 // ROS-wide Inclusion
33 #include <asr_msgs/AsrObject.h>
34 #include <asr_object_database/ObjectMetaData.h>
35 #include <std_srvs/Empty.h>
36 #include <geometry_msgs/PoseStamped.h>
37 #include <tf/transform_listener.h>
38 
39 
40 // Local Inclusion
41 #include "asr_world_model/GetFoundObjectList.h"
42 #include "asr_world_model/PushFoundObject.h"
43 #include "asr_world_model/PushFoundObjectList.h"
44 #include "asr_world_model/VisualizeSampledPoses.h"
45 
52 
53 namespace world_model
54 {
55 
56 
61 {
62 public:
63  /* ----------------- Public members ------------------ */
64  // Wrapped Constants
65 
66  // PushFoundObject
67  static const inline std::string GetPushFoundObjectServiceName()
68  { return "push_found_object"; }
69 
70  // PushFoundObjectList
71  static const inline std::string GetPushFoundObjectListServiceName()
72  { return "push_found_object_list"; }
73 
74  // EmptyFoundObjectList
75  static const inline std::string GetEmptyFoundObjectListServiceName()
76  { return "empty_found_object_list"; }
77 
78  // GetFoundObjectList
79  static const inline std::string GetGetFoundObjectListServiceName()
80  { return "get_found_object_list"; }
81 
82  // VisualizeSampledPoses
83  static const inline std::string GetVisualizeSampledPosesName()
84  { return "visualize_sampled_poses"; }
85 
86 private:
87  const double DEG_TO_RAD = M_PI / 180.0;
88  const double EPSILON = 0.0001;
89 
90  /* ----------------- Private members ------------------ */
94 
95  // Services
97 
98  // Clients
100 
102 
104 
105 public:
106  /* ----------------- Public functions ------------------ */
111  boost::shared_ptr<ros::ServiceClient> object_type_client_ptr,
112  ModelTypePtrPerTypeMapPtr model_type_ptr_per_type_map_ptr,
113  SettingsPtr settings_ptr);
114 
121  bool processEmptyFoundObjectListServiceCall(std_srvs::Empty::Request &request,
122  std_srvs::Empty::Response &response);
123 
130  bool processGetFoundObjectListServiceCall(asr_world_model::GetFoundObjectList::Request &request,
131  asr_world_model::GetFoundObjectList::Response &response);
138  bool processPushFoundObjectListServiceCall(asr_world_model::PushFoundObjectList::Request &request,
139  asr_world_model::PushFoundObjectList::Response &response);
140 
147  inline bool processPushFoundObjectServiceCall(asr_world_model::PushFoundObject::Request &request,
148  asr_world_model::PushFoundObject::Response &response)
149  {
150  debug_helper_ptr_->write(std::stringstream() << "Calling processPushFoundObjectServiceCall", (DebugHelper::SERVICE_CALLS + DebugHelper::FOUND_OBJECT));
151  return pushFoundObject(request.found_object);
152  }
153 
154  bool processVisualizeSampledPosesCall(asr_world_model::VisualizeSampledPoses::Request &request,
155  asr_world_model::VisualizeSampledPoses::Response &response);
156 
157 private:
158  /* ----------------- Private functions ------------------ */
159 
165  bool pushFoundObject(asr_msgs::AsrObject &candidate);
166 
167  void updateBestHypothesis(ModelObjectPtr &currentModelObjectPtr, const asr_msgs::AsrObject &candidate);
168 
174  bool sampleFoundObject(asr_msgs::AsrObject &candidate);
175 
180  bool transformToBaseFrame(asr_msgs::AsrObject &candidate) const;
181 
187  bool evaluateNeighborhood(const asr_msgs::AsrObject &object1, const asr_msgs::AsrObject &object2) const;
188 
189 
190  //COMMENT
191  void visualizeFoundObjects();
192 
193  std::vector<geometry_msgs::Pose> interpolateOrientationAroundAxis(
194  const geometry_msgs::Pose &poseToInterpolate, const double interpolationOffset, const Eigen::Vector3d &axisToRotate, const int numberOfInterpolationsPerOrientation) const;
195 
196  geometry_msgs::Pose rotateOrientationAroundAxis(const geometry_msgs::Pose &poseToRotate, const double interpolationOffset, const Eigen::Vector3d &axisToRotate) const;
197 
198  std::vector<geometry_msgs::Pose> interpolatePoses(const geometry_msgs::Pose &fromPose, const geometry_msgs::Pose &toPose, const int numberOfInterpolations) const;
199 
200 };
201 
202 
203 inline bool comparePbdObjectCluster (const PbdObjectCluster& first, const PbdObjectCluster& second)
204 {
205  return ( first.second > second.second );
206 }
207 
208 }
bool processEmptyFoundObjectListServiceCall(std_srvs::Empty::Request &request, std_srvs::Empty::Response &response)
Empties the found object list.
geometry_msgs::Pose rotateOrientationAroundAxis(const geometry_msgs::Pose &poseToRotate, const double interpolationOffset, const Eigen::Vector3d &axisToRotate) const
FoundObjectHandler(boost::shared_ptr< ros::Publisher > marker_publisher_ptr, boost::shared_ptr< ros::ServiceClient > object_type_client_ptr, ModelTypePtrPerTypeMapPtr model_type_ptr_per_type_map_ptr, SettingsPtr settings_ptr)
Creates a new instance of FoundObjectHandler.
void updateBestHypothesis(ModelObjectPtr &currentModelObjectPtr, const asr_msgs::AsrObject &candidate)
static const std::string GetPushFoundObjectListServiceName()
bool processGetFoundObjectListServiceCall(asr_world_model::GetFoundObjectList::Request &request, asr_world_model::GetFoundObjectList::Response &response)
Returns the already found objects.
bool transformToBaseFrame(asr_msgs::AsrObject &candidate) const
Transform object pose to base frame of world model.
tf::TransformListener tf_transform_listener_
std::vector< geometry_msgs::Pose > interpolateOrientationAroundAxis(const geometry_msgs::Pose &poseToInterpolate, const double interpolationOffset, const Eigen::Vector3d &axisToRotate, const int numberOfInterpolationsPerOrientation) const
WorldModel class provides services for adding the viewports of the next best views to a list and retr...
static const std::string GetEmptyFoundObjectListServiceName()
WorldModelVisualizerRVIZPtr world_model_visualizer_ptr_
boost::shared_ptr< ros::ServiceClient > object_type_client_ptr_
std::vector< geometry_msgs::Pose > interpolatePoses(const geometry_msgs::Pose &fromPose, const geometry_msgs::Pose &toPose, const int numberOfInterpolations) const
bool comparePbdObjectCluster(const PbdObjectCluster &first, const PbdObjectCluster &second)
bool processVisualizeSampledPosesCall(asr_world_model::VisualizeSampledPoses::Request &request, asr_world_model::VisualizeSampledPoses::Response &response)
bool pushFoundObject(asr_msgs::AsrObject &candidate)
bool sampleFoundObject(asr_msgs::AsrObject &candidate)
Generates samples for object pose estimation to model uncertainty.
bool evaluateNeighborhood(const asr_msgs::AsrObject &object1, const asr_msgs::AsrObject &object2) const
Determines if two objects are neighbors to each other in terms of position and orientation distance...
ModelTypePtrPerTypeMapPtr model_type_ptr_per_type_map_ptr_
static const std::string GetPushFoundObjectServiceName()
bool processPushFoundObjectListServiceCall(asr_world_model::PushFoundObjectList::Request &request, asr_world_model::PushFoundObjectList::Response &response)
Pushes the found object to a list.
static const std::string GetVisualizeSampledPosesName()
std::pair< asr_msgs::AsrObject, int > PbdObjectCluster
bool processPushFoundObjectServiceCall(asr_world_model::PushFoundObject::Request &request, asr_world_model::PushFoundObject::Response &response)
Pushes the found object to a list.
static const std::string GetGetFoundObjectListServiceName()


asr_world_model
Author(s): Aumann Florian, Borella Jocelyn, Hutmacher Robin, Karrenbauer Oliver, Meißner Pascal, Schleicher Ralf, Stöckle Patrick, Trautmann Jeremias
autogenerated on Thu Jan 9 2020 07:20:01