3 #include <ram_msgs/AdditiveManufacturingTrajectory.h> 6 #include <ram_path_planning/ContoursAction.h> 7 #include <ram_path_planning/DonghongDingAction.h> 11 #include <gtest/gtest.h> 13 std::unique_ptr<ros::NodeHandle>
nh;
24 TEST(TestSuite, testSrvExistence)
35 EXPECT_TRUE(donghong_ding_exists && contours_exists);
40 TEST(TestSuite, testPolygonWithinternalContoursDongHongDing)
43 ram_path_planning::DonghongDingGoal goal;
46 goal.deposited_material_width = 1e-3;
47 goal.contours_filtering_tolerance = 0.25e-3;
48 goal.height_between_layers = 2e-3;
49 goal.number_of_layers = 2;
55 ram_path_planning::DonghongDingResultConstPtr result(
donghong_ding_ac->getResult());
57 EXPECT_TRUE(success && state_succeeded && result->error_msg.empty());
60 TEST(TestSuite, testIntersectedPolygonsDongHongDing)
62 ram_path_planning::DonghongDingGoal goal;
64 goal.deposited_material_width = 1e-3;
65 goal.contours_filtering_tolerance = 0.25e-3;
66 goal.height_between_layers = 0.001;
67 goal.number_of_layers = 2;
73 ram_path_planning::DonghongDingResultConstPtr result(
donghong_ding_ac->getResult());
75 EXPECT_TRUE(success && state_aborted && !result->error_msg.empty());
78 TEST(TestSuite, testConvexPolygonDongHongDing)
80 ram_path_planning::DonghongDingGoal goal;
82 goal.deposited_material_width = 1e-3;
83 goal.contours_filtering_tolerance = 0.25e-3;
84 goal.height_between_layers = 2e-3;
85 goal.number_of_layers = 2;
91 ram_path_planning::DonghongDingResultConstPtr result(
donghong_ding_ac->getResult());
93 EXPECT_TRUE(success && state_succeeded && result->error_msg.empty());
96 TEST(TestSuite, testConcavePolygonBigDongHongDing)
98 ram_path_planning::DonghongDingGoal goal;
100 goal.deposited_material_width = 0.1;
101 goal.contours_filtering_tolerance = 0.5e-3;
102 goal.height_between_layers = 0.1;
103 goal.number_of_layers = 2;
109 ram_path_planning::DonghongDingResultConstPtr result(
donghong_ding_ac->getResult());
111 EXPECT_TRUE(success && state_succeeded && result->error_msg.empty());
114 TEST(TestSuite, testConcavePolygonSmallDongHongDing)
116 ram_path_planning::DonghongDingGoal goal;
118 goal.deposited_material_width = 1e-3;
119 goal.contours_filtering_tolerance = 0.25e-5;
120 goal.height_between_layers = 0.1;
121 goal.number_of_layers = 2;
127 ram_path_planning::DonghongDingResultConstPtr result(
donghong_ding_ac->getResult());
129 EXPECT_TRUE(success && state_succeeded && result->error_msg.empty());
132 TEST(TestSuite, testStarDongHongDing)
134 ram_path_planning::DonghongDingGoal goal;
136 goal.deposited_material_width = 1e-3;
137 goal.contours_filtering_tolerance = 0.25e-3;
138 goal.height_between_layers = 0.1;
139 goal.number_of_layers = 2;
145 ram_path_planning::DonghongDingResultConstPtr result(
donghong_ding_ac->getResult());
147 EXPECT_TRUE(success && state_succeeded && result->error_msg.empty());
152 TEST(TestSuite, testSTLFileTwistedPyramidDongHongDing)
154 ram_path_planning::DonghongDingGoal goal;
156 goal.deposited_material_width = 1e-3;
157 goal.contours_filtering_tolerance = 1e-3;
158 goal.height_between_layers = 5e-3;
164 ram_path_planning::DonghongDingResultConstPtr result(
donghong_ding_ac->getResult());
166 EXPECT_TRUE(success && state_succeeded && result->error_msg.empty());
169 TEST(TestSuite, testPLYFileTwistedPyramidDongHongDing)
171 ram_path_planning::DonghongDingGoal goal;
173 goal.deposited_material_width = 0.001;
174 goal.contours_filtering_tolerance = 0.5 * 1e-3;
175 goal.height_between_layers = 0.005;
181 ram_path_planning::DonghongDingResultConstPtr result(
donghong_ding_ac->getResult());
183 EXPECT_TRUE(success && state_succeeded && result->error_msg.empty());
186 TEST(TestSuite, testOBJFileTwistedPyramidDongHongDing)
188 ram_path_planning::DonghongDingGoal goal;
190 goal.deposited_material_width = 0.001;
191 goal.contours_filtering_tolerance = 0.005 * 1e-3;
192 goal.height_between_layers = 0.005;
198 ram_path_planning::DonghongDingResultConstPtr result(
donghong_ding_ac->getResult());
200 EXPECT_TRUE(success && state_succeeded && result->error_msg.empty());
203 TEST(TestSuite, testPLYFileTwoTwistedPyramidsDongHongDing)
205 ram_path_planning::DonghongDingGoal goal;
207 goal.deposited_material_width = 1e-3;
208 goal.contours_filtering_tolerance = 0.25e-3;
209 goal.height_between_layers = 5e-3;
215 ram_path_planning::DonghongDingResultConstPtr result(
donghong_ding_ac->getResult());
217 EXPECT_TRUE(success && state_aborted && !result->error_msg.empty());
220 TEST(TestSuite, testConeTruncatedDongHongDing)
222 ram_path_planning::DonghongDingGoal goal;
224 goal.deposited_material_width = 0.001;
225 goal.contours_filtering_tolerance = 0.6 * 1e-3;
226 goal.height_between_layers = 0.005;
232 ram_path_planning::DonghongDingResultConstPtr result(
donghong_ding_ac->getResult());
234 EXPECT_TRUE(success && state_succeeded && result->error_msg.empty());
237 TEST(TestSuite, testDomeDongHongDing)
239 ram_path_planning::DonghongDingGoal goal;
241 goal.deposited_material_width = 0.001;
242 goal.contours_filtering_tolerance = 0.5 * 1e-3;
243 goal.height_between_layers = 0.002;
249 ram_path_planning::DonghongDingResultConstPtr result(
donghong_ding_ac->getResult());
251 EXPECT_TRUE(success && state_succeeded && result->error_msg.empty());
254 TEST(TestSuite, testInversedPyramidDongHongDing)
256 ram_path_planning::DonghongDingGoal goal;
258 goal.deposited_material_width = 0.001;
259 goal.contours_filtering_tolerance = 0;
260 goal.height_between_layers = 0.005;
266 ram_path_planning::DonghongDingResultConstPtr result(
donghong_ding_ac->getResult());
268 EXPECT_TRUE(success && state_succeeded && result->error_msg.empty());
271 TEST(TestSuite, testSTLCubeNonZSlicingDongHongDing)
273 ram_path_planning::DonghongDingGoal goal;
275 goal.deposited_material_width = 1e-3;
276 goal.contours_filtering_tolerance = 1e-3;
277 goal.height_between_layers = 5e-3;
279 goal.slicing_direction.x = -0.15;
280 goal.slicing_direction.y = -0.2;
281 goal.slicing_direction.z = 1;
287 ram_path_planning::DonghongDingResultConstPtr result(
donghong_ding_ac->getResult());
289 EXPECT_TRUE(success && state_succeeded && result->error_msg.empty());
294 TEST(TestSuite, testPolygonWithinternalContours)
297 ram_path_planning::ContoursGoal goal;
299 goal.deposited_material_width = 1e-3;
300 goal.height_between_layers = 2e-3;
301 goal.number_of_layers = 2;
307 ram_path_planning::ContoursResultConstPtr result(
contours_ac->getResult());
309 EXPECT_TRUE(success && state_aborted && !result->error_msg.empty());
312 TEST(TestSuite, testIntersectedPolygonsContours)
314 ram_path_planning::ContoursGoal goal;
316 goal.deposited_material_width = 1e-3;
317 goal.height_between_layers = 0.001;
318 goal.number_of_layers = 2;
324 ram_path_planning::ContoursResultConstPtr result(
contours_ac->getResult());
326 EXPECT_TRUE(success && state_aborted && !result->error_msg.empty());
329 TEST(TestSuite, testConvexPolygonContours)
331 ram_path_planning::ContoursGoal goal;
333 goal.deposited_material_width = 1e-3;
334 goal.height_between_layers = 2e-3;
335 goal.number_of_layers = 2;
341 ram_path_planning::ContoursResultConstPtr result(
contours_ac->getResult());
343 EXPECT_TRUE(success && state_succeeded && result->error_msg.empty());
346 TEST(TestSuite, testStarContours)
348 ram_path_planning::ContoursGoal goal;
350 goal.deposited_material_width = 1e-3;
351 goal.height_between_layers = 0.1;
352 goal.number_of_layers = 2;
358 ram_path_planning::ContoursResultConstPtr result(
contours_ac->getResult());
360 EXPECT_TRUE(success && state_succeeded && result->error_msg.empty());
365 TEST(TestSuite, testSTLFileTwistedPyramidContours)
367 ram_path_planning::ContoursGoal goal;
369 goal.deposited_material_width = 1e-3;
370 goal.height_between_layers = 5e-3;
376 ram_path_planning::ContoursResultConstPtr result(
contours_ac->getResult());
378 EXPECT_TRUE(success && state_succeeded && result->error_msg.empty());
381 TEST(TestSuite, testPLYFileTwoTwistedPyramidsContours)
383 ram_path_planning::ContoursGoal goal;
385 goal.deposited_material_width = 1e-3;
386 goal.height_between_layers = 5e-3;
392 ram_path_planning::ContoursResultConstPtr result(
contours_ac->getResult());
394 EXPECT_TRUE(success && state_aborted && !result->error_msg.empty());
403 ros::init(argc, argv,
"path_planning_test_client");
406 nh->param<
bool>(
"use_gui",
use_gui,
false);
410 testing::InitGoogleTest(&argc, argv);
411 return RUN_ALL_TESTS();
std::unique_ptr< ros::NodeHandle > nh
ROSCPP_DECL void init(int &argc, char **argv, const std::string &name, uint32_t options=0)
int main(int argc, char **argv)
const std::string service_name_
std::unique_ptr< DonghongDingActionClient > donghong_ding_ac
actionlib::SimpleActionClient< ram_path_planning::DonghongDingAction > DonghongDingActionClient
ROSLIB_DECL std::string getPath(const std::string &package_name)
TEST(TestSuite, testSrvExistence)
actionlib::SimpleActionClient< ram_path_planning::ContoursAction > ContoursActionClient
#define ROS_ERROR_STREAM(args)
std::unique_ptr< ContoursActionClient > contours_ac