20 #define BOOST_TEST_STATIC_LINK 22 #include <boost/test/included/unit_test.hpp> 38 asr_next_best_view::GetAttributedPointCloud gpc;
39 asr_next_best_view::SetAttributedPointCloud apc;
51 orientation[0] = euler2Quaternion(-90, 180.0, 0.0);
52 orientation[1] = euler2Quaternion(-90, 180.0, 0.0);
53 orientation[2] = euler2Quaternion(-90, -90.0, 0.0);
54 orientation[3] = euler2Quaternion(-90, 0.0, 0.0);
56 std::string* types =
new std::string[hpSize];
57 types[0] =
"Knaeckebrot";
58 types[1] =
"VitalisSchoko";
62 std::string* ids =
new std::string[hpSize];
65 ids[2] =
"000100000100";
66 ids[3] =
"100000000100";
69 std::map<std::string, std::vector<asr_msgs::AsrAttributedPoint>* > objectPointCloudsMap;
71 for (std::size_t idx = 0; idx < (std::size_t)hpSize; idx++) {
73 if(objectPointCloudsMap.find(types[idx]) == objectPointCloudsMap.end())
75 objectPointCloudsMap[types[idx]]=
new std::vector<asr_msgs::AsrAttributedPoint>();
77 for (std::size_t cnt = 0; cnt < (std::size_t)sampleSize; cnt++) {
81 asr_msgs::AsrAttributedPoint element;
83 geometry_msgs::Pose pose;
84 pose.orientation.w = orientation[idx].w();
85 pose.orientation.x = orientation[idx].x();
86 pose.orientation.y = orientation[idx].y();
87 pose.orientation.z = orientation[idx].z();
88 pose.position.x = randomVector[0];
89 pose.position.y = randomVector[1];
90 pose.position.z = randomVector[2];
92 element.type = types[idx];
94 element.identifier = ids[idx];
95 objectPointCloudsMap[types[idx]]->push_back(element);
96 apc.request.point_cloud.elements.push_back(element);
101 geometry_msgs::Pose initialPose;
102 initialPose.position.x = -0.974955737591;
103 initialPose.position.y = -0.157173499465;
104 initialPose.position.z = 1.32;
106 initialPose.orientation.w = 0.718685498907;
107 initialPose.orientation.x = 0.0;
108 initialPose.orientation.y = 0.0;
109 initialPose.orientation.z = 0.695335281472;
110 this->setInitialPose(initialPose);
113 mSetPointCloudClient.call(apc.request, apc.response);
115 asr_next_best_view::GetNextBestView nbv;
116 nbv.request.current_pose = initialPose;
117 bool setPointCloud =
false;
120 if(apc.request.point_cloud.elements.size() == 0)
125 else if(setPointCloud)
127 setPointCloud =
false;
128 if (!mSetPointCloudClient.call(apc.request, apc.response))
136 if (!mGetNextBestViewClient.call(nbv.request, nbv.response)) {
137 ROS_ERROR(
"Something went wrong in next best view");
141 ROS_INFO_STREAM(
"Name list size " << nbv.response.viewport.object_type_name_list.size());
143 if (nbv.response.viewport.object_type_name_list.size() > 0)
145 mGetPointCloudClient.call(gpc);
146 apc.request.point_cloud.elements.clear();
147 apc.request.point_cloud.elements.insert(apc.request.point_cloud.elements.end(), gpc.response.point_cloud.elements.begin(), gpc.response.point_cloud.elements.end());
149 for(
unsigned int i=0;i<nbv.response.viewport.object_type_name_list.size();i++)
151 std::vector<asr_msgs::AsrAttributedPoint> temp;
152 ROS_INFO_STREAM(
"Type: " << nbv.response.viewport.object_type_name_list[i]);
153 for (std::vector<asr_msgs::AsrAttributedPoint>::iterator it = apc.request.point_cloud.elements.begin(); it != apc.request.point_cloud.elements.end(); ++it)
156 if ((nbv.response.viewport.object_type_name_list[i].compare(it->type)) != 0)
161 apc.request.point_cloud.elements.clear();
162 apc.request.point_cloud.elements.insert(apc.request.point_cloud.elements.end(), temp.begin(), temp.end());
163 setPointCloud =
true;
171 if (!nbv.response.found) {
176 asr_next_best_view::UpdatePointCloud upc_req;
177 upc_req.request.object_type_name_list = nbv.response.viewport.object_type_name_list;
178 upc_req.request.pose_for_update = nbv.response.viewport.pose;
180 if(!mUpdatePointCloudClient.call(upc_req)) {
187 nbv.request.current_pose = nbv.response.viewport.pose;
200 test_suite* evaluation = BOOST_TEST_SUITE(
"Evaluation NBV");
206 framework::master_test_suite().add(evaluation);
Eigen::Matrix< Precision, 3, 1 > SimpleVector3
ROSCPP_DECL void init(int &argc, char **argv, const std::string &name, uint32_t options=0)
this namespace contains all generally usable classes.
static SimpleVectorX getRandomVector(const SimpleVectorX &mean, const SimpleVectorX &standardDeviation)
TFSIMD_FORCE_INLINE const tfScalar & x() const
#define ROS_INFO_STREAM(args)
virtual ~SingleSceneTest()
Eigen::Quaternion< Precision > SimpleQuaternion
ROSCPP_DECL void spinOnce()
test_suite * init_unit_test_suite(int argc, char *argv[])