Skip to content

Commit

Permalink
Initial dump from main repo
Browse files Browse the repository at this point in the history
  • Loading branch information
oswinso committed Jul 1, 2019
0 parents commit fa31fe6
Show file tree
Hide file tree
Showing 29 changed files with 1,550 additions and 0 deletions.
65 changes: 65 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
---
BasedOnStyle: Google
AccessModifierOffset: -2
ConstructorInitializerIndentWidth: 2
AlignEscapedNewlinesLeft: false
AlignTrailingComments: true
AllowAllParametersOfDeclarationOnNextLine: false
AllowShortIfStatementsOnASingleLine: false
AllowShortLoopsOnASingleLine: false
AllowShortFunctionsOnASingleLine: None
AlwaysBreakTemplateDeclarations: true
AlwaysBreakBeforeMultilineStrings: false
BreakBeforeBinaryOperators: false
BreakBeforeTernaryOperators: false
BreakConstructorInitializersBeforeComma: true
BinPackParameters: true
ColumnLimit: 120
ConstructorInitializerAllOnOneLineOrOnePerLine: true
DerivePointerBinding: false
PointerBindsToType: true
ExperimentalAutoDetectBinPacking: false
IndentCaseLabels: true
MaxEmptyLinesToKeep: 1
NamespaceIndentation: None
ObjCSpaceBeforeProtocolList: true
PenaltyBreakBeforeFirstCallParameter: 19
PenaltyBreakComment: 60
PenaltyBreakString: 1
PenaltyBreakFirstLessLess: 1000
PenaltyExcessCharacter: 1000
PenaltyReturnTypeOnItsOwnLine: 90
SpacesBeforeTrailingComments: 2
Cpp11BracedListStyle: false
Standard: Auto
IndentWidth: 2
TabWidth: 2
UseTab: Never
IndentFunctionDeclarationAfterType: false
SpacesInParentheses: false
SpacesInAngles: false
SpaceInEmptyParentheses: false
SpacesInCStyleCastParentheses: false
SpaceAfterControlStatementKeyword: true
SpaceBeforeAssignmentOperators: true
ContinuationIndentWidth: 4
SortIncludes: false
SpaceAfterCStyleCast: false

# Configure each individual brace in BraceWrapping
BreakBeforeBraces: Custom

# Control of individual brace wrapping cases
BraceWrapping: {
AfterClass: 'true'
AfterControlStatement: 'true'
AfterEnum : 'true'
AfterFunction : 'true'
AfterNamespace : 'true'
AfterStruct : 'true'
AfterUnion : 'true'
BeforeCatch : 'true'
BeforeElse : 'true'
IndentBraces : 'false'
}
...
60 changes: 60 additions & 0 deletions .clang-tidy
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
---
Checks: '*,
-llvm-header-guard,
-google-build-using-namespace,
-clang-analyzer-alpha.clone.CloneChecker,
-google-runtime-int,
-cppcoreguidelines-pro-bounds-array-to-pointer-decay,
-cppcoreguidelines-pro-bounds-constant-array-index,
-clang-analyzer-alpha.deadcode.UnreachableCode,
-misc-use-after-move,
-cppcoreguidelines-pro-type-vararg,
-modernize-use-emplace,
-android-*,
-absel-*,
-cert-*,
-objc-*,
-zircon-*,
-hicpp-vararg,
-hicpp-no-array-decay,
-google-runtime-references,
-llvm-include-order,
-fuchsia-*,
-misc-unused-parameters'

WarningsAsErrors: '*'
HeaderFilterRegex: ''
AnalyzeTemporaryDtors: false
CheckOptions:
- key: llvm-namespace-comment.ShortNamespaceLines
value: '10'
- key: llvm-namespace-comment.SpacesBeforeComments
value: '2'
- key: readability-braces-around-statements.ShortStatementLines
value: '2'
# type names
- key: readability-identifier-naming.ClassCase
value: CamelCase
- key: readability-identifier-naming.EnumCase
value: CamelCase
- key: readability-identifier-naming.UnionCase
value: CamelCase
# method names are camelCase
- key: readability-identifier-naming.MethodCase
value: camelBack
# variable names are snake_case
- key: readability-identifier-naming.VariableCase
value: lower_case
- key: readability-identifier-naming.ParameterCase
value: lower_case
- key: readability-identifier-naming.ClassMemberSuffix
value: '_'
# global variables are g_snake_case
- key: readability-identifier-naming.GlobalVariablePrefix
value: g_
- key: readability-identifier-naming.GlobalVariableCase
value: lower_case
# namespaces are snake_case
- key: readability-identifier-naming.NamespaceCase
value: lower_case
...
Empty file added .gitignore
Empty file.
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Boustrophedon Planner
Boustrophedon Planner is a coverage path planner that implements the [Boustrophedon Cell Decomposition](https://en.wikipedia.org/wiki/Boustrophedon_cell_decomposition) algorithm.

## Overview
The path planner is an actionlib server that takes in a `geometry_msgs/PolygonStamped` and a `geometry_msgs/PoseStamped`,
and returns a `StripingPlan` message which contains a list of waypoints to stripe the passed in polygon.
40 changes: 40 additions & 0 deletions boustrophedon_msgs/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
cmake_minimum_required(VERSION 2.8.3)
project(boustrophedon_msgs)

set(CMAKE_CXX_STANDARD 14)

find_package(catkin REQUIRED
genmsg
std_msgs
geometry_msgs
actionlib_msgs
nav_msgs
)

add_message_files(
DIRECTORY msg
FILES
StripingPoint.msg
StripingPlan.msg
)

add_service_files(
FILES
ConvertPlanToPath.srv
)

add_action_files(
DIRECTORY action
FILES
PlanMowingPath.action
)

generate_messages(
DEPENDENCIES
std_msgs
geometry_msgs
actionlib_msgs
nav_msgs
)

catkin_package()
5 changes: 5 additions & 0 deletions boustrophedon_msgs/action/PlanMowingPath.action
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
geometry_msgs/PolygonStamped property
geometry_msgs/PoseStamped robot_position
---
boustrophedon_msgs/StripingPlan plan
---
2 changes: 2 additions & 0 deletions boustrophedon_msgs/msg/StripingPlan.msg
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Header header
boustrophedon_msgs/StripingPoint[] points
6 changes: 6 additions & 0 deletions boustrophedon_msgs/msg/StripingPoint.msg
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
geometry_msgs/Point point
uint8 type

uint8 OUTLINE=0
uint8 STRIPE_START=1
uint8 STRIPE_END=2
25 changes: 25 additions & 0 deletions boustrophedon_msgs/package.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?xml version="1.0"?>
<package format="2">
<name>boustrophedon_msgs</name>
<version>0.0.1</version>
<description>Custom messages for the Boustrophedon Planner</description>

<maintainer email="[email protected]">Charles Brian Quinn</maintainer>
<maintainer email="[email protected]">Oswin So</maintainer>

<license>TODO</license>

<author email="[email protected]">Charles Brian Quinn</author>
<author email="[email protected]">Oswin So</author>

<depend>actionlib_msgs</depend>
<depend>nav_msgs</depend>
<depend>geometry_msgs</depend>

<build_depend>message_generation</build_depend>

<buildtool_depend>catkin</buildtool_depend>

<export>
</export>
</package>
3 changes: 3 additions & 0 deletions boustrophedon_msgs/srv/ConvertPlanToPath.srv
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
boustrophedon_msgs/StripingPlan plan
---
nav_msgs/Path path
61 changes: 61 additions & 0 deletions boustrophedon_server/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
cmake_minimum_required(VERSION 2.8.3)
project(boustrophedon_server)

set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_CLANG_TIDY clang-tidy)

find_package(catkin REQUIRED COMPONENTS
roscpp
boustrophedon_msgs
actionlib
tf
geometry_msgs
nav_msgs
rosparam_shortcuts
)

find_package(CGAL REQUIRED COMPONENTS Core)
catkin_package(
INCLUDE_DIRS include
CATKIN_DEPENDS
roscpp
boustrophedon_msgs
actionlib
tf
geometry_msgs
nav_msgs
rosparam_shortcuts
)

include_directories(
include
${catkin_INCLUDE_DIRS}
)

add_executable(boustrophedon_planner_server
src/boustrophedon_server/boustrophedon_planner_node.cpp
src/boustrophedon_server/boustrophedon_planner_server.cpp
src/boustrophedon_server/striping_planner.cpp
src/boustrophedon_server/outline_planner.cpp
src/boustrophedon_server/cgal_utils.cpp
src/boustrophedon_server/boustrophedon_types.cpp
src/boustrophedon_server/cellular_decomposition/polygon_decomposer.cpp
src/boustrophedon_server/cellular_decomposition/cell.cpp
)
target_link_libraries(boustrophedon_planner_server
${catkin_LIBRARIES}
CGAL::CGAL
CGAL::CGAL_Core)
add_dependencies(boustrophedon_planner_server ${catkin_EXPORTED_TARGETS})

install(
TARGETS
boustrophedon_planner_server
ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
)

install(DIRECTORY launch/
DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}/launch
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
#ifndef SRC_BOUSTROPHEDON_PLANNER_SERVER_H
#define SRC_BOUSTROPHEDON_PLANNER_SERVER_H

#include <ros/ros.h>
#include <actionlib/server/simple_action_server.h>
#include <tf/transform_listener.h>

#include <boustrophedon_msgs/PlanMowingPathAction.h>
#include <boustrophedon_msgs/ConvertPlanToPath.h>

#include "cgal_utils.h"
#include "striping_planner.h"
#include "outline_planner.h"
#include "cellular_decomposition/polygon_decomposer.h"

class BoustrophedonPlannerServer
{
public:
BoustrophedonPlannerServer();

void executePlanPathAction(const boustrophedon_msgs::PlanMowingPathGoalConstPtr& goal);

private:
using Server = actionlib::SimpleActionServer<boustrophedon_msgs::PlanMowingPathAction>;

ros::NodeHandle node_handle_;
ros::NodeHandle private_node_handle_;
Server action_server_;
ros::ServiceServer conversion_server_;

StripingPlanner striping_planner_;
OutlinePlanner outline_planner_;

int outline_layer_count_{};
double stripe_separation_{};
double stripe_angle_{};
tf::TransformListener transform_listener_{};

bool convertStripingPlanToPath(boustrophedon_msgs::ConvertPlanToPath::Request& request,
boustrophedon_msgs::ConvertPlanToPath::Response& response);
boustrophedon_msgs::PlanMowingPathResult toResult(std::vector<NavPoint>&& path, const std::string& frame) const;
Polygon fromBoundary(const geometry_msgs::PolygonStamped& boundary) const;
Point fromPositionWithFrame(const geometry_msgs::PoseStamped& pose, const std::string& target_frame) const;
};

#endif // SRC_BOUSTROPHEDON_PLANNER_SERVER_H
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#ifndef SRC_BOUSTROPHEDON_TYPES_H
#define SRC_BOUSTROPHEDON_TYPES_H

#include "cgal_types.h"

enum class PointType
{
Outline = 0,
StripeStart = 1,
StripeEnd = 2,
Travel = 3
};

struct NavPoint
{
PointType type{};
Point point{};

NavPoint(PointType type, Point point);
};

#endif // SRC_BOUSTROPHEDON_TYPES_H
Loading

0 comments on commit fa31fe6

Please sign in to comment.