diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml new file mode 100644 index 0000000..2753825 --- /dev/null +++ b/.github/workflows/build.yaml @@ -0,0 +1,72 @@ +# This config uses industrial_ci (https://github.com/ros-industrial/industrial_ci.git). +# For troubleshooting, see readme (https://github.com/ros-industrial/industrial_ci/blob/master/README.rst) + +name: Build + +on: + workflow_dispatch: + pull_request: + push: + branches: + - ros2 + +jobs: + industrial_ci: + strategy: + matrix: + env: + - ROS_DISTRO: iron + ROS_REPO: main + - ROS_DISTRO: iron + ROS_REPO: testing + - ROS_DISTRO: humble + ROS_REPO: main + - ROS_DISTRO: humble + ROS_REPO: testing + - ROS_DISTRO: rolling + ROS_REPO: main + - ROS_DISTRO: rolling + ROS_REPO: testing + env: + CCACHE_DIR: ${{ github.workspace }}/.ccache + BASEDIR: ${{ github.workspace }}/.work + CACHE_PREFIX: ${{ matrix.env.ROS_DISTRO }}-${{ matrix.env.ROS_REPO }} + + name: ${{ matrix.env.ROS_DISTRO }}-${{ matrix.env.ROS_REPO }} + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + # The target directory cache doesn't include the source directory because + # that comes from the checkout. See "prepare target_ws for cache" task below + - name: cache target_ws + if: ${{ ! matrix.env.CCOV }} + uses: pat-s/always-upload-cache@v3.0.11 + with: + path: ${{ env.BASEDIR }}/target_ws + key: target_ws-${{ env.CACHE_PREFIX }}-${{ hashFiles('**/CMakeLists.txt', '**/package.xml') }}-${{ github.run_id }} + restore-keys: | + target_ws-${{ env.CACHE_PREFIX }}-${{ hashFiles('**/CMakeLists.txt', '**/package.xml') }} + - name: cache ccache + uses: pat-s/always-upload-cache@v3.0.11 + with: + path: ${{ env.CCACHE_DIR }} + key: ccache-${{ env.CACHE_PREFIX }}-${{ github.sha }}-${{ github.run_id }} + restore-keys: | + ccache-${{ env.CACHE_PREFIX }}-${{ github.sha }} + ccache-${{ env.CACHE_PREFIX }} + - name: industrial_ci + uses: 'ros-industrial/industrial_ci@master' + env: ${{ matrix.env }} + - name: upload test artifacts (on failure) + uses: actions/upload-artifact@v4 + if: failure() + with: + name: test-results + path: ${{ env.BASEDIR }}/target_ws/**/test_results/**/*.xml + - name: prepare target_ws for cache + if: ${{ always() && ! matrix.env.CCOV }} + run: | + du -sh ${{ env.BASEDIR }}/target_ws + sudo find ${{ env.BASEDIR }}/target_ws -wholename '*/test_results/*' -delete + sudo rm -rf ${{ env.BASEDIR }}/target_ws/src + du -sh ${{ env.BASEDIR }}/target_ws diff --git a/.github/workflows/format.yaml b/.github/workflows/format.yaml new file mode 100644 index 0000000..2cc8f0a --- /dev/null +++ b/.github/workflows/format.yaml @@ -0,0 +1,20 @@ +# This is a format job. Pre-commit has a first-party GitHub action, so we use +# that: https://github.com/pre-commit/action + +name: Formatting (pre-commit) + +on: + workflow_dispatch: + pull_request: + push: + +jobs: + pre-commit: + name: Format + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 + - name: Install clang-format-14 + run: sudo apt-get install clang-format-14 + - uses: pre-commit/action@v3.0.1 diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..a4313c7 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,34 @@ +# To use: +# +# pre-commit run -a +# +# Or: +# +# pre-commit install # (runs every time you commit in git) +# +# To update this file: +# +# pre-commit autoupdate +# +# See https://github.com/pre-commit/pre-commit + +repos: + # Standard hooks + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: v5.0.0 + hooks: + - id: check-added-large-files + - id: check-case-conflict + - id: check-json + - id: check-merge-conflict + - id: check-symlinks + - id: check-toml + - id: check-xml + - id: check-yaml + - id: debug-statements + - id: destroyed-symlinks + - id: detect-private-key + - id: end-of-file-fixer + - id: mixed-line-ending + - id: pretty-format-json + - id: trailing-whitespace diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 25a4677..0000000 --- a/.travis.yml +++ /dev/null @@ -1,33 +0,0 @@ -sudo: required -dist: trusty -language: generic # Force travis to use its minimal image with default Python settings -compiler: - - gcc -env: - global: - - CATKIN_WS=~/catkin_ws - - CATKIN_WS_SRC=${CATKIN_WS}/src - - CI_ROS_DISTRO="indigo" -install: - - sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu trusty main" > /etc/apt/sources.list.d/ros-latest.list' - - wget http://packages.ros.org/ros.key -O - | sudo apt-key add - - - sudo apt-get update -qq - - sudo apt-get install -qq -y python-rosdep python-catkin-tools - - sudo rosdep init - - rosdep update - # Use rosdep to install all dependencies (including ROS itself) - - rosdep install --from-paths ./ -i -y --rosdistro $CI_ROS_DISTRO -script: - - source /opt/ros/$CI_ROS_DISTRO/setup.bash - - mkdir -p $CATKIN_WS_SRC - - ln -s $TRAVIS_BUILD_DIR $CATKIN_WS_SRC - - cd $CATKIN_WS - - catkin init - # Enable install space - #- catkin config --install - # Build [and Install] packages - - catkin build --limit-status-rate 0.1 --no-notify -DCMAKE_BUILD_TYPE=Release - # Build tests - - catkin build --limit-status-rate 0.1 --no-notify --make-args tests - # Run tests - - catkin run_tests diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 7e87d3b..8c3b920 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -2,6 +2,11 @@ Changelog for package graph_msgs ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +0.2.0 (2021-09-14) +------------------ +* Port to ROS 2 (`#5 `_) +* Contributors: Dave Coleman, Henning Kayser, Tyler Weaver, Vatan Aksoy Tezer + 0.1.0 (2014-10-24) ------------------ * Added header / timestamp diff --git a/CMakeLists.txt b/CMakeLists.txt index 10680a2..132748f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,133 +1,42 @@ -cmake_minimum_required(VERSION 2.8.3) +cmake_minimum_required(VERSION 3.10) project(graph_msgs) -## Find catkin macros and libraries -## if COMPONENTS list like find_package(catkin REQUIRED COMPONENTS xyz) -## is used, also find other catkin packages -find_package(catkin REQUIRED COMPONENTS - message_generation - geometry_msgs - std_msgs +# Default to C++14 +if(NOT CMAKE_CXX_STANDARD) + set(CMAKE_CXX_STANDARD 14) +endif() + +# Disable Wredundant-decls warnings since rosidl generates redundant function +# declarations +if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang") + set(CMAKE_CXX_FLAGS + "${CMAKE_CXX_FLAGS} -Wall -Wextra -Wpedantic -Wno-redundant-decls") +endif() + +find_package(ament_cmake REQUIRED) +find_package(rosidl_default_generators REQUIRED) +find_package(builtin_interfaces REQUIRED) +find_package(std_msgs REQUIRED) +find_package(geometry_msgs REQUIRED) + +set(msg_files + "msg/Edges.msg" + "msg/GeometryGraph.msg" ) -## System dependencies are found with CMake's conventions -# find_package(Boost REQUIRED COMPONENTS system) - - -## Uncomment this if the package has a setup.py. This macro ensures -## modules and global scripts declared therein get installed -## See http://ros.org/doc/api/catkin/html/user_guide/setup_dot_py.html -# catkin_python_setup() - -################################################ -## Declare ROS messages, services and actions ## -################################################ - -## Generate messages in the 'msg' folder -add_message_files( - FILES - Edges.msg - GeometryGraph.msg -) - -## Generate added messages and services with any dependencies listed here -generate_messages( - DEPENDENCIES - std_msgs - geometry_msgs -) - -################################### -## 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 graph_msgs - CATKIN_DEPENDS - message_runtime +rosidl_generate_interfaces(${PROJECT_NAME} + ${msg_files} + DEPENDENCIES + builtin_interfaces std_msgs geometry_msgs -# DEPENDS system_lib -) - -########### -## Build ## -########### - -## Specify additional locations of header files -## Your package locations should be listed before other locations -# include_directories(include) -include_directories( - ${catkin_INCLUDE_DIRS} ) -## Declare a cpp library -# add_library(graph_msgs -# src/${PROJECT_NAME}/graph_msgs.cpp -# ) - -## Declare a cpp executable -# add_executable(graph_msgs_node src/graph_msgs_node.cpp) - -## Add cmake target dependencies of the executable/library -## as an example, message headers may need to be generated before nodes -# add_dependencies(graph_msgs_node graph_msgs_generate_messages_cpp) - -## Specify libraries to link a library or executable target against -# target_link_libraries(graph_msgs_node -# ${catkin_LIBRARIES} -# ) - -############# -## Install ## -############# - -# all install targets should use catkin DESTINATION variables -# See http://ros.org/doc/api/catkin/html/adv_user_guide/variables.html - -## Mark executable scripts (Python etc.) for installation -## in contrast to setup.py, you can choose the destination -# install(PROGRAMS -# scripts/my_python_script -# DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION} -# ) - -## Mark executables and/or libraries for installation -# install(TARGETS graph_msgs graph_msgs_node -# ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION} -# LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION} -# RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION} -# ) - -## Mark cpp header files for installation -# install(DIRECTORY include/${PROJECT_NAME}/ -# DESTINATION ${CATKIN_PACKAGE_INCLUDE_DESTINATION} -# FILES_MATCHING PATTERN "*.h" -# PATTERN ".svn" EXCLUDE -# ) - -## Mark other files for installation (e.g. launch and bag files, etc.) -# install(FILES -# # myfile1 -# # myfile2 -# DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION} -# ) - -############# -## Testing ## -############# +ament_export_dependencies(rosidl_default_runtime) -## Add gtest based cpp test target and link libraries -# catkin_add_gtest(${PROJECT_NAME}-test test/test_graph_msgs.cpp) -# if(TARGET ${PROJECT_NAME}-test) -# target_link_libraries(${PROJECT_NAME}-test ${PROJECT_NAME}) -# endif() +if(BUILD_TESTING) + find_package(ament_lint_auto REQUIRED) + ament_lint_auto_find_test_dependencies() +endif() -## Add folders to be run by python nosetests -# catkin_add_nosetests(test) +ament_package() diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..309be1e --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,3 @@ +Any contribution that you make to this repository will +be under the 3-Clause BSD License, as dictated by that +[license](https://opensource.org/licenses/BSD-3-Clause). diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..574ef07 --- /dev/null +++ b/LICENSE @@ -0,0 +1,25 @@ +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + * Neither the name of the copyright holder nor the names of its + contributors may be used to endorse or promote products derived from + this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +POSSIBILITY OF SUCH DAMAGE. diff --git a/README.md b/README.md index 91f8d9a..132559b 100644 --- a/README.md +++ b/README.md @@ -1,13 +1,11 @@ -graph_msgs -========== +# graph_msgs ROS messages for publishing graphs of different data types -Status: +### Continuous Integration Status - * [![Build Status](https://travis-ci.org/davetcoleman/graph_msgs.svg)](https://travis-ci.org/davetcoleman/graph_msgs) Travis CI - * [![Devel Job Status](http://jenkins.ros.org/buildStatus/icon?job=devel-indigo-graph_msgs)](http://jenkins.ros.org/job/devel-indigo-graph_msgs) Devel Job Status - * [![Build Status](http://jenkins.ros.org/buildStatus/icon?job=ros-indigo-graph-msgs_binarydeb_trusty_amd64)](http://jenkins.ros.org/job/ros-indigo-graph-msgs_binarydeb_trusty_amd64/) AMD64 Debian Job Status +[![Formatting (pre-commit)](https://github.com/PickNikRobotics/graph_msgs/actions/workflows/format.yaml/badge.svg?branch=ros2)](https://github.com/PickNikRobotics/graph_msgs/actions/workflows/format.yaml?query=branch%3Aros2) +[![Build](https://github.com/PickNikRobotics/graph_msgs/actions/workflows/build.yaml/badge.svg?branch=ros2)](https://github.com/PickNikRobotics/graph_msgs/actions/workflows/build.yaml?query=branch%3Aros2) ## Supported Graph Types diff --git a/msg/Edges.msg b/msg/Edges.msg index 6e42e1c..5abe2a7 100644 --- a/msg/Edges.msg +++ b/msg/Edges.msg @@ -2,4 +2,4 @@ uint32[] node_ids # optional cost/weight of each edge. if vector is empty assume all weights are equal (1) -float64[] weights \ No newline at end of file +float64[] weights diff --git a/msg/GeometryGraph.msg b/msg/GeometryGraph.msg index 48bce5d..91fb002 100644 --- a/msg/GeometryGraph.msg +++ b/msg/GeometryGraph.msg @@ -1,5 +1,5 @@ # A reference coordinate frame and timestamp -Header header +std_msgs/Header header # 3D spacial graph geometry_msgs/Point[] nodes diff --git a/package.xml b/package.xml index 1064142..93dcce0 100644 --- a/package.xml +++ b/package.xml @@ -1,7 +1,6 @@ - - + graph_msgs - 0.1.0 + 0.2.0 ROS messages for publishing graphs of different data types Dave Coleman @@ -14,16 +13,20 @@ Dave Coleman - catkin + ament_cmake - message_generation - std_msgs - geometry_msgs + rosidl_default_generators - std_msgs - geometry_msgs - message_runtime + std_msgs + geometry_msgs + rosidl_default_runtime + + rosidl_interface_packages + + ament_lint_auto + ament_lint_cmake + ament_cmake