42 double ncp = waitForParam<double>(n,
"/nbv/ncp");
43 double fcp = waitForParam<double>(n,
"/nbv/fcp");
45 ROS_INFO_STREAM(
"Param: viewPointDistance: " << viewPointDistance <<
" (== (/nbv/ncp + /nbv/fcp) / 2 = (" << ncp <<
"+" << fcp <<
")/2");
52 ROS_INFO_STREAM(
"Param: viewCenterOrientationRadDistanceThreshold (/nbv/mHypothesisUpdaterAngleThreshold): " << viewCenterOrientationRadDistanceThreshold);
78 asr_robot_model_services::GetDistance srv;
79 srv.request.sourcePosition.x = pose1.position.x;
80 srv.request.sourcePosition.y = pose1.position.y;
81 srv.request.sourcePosition.z = pose1.position.z;
82 srv.request.targetPosition.x = pose2.position.x;
83 srv.request.targetPosition.y = pose2.position.y;
84 srv.request.targetPosition.z = pose2.position.z;
86 return srv.response.distance;
88 ROS_ERROR(
"Failed to call service GetDistance, using euclian Distance instead");
94 return sqrt(pow(pose1.position.x - pose2.position.x, 2)
95 + pow(pose1.position.y - pose2.position.y, 2)
96 + pow(pose1.position.z - pose2.position.z, 2));
101 rotation1.normalize();
103 rotation2.normalize();
104 return rotation1.angularDistance(rotation2);
109 Eigen::Vector3d targetViewVector = targetOrientation * Eigen::Vector3d::UnitX();
110 targetViewVector.normalize();
112 return target_view_center_point;
116 asr_robot_model_services::GetPose srv;
119 return srv.response.pose;
121 ROS_ERROR(
"Failed to call service GetRobotPose, using origin instead");
127 asr_robot_model_services::GetPose srv;
130 return srv.response.pose;
132 ROS_ERROR(
"Failed to call service GetCameraPose, using origin instead");
154 const double positionThreshold,
const double orientationRadThreshold) {
161 return positionThreshold > distance_position;
166 return orientationRadThreshold > distance_orientation_rad;
ServiceClient serviceClient(const std::string &service_name, bool persistent=false, const M_string &header_values=M_string())
geometry_msgs::Pose getCurrentRobotPose()
bool checkViewCenterPointsAreApproxEquale(const geometry_msgs::Pose &pose1, const geometry_msgs::Pose &pose2)
static double viewCenterPositionDistanceThreshold
geometry_msgs::Pose convertVecToPosition(const Eigen::Vector3d &vec)
double calcAngularDistanceInRad(const geometry_msgs::Pose &pose1, const geometry_msgs::Pose &pose2)
double calcDistPositionEucl(const geometry_msgs::Pose &pose1, const geometry_msgs::Pose &pose2)
bool call(MReq &req, MRes &res)
static T waitForParam(ros::NodeHandle n, std::string param)
ROSCPP_DECL const std::string & getName()
static int distanceFuncParam
double calcDistPositionWithNBV(const geometry_msgs::Pose &pose1, const geometry_msgs::Pose &pose2)
geometry_msgs::Pose getOriginPose()
static void resetInstance()
static double viewPointDistance
boost::shared_ptr< PoseHelper > PoseHelperPtr
Eigen::Vector3d calculateViewCenterPoint(const geometry_msgs::Pose &pose)
geometry_msgs::Pose getCurrentCameraPose()
ros::ServiceClient getDistanceServiceClient
bool checkPositionsAreApproxEquale(const geometry_msgs::Pose &pose1, const geometry_msgs::Pose &pose2, const double positionThreshold)
static boost::shared_ptr< PoseHelper > getInstance()
bool checkPosesAreApproxEquale(const geometry_msgs::Pose &pose1, const geometry_msgs::Pose &pose2, const double positionThreshold, const double orientationRadThreshold)
#define ROS_DEBUG_STREAM(args)
Eigen::Quaterniond convertPoseQuatToQuat(const geometry_msgs::Pose &pose)
ros::ServiceClient getCameraPoseServiceClient
#define ROS_INFO_STREAM(args)
bool getParam(const std::string &key, std::string &s) const
bool checkOrientationsAreApproxEquale(const geometry_msgs::Pose &pose1, const geometry_msgs::Pose &pose2, const double orientationRadThreshold)
Eigen::Vector3d convertPositionToVec(const geometry_msgs::Pose &pose)
bool hasParam(const std::string &key) const
double calculateDistance(const geometry_msgs::Pose &pose1, const geometry_msgs::Pose &pose2)
ros::ServiceClient getRobotPoseServiceClient
static double viewCenterOrientationRadDistanceThreshold
static boost::shared_ptr< PoseHelper > instancePtr