Skip to content

Commit

Permalink
Provide package.xml and augment CMakeLists.txt to turn this into a RO…
Browse files Browse the repository at this point in the history
…S driver.
  • Loading branch information
aentinger committed Jan 17, 2024
1 parent 0452568 commit 7bc30bb
Show file tree
Hide file tree
Showing 5 changed files with 98 additions and 42 deletions.
51 changes: 51 additions & 0 deletions .github/workflows/ros2.yml
Original file line number Diff line number Diff line change
@@ -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/[email protected]
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+
31 changes: 0 additions & 31 deletions .github/workflows/smoke-test.yml

This file was deleted.

21 changes: 16 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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()
##########################################################################
14 changes: 8 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
<a href="https://pika-spark.io/"><img align="right" src="https://raw.githubusercontent.com/pika-spark/.github/main/logo/logo-pika-spark-bg-white.png" width="15%"></a>
: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.

<p align="center">
<a href="https://pika-spark.io/"><img src="https://raw.githubusercontent.com/pika-spark/.github/main/logo/logo-pika-spark-bg-white-github.png" width="40%"></a>
</p>

### 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
```
23 changes: 23 additions & 0 deletions package.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?xml version="1.0"?>
<?xml-model href="http://download.ros.org/schema/package_format3.xsd" schematypens="http://www.w3.org/2001/XMLSchema"?>
<package format="3">
<name>pika_spark_bno085_driver</name>
<version>1.0.0</version>
<description>This package implements a ROS driver for the BNO085 9-DoF IMU.</description>

<maintainer email="[email protected]">Alexander Entinger</maintainer>

<license>MIT</license>

<buildtool_depend>ament_cmake</buildtool_depend>

<depend>l4xz</depend>
<depend>rclcpp</depend>

<test_depend>ament_lint_auto</test_depend>
<test_depend>ament_lint_common</test_depend>

<export>
<build_type>ament_cmake</build_type>
</export>
</package>

0 comments on commit 7bc30bb

Please sign in to comment.