Skip to content

Commit

Permalink
Merge branch 'ClemensElflein:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
ene9ba authored Apr 25, 2024
2 parents 1632874 + 06e7f05 commit b8a0897
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/lib/slic3r_coverage_planner
14 changes: 12 additions & 2 deletions src/mower_utils/launch/planner_test.launch
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,17 @@
<launch>
<node name="rviz" pkg="rviz" type="rviz" args="-d $(find mower_utils)/rviz/planner_test.rviz" required="true" />
<node pkg="mower_map" type="mower_map_service" name="mower_map" required="true" />
<node pkg="slic3r_coverage_planner" type="slic3r_coverage_planner" name="slic3r_coverage_planner" required="true" />
<node pkg="mower_utils" type="planner_test" name="planner_test" required="false" />
<node pkg="slic3r_coverage_planner" type="slic3r_coverage_planner" name="slic3r_coverage_planner" required="false" />

<node
if="$(eval optenv('START_PLANNER', True))"
pkg="mower_utils"
type="planner_test"
name="planner_test"
required="false"
>
<param name="area_index" value="$(eval optenv('AREA_INDEX', 0))"/>
<param name="outline_count" value="$(eval optenv('OM_OUTLINE_COUNT', 10))"/>
</node>
<!-- <node pkg="mower_logic" type="mower_logic" name="mower_logic" required="true" />-->
</launch>
21 changes: 15 additions & 6 deletions src/mower_utils/src/planner_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ int main(int argc, char **argv) {
ros::NodeHandle n;
ros::NodeHandle paramNh("~");

int area_index = paramNh.param("area_index", 0);
int outline_count = paramNh.param("outline_count", 4);

ros::Publisher path_pub;

Expand All @@ -33,7 +35,7 @@ int main(int argc, char **argv) {


mower_map::GetMowingAreaSrv mapSrv;
mapSrv.request.index = 0;
mapSrv.request.index = area_index;

if (!mapClient.call(mapSrv)) {
ROS_ERROR_STREAM("Error loading mowing area");
Expand All @@ -42,16 +44,23 @@ int main(int argc, char **argv) {

slic3r_coverage_planner::PlanPath pathSrv;
pathSrv.request.angle = 0;
pathSrv.request.outline_count = 1;
pathSrv.request.outline_count = outline_count;
pathSrv.request.outline = mapSrv.response.area.area;
pathSrv.request.holes = mapSrv.response.area.obstacles;
pathSrv.request.fill_type = slic3r_coverage_planner::PlanPathRequest::FILL_LINEAR;
pathSrv.request.distance = 1.0;
pathSrv.request.distance = 0.13;
pathSrv.request.outer_offset = 0.05;

if (!pathClient.call(pathSrv)) {
ROS_ERROR_STREAM("Error getting path area");
return 1;
ros::Duration loop_time(1);
while(ros::ok()) {
if (!pathClient.call(pathSrv)) {
ROS_ERROR_STREAM("Error getting path area");
} else {
ROS_INFO_STREAM("Got path");
}
loop_time.sleep();
}

return 0;
}

0 comments on commit b8a0897

Please sign in to comment.