1 #ifndef RAM_PATH_PLANNING_CONTOURS_IMP_HPP 2 #define RAM_PATH_PLANNING_CONTOURS_IMP_HPP 6 template<
class ActionSpec>
9 "ram/path_planning/generate_trajectory/contours")
15 template<
class ActionSpec>
19 const double deposited_material_width,
20 const std::array<double, 3> normal_vector,
24 return "generateOneLayerTrajectory: polydata is not initialized";
26 if (poly_data->GetNumberOfPoints() == 0)
27 return "generateOneLayerTrajectory: polydata is empty";
35 if (normal_vector[0] == 0 && normal_vector[1] == 0 && normal_vector[2] == 0)
45 return "Failed to remove duplicate points";
48 return "Failed to merge colinear edges";
51 return "Contours intersects";
53 std::vector<int> level;
54 std::vector<int> father;
59 return "Cannot generate a contour in a figure with holes";
62 return "Failed to organize polygon contours in layer";
65 if (!this->
publishStatusDone(
"Contours are ready to generate the trajectory", gh))
66 return "GoalHandle is not active";
68 for (
auto polygons : layer)
69 for (
auto polydata : polygons)
72 return "Error in deposited material width";
76 return "GoalHandle is not active";
83 std::getline(std::cin, s);
88 template<
class ActionSpec>
90 const std::string yaml_file,
92 const double deposited_material_width,
96 const Polygon poly_data = Polygon::New();
97 std::vector<unsigned> layer_count;
100 return "Could not parse the YAML file";
102 std::array<double, 3> normal_vector = {0, 0, 1};
void identifyRelationships(const Polygon poly_data, std::vector< int > &level, std::vector< int > &father)
bool mergeColinearEdges(const Polygon poly_data, const double tolerance=1e-6)
bool yamlFileToPolydata(const std::string yaml_file, Polygon poly_data)
bool publishStatusDone(const std::string progress_msg, actionlib::ServerGoalHandle< ActionSpec > &gh)
std::string generateOneLayerTrajectory(actionlib::ServerGoalHandle< ActionSpec > &gh, const Polygon poly_data, Layer &layer, const double deposited_material_width, const std::array< double, 3 > normal_vector={0, 0, 1}, const bool use_gui=false)
bool organizePolygonContoursInLayer(const Polygon poly_data, const std::vector< int > level, const std::vector< int > father, Layer &layer)
bool removeDuplicatePoints(const Polygon poly_data, const double tolerance=1e-6)
bool yamlFileToPolydata2(const std::string yaml_file, Polygon poly_data, std::vector< unsigned > &layer_count)
vtkSmartPointer< vtkPolyData > Polygon
double deposited_material_width_
#define ROS_INFO_STREAM(args)
bool intersectionBetweenContours(const Polygon poly_data)
bool offsetPolygonContour(const Polygon poly_data, const double deposited_material_width)
std::vector< PolygonVector > Layer