DefaultRatingModule.hpp
Go to the documentation of this file.
1 
20 #pragma once
21 
22 #include <ros/ros.h>
23 #include <boost/foreach.hpp>
30 #include <robot_model_services/robot_model/RobotModel.hpp>
31 
32 namespace next_best_view {
41  private:
42  /*
43  * parameters to calculate the utility / costs
44  */
45  // the threshold for the angle between the orientation of an object and the camera orientation
47  // horizontal and vertical field of view in degree
48  double mFovV,mFovH;
49  // distance of far and near clipping plane in meters
50  double mFcp,mNcp;
51  // weight of the utility
52  double mOmegaUtility;
53  // weight of the movement costs of the pan-axis for the PTU
54  double mOmegaPan;
55  // weight of the movement costs of the tilt-axis for the PTU
56  double mOmegaTilt;
57  // weight of the rotation costs of the robot base
58  double mOmegaRot;
59  // weight of the translational movement costs of the robot base
60  double mOmegaBase;
61  // weight of the recognition costs
63 
64  // whether it should be checked if the calculated target robot state is reachable
65  bool mUseTargetRobotState = false;
66 
67  /*
68  * parameters to disable / enable parts of utility calculation
69  */
71  bool mUseProximityUtility = true;
72  bool mUseSideUtility = true;
73 
74  /*
75  * help members
76  */
77  robot_model_services::RobotModelPtr mRobotModelPtr;
81 
82  /*
83  * members to cache the calculated data for one call of setBaseScoreContainer
84  * must be reset everytime setBaseScoreContainer is called
85  */
86  // the utility for each object type
87  std::map<std::string, float> mUnweightedUnnormalizedObjectUtilities;
88  // the full costs of the movement - does not contain the costs of the recognition
90  // the costs of the translational movement of the base
92  // the costs of the rotational movement of the base
94  // the costs of the PTU movement
96  // the costs of the recognition of the objects
98  // the normalization value for the rating
99  double mRatingNormalization = -1;
100  // the PTU omega parameter
102  // the target state
103  robot_model_services::RobotStatePtr mTargetState = NULL;
104 
105  /*
106  * members to cache the calculated data
107  */
108  // the maximum recognition costs - stays the same as long as the input cloud does not change
110  // whether the input cloud changed since the last time the maximum recognition costs were updated
111  bool mInputCloudChanged = true;
112 
113  public:
115 
116  DefaultRatingModule(double fovV, double fovH, double fcp, double ncp, bool useTargetRobotState,
117  const robot_model_services::RobotModelPtr &robotModelPtr = robot_model_services::RobotModelPtr(),
118  const MapHelperPtr &mapHelperPtr = MapHelperPtr(),
119  const CameraModelFilterPtr &cameraModelFilterPtr = CameraModelFilterPtr());
120 
121  virtual ~DefaultRatingModule();
122 
123  void setInputCloud(const ObjectPointCloudPtr &pointCloudPtr);
124 
125  bool setBestScoreContainer(const ViewportPoint &currentViewport, ViewportPoint &candidateViewport);
126 
127  bool getBestViewport(ViewportPointCloudPtr &viewports, ViewportPoint &bestViewport);
128 
129  bool compareViewports(const ViewportPoint &a, const ViewportPoint &b);
130 
132 
134 
142  float getOrientationUtility(const ViewportPoint &viewport, ObjectPoint &objectPoint);
143 
151  float getFrustumPositionUtility(const ViewportPoint &viewport, ObjectPoint &objectPoint);
152 
161  float getNormalUtility(const ViewportPoint &viewport, const SimpleVector3 &objectNormalVector, const SimpleVector3 &objectPosition);
162 
172  float getNormalUtility(const ViewportPoint &viewport, const SimpleVector3 &objectNormalVector, const SimpleVector3 &objectPosition, double angleThreshold);
173 
182  float getProximityUtility(const ViewportPoint &viewport, const ObjectPoint &objectPoint);
183 
192  float getSideUtility(const ViewportPoint &viewport, const ObjectPoint &objectPoint);
193 
199  float getRating(const BaseScoreContainerPtr &a);
200 
205  void setNormalAngleThreshold(double angle);
206 
211  double getNormalAngleThreshold();
212 
220  float getNormalizedAngleUtility(const SimpleVector3 v1, const SimpleVector3 v2, double angleThreshold);
221 
225  void setOmegaParameters(double omegaUtility, double omegaPan, double omegaTilt, double omegaRot, double omegaBase, double omegaRecognition);
226 
227  void setFrustumParameters(double fovV, double fovH, double fcp, double ncp);
228 
229  void setUseTargetRobotState(bool useTargetRobotState);
230 
231  void setUtilityParameters(bool useOrientationUtility = true, bool useProximityUtility = true, bool useSideUtility = true);
232 
233  bool setSingleScoreContainer(const ViewportPoint &currentViewport,
234  ViewportPoint &candidateViewport);
235 
240  void setRobotState(robot_model_services::RobotStatePtr robotState);
241 
245  void resetCache();
246 
247  private:
255  float getNormalizedRating(float deviation, float threshold);
256 
262  double getUnweightedUnnormalizedUtility(const ViewportPoint &candidateViewport);
263 
269  void setUnweightedUnnormalizedObjectUtilities(const ViewportPoint &candidateViewport, std::string objectType);
270 
278  double getWeightedInverseCosts(const ViewportPoint &sourceViewport, const ViewportPoint &targetViewport);
279 
285  double getUnweightedInverseRecognitionCosts(const ViewportPoint &targetViewport);
286 
294  void setRobotState(const ViewportPoint &sourceViewport, const ViewportPoint &targetViewport);
295 
300 
304  void setRatingNormalization();
305 
310  void setMaxRecognitionCosts();
311 
312  };
313 
318 }
void setUnweightedUnnormalizedObjectUtilities(const ViewportPoint &candidateViewport, std::string objectType)
sets the mObjectUtilities member.
void setFrustumParameters(double fovV, double fovH, double fcp, double ncp)
float getRating(const BaseScoreContainerPtr &a)
returns the weighted rating of a rating object.
float getFrustumPositionUtility(const ViewportPoint &viewport, ObjectPoint &objectPoint)
returns the utility of the position of an object in the frustum of a given camera viewport...
float getOrientationUtility(const ViewportPoint &viewport, ObjectPoint &objectPoint)
returns the orientation utility of an object point for a given camera viewport. The orientation utili...
bool getBestViewport(ViewportPointCloudPtr &viewports, ViewportPoint &bestViewport)
Sets the best viewport from the given viewports cloud.
void setRatingNormalization()
sets the mRatingNormalization member
ViewportPointCloud::Ptr ViewportPointCloudPtr
Definition: typedef.hpp:97
Eigen::Matrix< Precision, 3, 1 > SimpleVector3
Definition: typedef.hpp:53
void setInputCloud(const ObjectPointCloudPtr &pointCloudPtr)
setting the input cloud.
void setMaxRecognitionCosts()
sets the mMaxRecognitionCosts member. Must be called before calling getNormalizedRecognitionCosts eve...
float getNormalizedRating(float deviation, float threshold)
returns the normalized rating for a given deviation from the optimum and a threshold for the deviatio...
bool setBestScoreContainer(const ViewportPoint &currentViewport, ViewportPoint &candidateViewport)
Sets the best score for the given candidate camera viewport by choosing the best combination of objec...
BaseScoreContainerPtr getScoreContainerInstance()
float getSideUtility(const ViewportPoint &viewport, const ObjectPoint &objectPoint)
returns the side utility of a given object point for a given camera viewport. The side utility is alw...
bool compareScoreContainer(const BaseScoreContainerPtr &a, const BaseScoreContainerPtr &b)
compares two ratings.
this namespace contains all generally usable classes.
void setRobotState(robot_model_services::RobotStatePtr robotState)
setRobotState sets mRobotModelPtr&#39;s state.
void setUtilityParameters(bool useOrientationUtility=true, bool useProximityUtility=true, bool useSideUtility=true)
robot_model_services::RobotModelPtr mRobotModelPtr
void resetCache()
resets the cached data for a call of setBestScoreContainer
bool compareViewports(const ViewportPoint &a, const ViewportPoint &b)
compares two viewports
std::map< std::string, float > mUnweightedUnnormalizedObjectUtilities
void setUseTargetRobotState(bool useTargetRobotState)
void setWeightedInverseMovementCosts()
sets the mMovementCosts member. Must be called before calling setRatingNormalization.
ObjectPointCloud::Ptr ObjectPointCloudPtr
Definition: typedef.hpp:86
boost::shared_ptr< CameraModelFilter > CameraModelFilterPtr
Definition for the shared pointer type of the class.
double getUnweightedInverseRecognitionCosts(const ViewportPoint &targetViewport)
returns the inverse recognition costs for the objects in the target viewport
double getUnweightedUnnormalizedUtility(const ViewportPoint &candidateViewport)
returns the utility for the given candidate camera viewport.
float getProximityUtility(const ViewportPoint &viewport, const ObjectPoint &objectPoint)
returns the proximity utility of a given object point for a given camera viewport. The proximizy utility is always between 0.0 and 1.0. Depends on the distance between the object and the camera.
float getNormalizedAngleUtility(const SimpleVector3 v1, const SimpleVector3 v2, double angleThreshold)
returns a rating for the difference between the two given normals.
RatingModule is a generalization for the rating of the point cloud objects and viewports.
double getWeightedInverseCosts(const ViewportPoint &sourceViewport, const ViewportPoint &targetViewport)
returns the inverse costs for the movement from the source to the target viewport and the recognition...
robot_model_services::RobotStatePtr mTargetState
void setNormalAngleThreshold(double angle)
sets the threshold for the angle between the orientation of an object and the camera orientation...
DefaultRatingModule implements the functionlities offered by RatingModule.
bool setSingleScoreContainer(const ViewportPoint &currentViewport, ViewportPoint &candidateViewport)
sets the score container for one filtered camera viewport Before calling this method, the method resetCache() should be called.
boost::shared_ptr< MapHelper > MapHelperPtr
Definition: MapHelper.hpp:424
float Precision
Definition: typedef.hpp:36
boost::shared_ptr< DefaultRatingModule > DefaultRatingModulePtr
Definition for the shared pointer type of the class.
float getNormalUtility(const ViewportPoint &viewport, const SimpleVector3 &objectNormalVector, const SimpleVector3 &objectPosition)
returns the utility of one object normal for a given camera viewport. The normal utility is always be...
void setOmegaParameters(double omegaUtility, double omegaPan, double omegaTilt, double omegaRot, double omegaBase, double omegaRecognition)
Set the weights of the movements of each component.


asr_next_best_view
Author(s): Aumann Florian, Borella Jocelyn, Heller Florian, Meißner Pascal, Schleicher Ralf, Stöckle Patrick, Stroh Daniel, Trautmann Jeremias, Walter Milena, Wittenbeck Valerij
autogenerated on Thu Jan 9 2020 07:20:18