Skip to content

Make Bosch api optional #38

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

Merged
merged 9 commits into from
Feb 21, 2025
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
17 changes: 15 additions & 2 deletions .github/workflows/ubuntu20_04.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,9 @@ jobs:
matrix:
rosdistro: ['noetic']
gcc: ['8', '9', '10']
submodule: ['exclude', 'BMI08x-Sensor-API', 'BMP3-Sensor-API', 'all']
container: ros:${{ matrix.rosdistro }}-ros-base-focal
name: ROS ${{ matrix.rosdistro }} - GCC ${{ matrix.gcc }}
name: GCC ${{ matrix.gcc }} - Submodule ${{ matrix.submodule }} - ROS ${{ matrix.rosdistro }}
steps:
- uses: actions/checkout@v4
name: Checkout lpp
Expand Down Expand Up @@ -45,8 +46,20 @@ jobs:
token: ${{ secrets.PAT }}
path: catkin_ws/src/mav_sensors

- name: Exclude submodules
if: matrix.submodule == 'exclude'
run: rm -rf mav_sensors_drivers/lib/*
shell: bash
working-directory: catkin_ws/src/mav_sensors

- name: Exclude submodules except ${{ matrix.submodule }}
if: matrix.submodule != 'exclude' && matrix.submodule != 'all'
run: find . -mindepth 1 -type d ! -name ${{ matrix.submodule }} -exec rm -rf {} +
working-directory: catkin_ws/src/mav_sensors/mav_sensors_drivers/lib
shell: bash

- name: Build mav_sensors
run: source /opt/ros/${{ matrix.rosdistro }}/setup.bash && catkin build mav_sensors_demo && source ${GITHUB_WORKSPACE}/catkin_ws/devel/setup.bash
run: source /opt/ros/${{ matrix.rosdistro }}/setup.bash && catkin build -v mav_sensors_demo --no-status && source ${GITHUB_WORKSPACE}/catkin_ws/devel/setup.bash
shell: bash
working-directory: catkin_ws

Expand Down
6 changes: 5 additions & 1 deletion mav_sensors_demo/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,12 @@ include_directories(
add_executable(${PROJECT_NAME}_xwr18xx_mmw_demo src/xwr18xx_mmw_demo_node.cpp)
target_link_libraries(${PROJECT_NAME}_xwr18xx_mmw_demo ${catkin_LIBRARIES})

if (MAV_SENSORS_BMI08X_SUPPORT)
add_executable(${PROJECT_NAME}_bmi088_demo src/bmi088_demo.cpp)
target_link_libraries(${PROJECT_NAME}_bmi088_demo ${catkin_LIBRARIES})
endif ()

if (MAV_SENSORS_BMP3_SUPPORT)
add_executable(${PROJECT_NAME}_bmp390_demo src/bmp390_demo.cpp)
target_link_libraries(${PROJECT_NAME}_bmp390_demo ${catkin_LIBRARIES})
target_link_libraries(${PROJECT_NAME}_bmp390_demo ${catkin_LIBRARIES})
endif ()
53 changes: 40 additions & 13 deletions mav_sensors_drivers/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,10 @@ project(mav_sensors_drivers)

add_compile_options(-std=c++17)

find_package(catkin REQUIRED roscpp lpp mav_sensors_core)

catkin_package(
INCLUDE_DIRS include lib/BMP3-Sensor-API lib/BMI08x-Sensor-API
LIBRARIES ${PROJECT_NAME} ${PROJECT_NAME}_BMP3 ${PROJECT_NAME}_BMI08x
CATKIN_DEPENDS roscpp lpp mav_sensors_core
find_package(catkin REQUIRED COMPONENTS
roscpp
lpp
mav_sensors_core
)

add_compile_definitions(MODE_LPP)
Expand All @@ -17,28 +15,57 @@ add_compile_definitions(MODE_LPP)
## Build ##
###########

if (EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/lib/BMP3-Sensor-API/)
set(MAV_SENSORS_BMP3_SUPPORT ON)
set(MAV_SENSORS_OPTIONAL_SRC_FILES ${MAV_SENSORS_OPTIONAL_SRC_FILES} src/barometer/bmp390.cpp)
set(MAV_SENSORS_OPTIONAL_INCLUDE_DIRS ${MAV_SENSORS_OPTIONAL_INCLUDE_DIRS} lib/BMP3-Sensor-API)
set(MAV_SENSORS_OPTIONAL_LIBRARIES ${MAV_SENSORS_OPTIONAL_LIBRARIES} ${PROJECT_NAME}_BMP3)
message(STATUS "Found BMP3-Sensor-API")
else()
message(WARNING "BMP3-Sensor-API not found. BMP3 sensor will not be supported.")
endif()

if (EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/lib/BMI08x-Sensor-API/)
set(MAV_SENSORS_BMI08X_SUPPORT ON)
set(MAV_SENSORS_OPTIONAL_SRC_FILES ${MAV_SENSORS_OPTIONAL_SRC_FILES} src/imu/bmi088.cpp)
set(MAV_SENSORS_OPTIONAL_INCLUDE_DIRS ${MAV_SENSORS_OPTIONAL_INCLUDE_DIRS} lib/BMI08x-Sensor-API)
set(MAV_SENSORS_OPTIONAL_LIBRARIES ${MAV_SENSORS_OPTIONAL_LIBRARIES} ${PROJECT_NAME}_BMI08x)
message(STATUS "Found BMI08x-Sensor-API")
else()
message(WARNING "BMI08x-Sensor-API not found. BMI08x sensor will not be supported.")
endif()

catkin_package(
INCLUDE_DIRS include ${MAV_SENSORS_OPTIONAL_INCLUDE_DIRS}
LIBRARIES ${PROJECT_NAME} ${MAV_SENSORS_OPTIONAL_LIBRARIES}
CATKIN_DEPENDS roscpp lpp mav_sensors_core
)

include_directories(
include
lib/BMP3-Sensor-API
lib/BMI08x-Sensor-API
include
${MAV_SENSORS_OPTIONAL_INCLUDE_DIRS}
${catkin_INCLUDE_DIRS}
)

add_library(${PROJECT_NAME}
src/imu/adis16448.cpp
src/barometer/bmp390.cpp
src/imu/bmi088.cpp
src/radar/xwr18xx_mmw_demo.cpp)
src/radar/xwr18xx_mmw_demo.cpp
${MAV_SENSORS_OPTIONAL_SRC_FILES})

if (MAV_SENSORS_BMP3_SUPPORT)
add_library(${PROJECT_NAME}_BMP3
lib/BMP3-Sensor-API/bmp3.c)
set(MAV_SENSOR_LIBRARIES ${MAV_SENSOR_LIBRARIES} ${PROJECT_NAME}_BMP3)
endif()

if (MAV_SENSORS_BMI08X_SUPPORT)
add_library(${PROJECT_NAME}_BMI08x
lib/BMI08x-Sensor-API/bmi08a.c
lib/BMI08x-Sensor-API/bmi08g.c
lib/BMI08x-Sensor-API/bmi08xa.c)
endif()

target_link_libraries(${PROJECT_NAME} PUBLIC ${PROJECT_NAME}_BMP3 ${catkin_LIBRARIES})
target_link_libraries(${PROJECT_NAME} PUBLIC ${MAV_SENSOR_LIBRARIES} ${catkin_LIBRARIES})

install(TARGETS ${PROJECT_NAME}
ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
Expand Down