00001 00020 #include "robot_model_services/rating/impl/SimpleIKRatingModule.h" 00021 #include <ros/ros.h> 00022 00023 namespace robot_model_services { 00024 SimpleIKRatingModule::SimpleIKRatingModule() : IKRatingModule() {} 00025 SimpleIKRatingModule::~SimpleIKRatingModule() { } 00026 00027 double SimpleIKRatingModule::getPanAngleRating(const geometry_msgs::Point &sourcePosition, const geometry_msgs::Point &targetPosition, double sourceRotationBase, double targetRotationBase) 00028 { 00029 //Substract the difference between source and target rotation 00030 double rotDiff = fmod(targetRotationBase - sourceRotationBase, 2.0*M_PI); 00031 if (rotDiff <= 0) {rotDiff += 2.0*M_PI;} 00032 rotDiff = std::min(fabs(rotDiff), (double)(2.0f*M_PI-fabs(rotDiff))); 00033 double rating = pow(0.6, rotDiff); 00034 return rating; 00035 } 00036 } 00037