Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Port grid_map_costmap_2d to ros2 #240

Merged
merged 5 commits into from
Jun 25, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 22 additions & 5 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,28 +1,45 @@
version: 2

jobs:
build_and_test:
docker:
- image: ros:foxy
environment:
ROS_WS: "/opt/ros"
UNDERLAY_WS: "/opt/underlay_ws"
OVERLAY_WS: "/opt/overlay_ws"
steps:
- checkout
- run:
name: Set Up Container
command: |
apt update -qq && apt install -y build-essential cmake python3-colcon-common-extensions python3-rosdep libeigen3-dev
apt upgrade -y
source `find /opt/ros -maxdepth 2 -name local_setup.bash | sort | head -1`
mkdir -p src/grid_map && mv `find -maxdepth 1 -not -name . -not -name src` src/grid_map/
source `find $ROS_WS -maxdepth 2 -name local_setup.bash | sort | head -1`
rosdep update
mkdir -p $OVERLAY_WS/src/grid_map && mv `find -maxdepth 1 -not -name . -not -name src` $OVERLAY_WS/src/grid_map/
mkdir -p $UNDERLAY_WS/src && cp $OVERLAY_WS/src/grid_map/tools/ros2_dependencies.repos \
$UNDERLAY_WS/ros2_dependencies.repos
cd $UNDERLAY_WS && vcs import src < ros2_dependencies.repos
cp $UNDERLAY_WS/src/ros-planning/navigation2/tools/ros2_dependencies.repos \
$UNDERLAY_WS/ros2_dependencies.repos
vcs import src < ros2_dependencies.repos
rosdep install -y --ignore-src --from-paths src
colcon build --symlink-install --packages-up-to nav2_costmap_2d
source $UNDERLAY_WS/install/local_setup.bash
cd $OVERLAY_WS && rosdep install -y --ignore-src --from-paths src
- run:
name: Debug Build
command: |
source `find /opt/ros -maxdepth 2 -name local_setup.bash | sort | head -1`
colcon build --parallel-workers 1
source `find $ROS_WS -maxdepth 2 -name local_setup.bash | sort | head -1`
source $UNDERLAY_WS/install/local_setup.bash
cd $OVERLAY_WS && colcon build --parallel-workers 1
- run:
name: Run Tests
command: |
source `find /opt/ros -maxdepth 2 -name local_setup.bash | sort | head -1`
source `find $ROS_WS -maxdepth 2 -name local_setup.bash | sort | head -1`
source $UNDERLAY_WS/install/local_setup.bash
cd $OVERLAY_WS
colcon test --parallel-workers 1
colcon test-result --verbose
workflows:
Expand Down
102 changes: 54 additions & 48 deletions grid_map_costmap_2d/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,47 +1,34 @@
cmake_minimum_required(VERSION 2.8.3)
cmake_minimum_required(VERSION 3.5)
project(grid_map_costmap_2d)

set(CMAKE_CXX_FLAGS "-std=c++11 ${CMAKE_CXX_FLAGS}")
## Find ament_cmake macros and libraries
find_package(ament_cmake REQUIRED)
find_package(grid_map_cmake_helpers REQUIRED)
find_package(grid_map_core REQUIRED)
find_package(geometry_msgs REQUIRED)
find_package(nav2_costmap_2d REQUIRED)
find_package(tf2_ros REQUIRED)
find_package(tf2_geometry_msgs REQUIRED)

## Find catkin macros and libraries
find_package(catkin REQUIRED COMPONENTS
grid_map_core
costmap_2d
tf
)
find_package(Eigen3 REQUIRED)

## System dependencies are found with CMake's conventions
#find_package(Eigen3 REQUIRED)

###################################
## catkin specific configuration ##
###################################
## The catkin_package macro generates cmake config files for your package
## Declare things to be passed to dependent projects
## INCLUDE_DIRS: uncomment this if you package contains header files
## LIBRARIES: libraries you create in this project that dependent projects also need
## CATKIN_DEPENDS: catkin_packages dependent projects also need
## DEPENDS: system dependencies of this project that dependent projects also need
catkin_package(
INCLUDE_DIRS
include
LIBRARIES
CATKIN_DEPENDS
grid_map_core
costmap_2d
tf
DEPENDS
)

###########
## Build ##
###########
grid_map_package()

## Specify additional locations of header files
include_directories(
include
${catkin_INCLUDE_DIRS}
${EIGEN3_INCLUDE_DIR}
${grid_map_core_INCLUDE_DIRS}
${nav2_costmap_2d_INCLUDE_DIRS}
${geometry_msgs_INCLUDE_DIRS}
)

set(dependencies
grid_map_core
geometry_msgs
nav2_costmap_2d
tf2_ros
tf2_geometry_msgs
)

#############
Expand All @@ -51,25 +38,44 @@ include_directories(
# Mark cpp header files for installation
install(
DIRECTORY include/${PROJECT_NAME}/
DESTINATION ${CATKIN_PACKAGE_INCLUDE_DESTINATION}
DESTINATION include/${PROJECT_NAME}
FILES_MATCHING PATTERN "*.hpp"
)

#############
## Testing ##
#############

if(CATKIN_ENABLE_TESTING)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pthread")
## Add gtest based cpp test target and link libraries
catkin_add_gtest(
${PROJECT_NAME}-test
test/test_grid_map_costmap_2d.cpp
test/Costmap2DConverterTest.cpp
)
add_subdirectory(rostest)
endif()
if(BUILD_TESTING)
# Linting is setup this way to add a filter
# to ament_cpplint to ignore the lack of
# copyright messages at the top of files.
# Copyright messages are being checked for by both
# ament_cmake_cpplint & ament_cmake_copyright.

find_package(ament_lint_auto REQUIRED)
find_package(ament_lint_auto QUIET)
if(ament_lint_auto_FOUND)
# exclude copyright checks
list(APPEND AMENT_LINT_AUTO_EXCLUDE
ament_cmake_cpplint
ament_cmake_copyright
)
ament_lint_auto_find_test_dependencies()

if(TARGET ${PROJECT_NAME}-test)
target_link_libraries(${PROJECT_NAME}-test ${catkin_LIBRARIES})
# run cpplint without copyright filter
find_package(ament_cmake_cpplint)
ament_cpplint(
FILTERS -legal/copyright
)
endif()
ament_lint_auto_find_test_dependencies()

find_package(ament_cmake_gtest REQUIRED)

add_subdirectory(test)
endif()

ament_export_include_directories(include)
ament_export_dependencies(${dependencies})
ament_package()
Empty file removed grid_map_costmap_2d/COLCON_IGNORE
Empty file.
Loading