diff --git a/.github/workflows/ros2.yml b/.github/workflows/ros2.yml new file mode 100644 index 0000000..61fcc05 --- /dev/null +++ b/.github/workflows/ros2.yml @@ -0,0 +1,51 @@ +name: ros2 + +on: + push: + paths: + - ".github/workflows/ros2.yml" + - "include/**" + - "launch/**" + - "src/**" + - "CMakeLists.txt" + - "package.xml" + pull_request: + paths: + - ".github/workflows/ros2.yml" + - "include/**" + - "launch/**" + - "src/**" + - "CMakeLists.txt" + - "package.xml" + +env: + BUILD_TYPE: Release + +jobs: + build: + name: Build on ros2 ${{ matrix.ros_distro }} + runs-on: ubuntu-22.04 + strategy: + matrix: + ros_distro: [ humble ] + + steps: + - uses: ros-tooling/setup-ros@v0.7 + with: + required-ros-distributions: ${{ matrix.ros_distro }} + + - name: Setup ros2 workspace + run: | + mkdir -p ${{github.workspace}}/ros2_ws/src + + - uses: actions/checkout@v4 + with: + path: 'ros2_ws/src/pika-spark-bno085-driver' + submodules: true + fetch-depth: 1 + + - name: colcon build + run: | + source /opt/ros/${{ matrix.ros_distro }}/setup.bash + cd ${{github.workspace}}/ros2_ws + colcon build --event-handlers console_direct+ diff --git a/.github/workflows/smoke-test.yml b/.github/workflows/smoke-test.yml deleted file mode 100644 index 0025ac4..0000000 --- a/.github/workflows/smoke-test.yml +++ /dev/null @@ -1,31 +0,0 @@ -name: Build - -# See: https://docs.github.com/en/actions/reference/events-that-trigger-workflows -on: - push: - pull_request: - schedule: - # Run every Tuesday at 8 AM UTC - - cron: "0 8 * * TUE" - workflow_dispatch: - repository_dispatch: - -permissions: - contents: read - -jobs: - smoke-test: - runs-on: ubuntu-latest - - steps: - - name: Checkout repository - uses: actions/checkout@v4 - with: - submodules: true - fetch-depth: 1 - - - name: Install CMake - run: sudo apt-get install cmake - - - name: Create build directory, run CMake and Make - run: mkdir build && cd build && cmake .. && make diff --git a/CMakeLists.txt b/CMakeLists.txt index b14106a..732ad8e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,11 +1,15 @@ ########################################################################## cmake_minimum_required(VERSION 3.15) ########################################################################## -project("pika-spark-bno085-driver") +project("pika_spark_bno085_driver") +set(PIKA_SPARK_BNO085_TARGET ${PROJECT_NAME}_node) +########################################################################## +find_package(ament_cmake REQUIRED) +find_package(rclcpp REQUIRED) ########################################################################## add_subdirectory(sh2) ########################################################################## -add_executable(${PROJECT_NAME} +add_executable(${PIKA_SPARK_BNO085_TARGET} main.cpp bno085.cpp bno085_hal.cpp @@ -14,10 +18,17 @@ add_executable(${PROJECT_NAME} ) ########################################################################## if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang") - target_compile_options(${PROJECT_NAME} PRIVATE -Wall -Werror -Wextra -Wpedantic) + target_compile_options(${PIKA_SPARK_BNO085_TARGET} PRIVATE -Wall -Werror -Wextra -Wpedantic) endif() ########################################################################## -target_link_libraries(${PROJECT_NAME} pika-spark-sh2) +target_link_libraries(${PIKA_SPARK_BNO085_TARGET} pika-spark-sh2) +########################################################################## +target_compile_features(${PIKA_SPARK_BNO085_TARGET} PUBLIC cxx_std_17) +########################################################################## +ament_target_dependencies(${PIKA_SPARK_BNO085_TARGET} rclcpp) +########################################################################## +install(TARGETS ${PIKA_SPARK_BNO085_TARGET} DESTINATION lib/${PROJECT_NAME}) +install(DIRECTORY launch DESTINATION share/${PROJECT_NAME}) ########################################################################## -target_compile_features(${PROJECT_NAME} PUBLIC cxx_std_17) +ament_package() ########################################################################## diff --git a/README.md b/README.md index 599440e..e992184 100644 --- a/README.md +++ b/README.md @@ -1,18 +1,20 @@ :sparkles: `pika-spark-bno085-driver` ===================================== -[![Smoke test status](https://github.com/pika-spark/pika-spark-bno085-driver/actions/workflows/smoke-test.yml/badge.svg)](https://github.com/pika-spark/pika-spark-bno085-driver/actions/workflows/smoke-test.yml) +[![Build Status](https://github.com/pika-spark/pika-spark-bno085-driver/actions/workflows/ros2.yml/badge.svg)](https://github.com/pika-spark/pika-spark-bno085-driver/actions/workflows/ros2.yml) [![Spell Check status](https://github.com/pika-spark/pika-spark-bno085-driver/actions/workflows/spell-check.yml/badge.svg)](https://github.com/pika-spark/pika-spark-bno085-driver/actions/workflows/spell-check.yml) -Linux user space driver for the [BNO085](https://www.ceva-dsp.com/wp-content/uploads/2019/10/BNO080_085-Datasheet.pdf) 9-DoF IMU driver. +Linux user space ROS driver for the [BNO085](https://www.ceva-dsp.com/wp-content/uploads/2019/10/BNO080_085-Datasheet.pdf) 9-DoF IMU.

-### How-to-build/run +### How-to-build ```bash -git clone https://github.com/pika-spark/pika-spark-bno085-driver && cd pika-spark-bno085-driver/docker -./docker-build.sh -sudo ./docker-run.sh +cd $COLCON_WS/src +git clone --recursive https://github.com/pika-spark/pika-spark-bno085-driver +cd $COLCON_WS +source /opt/ros/humble/setup.bash +colcon build --packages-select pika_spark_bno085_driver ``` diff --git a/package.xml b/package.xml new file mode 100644 index 0000000..1f36ce4 --- /dev/null +++ b/package.xml @@ -0,0 +1,23 @@ + + + + pika_spark_bno085_driver + 1.0.0 + This package implements a ROS driver for the BNO085 9-DoF IMU. + + Alexander Entinger + + MIT + + ament_cmake + + l4xz + rclcpp + + ament_lint_auto + ament_lint_common + + + ament_cmake + +