Skip to content

Commit ac26aea

Browse files
Fix CI, add BUILD_TESTS and remove catkin support
1 parent 3a00bc3 commit ac26aea

17 files changed

+60
-184
lines changed

.github/workflows/cmake_ubuntu.yml

+11-11
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
name: cmake Ubuntu
22

3-
on: [push, pull_request]
3+
on:
4+
push:
5+
branches:
6+
- master
7+
pull_request:
8+
types: [opened, synchronize, reopened]
49

510
env:
611
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
@@ -15,22 +20,17 @@ jobs:
1520
runs-on: ${{ matrix.os }}
1621
strategy:
1722
matrix:
18-
os: [ubuntu-20.04]
23+
os: [ubuntu-22.04]
1924

2025
steps:
2126
- uses: actions/checkout@v2
2227

2328
- name: Install Conan
2429
id: conan
2530
uses: turtlebrowser/get-conan@main
26-
with:
27-
version: 1.59.0
2831

2932
- name: Create default profile
30-
run: conan profile new default --detect
31-
32-
- name: Update profile
33-
run: conan profile update settings.compiler.libcxx=libstdc++11 default
33+
run: conan profile detect
3434

3535
- name: Create Build Environment
3636
# Some projects don't allow in-source building, so create a separate build directory
@@ -44,16 +44,16 @@ jobs:
4444
- name: Configure CMake
4545
shell: bash
4646
working-directory: ${{github.workspace}}/build
47-
run: cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DCMAKE_TOOLCHAIN_FILE=conan_toolchain.cmake
47+
run: cmake ${{github.workspace}} -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DCMAKE_TOOLCHAIN_FILE=conan_toolchain.cmake
4848

4949
- name: Build
5050
shell: bash
5151
working-directory: ${{github.workspace}}/build
5252
run: cmake --build . --config ${{env.BUILD_TYPE}}
5353

5454
- name: run test (Linux)
55-
working-directory: ${{github.workspace}}/build
56-
run: ./tests/behaviortree_cpp_test
55+
working-directory: ${{github.workspace}}/build/tests
56+
run: ctest
5757

5858
- name: Upload coverage reports to Codecov
5959
uses: codecov/codecov-action@v3

.github/workflows/cmake_windows.yml

+6-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
name: cmake Windows
22

3-
on: [push, pull_request]
3+
on:
4+
push:
5+
branches:
6+
- master
7+
pull_request:
8+
types: [opened, synchronize, reopened]
49

510
env:
611
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)

.github/workflows/pixi.yaml

+6-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
name: Pixi (conda)
22

3-
on: [push, pull_request]
3+
on:
4+
push:
5+
branches:
6+
- master
7+
pull_request:
8+
types: [opened, synchronize, reopened]
49

510
jobs:
611
pixi_conda_build:

.github/workflows/pre-commit.yaml

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
name: pre-commit
22

33
on:
4-
pull_request:
54
push:
6-
branches: [master]
5+
branches:
6+
- master
7+
pull_request:
8+
types: [opened, synchronize, reopened]
79

810
jobs:
911
pre-commit:

.github/workflows/ros1.yaml

-17
This file was deleted.

.github/workflows/ros2-rolling.yaml

+6-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
name: ros2-rolling
22

3-
on: [push, pull_request]
3+
on:
4+
push:
5+
branches:
6+
- master
7+
pull_request:
8+
types: [opened, synchronize, reopened]
49

510
jobs:
611
industrial_ci:

.github/workflows/ros2.yaml

+6-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
name: ros2
22

3-
on: [push, pull_request]
3+
on:
4+
push:
5+
branches:
6+
- master
7+
pull_request:
8+
types: [opened, synchronize, reopened]
49

510
jobs:
611
industrial_ci:

.github/workflows/sonarcube.yml

+2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
name: Sonarcube Scan
2+
23
on:
34
push:
45
branches:
56
- master
67
pull_request:
78
types: [opened, synchronize, reopened]
9+
810
jobs:
911
build:
1012
name: Build

CMakeLists.txt

+5-13
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
99
option(BTCPP_SHARED_LIBS "Build shared libraries" ON)
1010
option(BTCPP_BUILD_TOOLS "Build commandline tools" ON)
1111
option(BTCPP_EXAMPLES "Build tutorials and examples" ON)
12-
option(BTCPP_UNIT_TESTS "Build the unit tests" ON)
12+
option(BUILD_TESTING "Build the unit tests" ON)
1313
option(BTCPP_GROOT_INTERFACE "Add Groot2 connection. Requires ZeroMQ" ON)
1414
option(BTCPP_SQLITE_LOGGING "Add SQLite logging." ON)
1515

@@ -82,15 +82,6 @@ if ( ament_cmake_FOUND )
8282
message(STATUS "BehaviorTree is being built using AMENT.")
8383
message(STATUS "------------------------------------------")
8484
include(cmake/ament_build.cmake)
85-
86-
elseif( CATKIN_DEVEL_PREFIX OR CATKIN_BUILD_BINARY_PACKAGE)
87-
88-
add_definitions( -DUSING_ROS )
89-
message(STATUS "------------------------------------------")
90-
message(STATUS "BehaviorTree is being built using CATKIN.")
91-
message(STATUS "------------------------------------------")
92-
include(cmake/catkin_build.cmake)
93-
set(catkin_FOUND TRUE)
9485
else()
9586
message(STATUS "------------------------------------------")
9687
message(STATUS "BehaviorTree is being built with conan.")
@@ -229,15 +220,16 @@ endif()
229220
#############################################################
230221
message( STATUS "BTCPP_LIB_DESTINATION: ${BTCPP_LIB_DESTINATION} " )
231222
message( STATUS "BTCPP_INCLUDE_DESTINATION: ${BTCPP_INCLUDE_DESTINATION} " )
232-
message( STATUS "BTCPP_UNIT_TESTS: ${BTCPP_UNIT_TESTS} " )
233223

234-
if (BTCPP_UNIT_TESTS OR BTCPP_EXAMPLES)
224+
if (BUILD_TESTING OR BTCPP_EXAMPLES)
235225
add_subdirectory(sample_nodes)
236226
endif()
237227

238228
######################################################
239229

240-
if (BTCPP_UNIT_TESTS)
230+
include(CTest)
231+
message( STATUS "BUILD_TESTING: ${BUILD_TESTING} " )
232+
if (BUILD_TESTING)
241233
add_subdirectory(tests)
242234
endif()
243235

README.md

-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@ If you are looking for a more fancy graphical user interface (and I know you do)
5555

5656
Three build systems are supported:
5757

58-
- **catkin**, if you use ROS
5958
- **colcon (ament)**, if you use ROS2
6059
- **conan** otherwise (Linux/Windows).
6160
- **straight cmake** if you want to be personally responsible for dependencies :)

cmake/catkin_build.cmake

-40
This file was deleted.

include/behaviortree_cpp/bt_factory.h

+1-2
Original file line numberDiff line numberDiff line change
@@ -279,9 +279,8 @@ class BehaviorTreeFactory
279279
/**
280280
* @brief registerFromROSPlugins finds all shared libraries that export ROS plugins for behaviortree_cpp, and calls registerFromPlugin for each library.
281281
* @throws If not compiled with ROS support or if the library cannot load for any reason
282-
*
283282
*/
284-
void registerFromROSPlugins();
283+
[[deprecated("Removed support for ROS1")]] void registerFromROSPlugins();
285284

286285
/**
287286
* @brief registerBehaviorTreeFromFile.

package.xml

-3
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@
1414

1515
<build_depend>ros_environment</build_depend>
1616

17-
<buildtool_depend condition="$ROS_VERSION == 1">catkin</buildtool_depend>
18-
<depend condition="$ROS_VERSION == 1">roslib</depend>
1917

2018
<buildtool_depend condition="$ROS_VERSION == 2">ament_cmake</buildtool_depend>
2119
<depend condition="$ROS_VERSION == 2">rclcpp</depend>
@@ -27,7 +25,6 @@
2725
<test_depend condition="$ROS_VERSION == 2">ament_cmake_gtest</test_depend>
2826

2927
<export>
30-
<build_type condition="$ROS_VERSION == 1">catkin</build_type>
3128
<build_type condition="$ROS_VERSION == 2">ament_cmake</build_type>
3229
</export>
3330

src/bt_factory.cpp

-58
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,6 @@
1717
#include "behaviortree_cpp/xml_parsing.h"
1818
#include "wildcards/wildcards.hpp"
1919

20-
#ifdef USING_ROS
21-
#include <ros/package.h>
22-
#endif
23-
2420
namespace BT
2521
{
2622

@@ -196,66 +192,12 @@ void BehaviorTreeFactory::registerFromPlugin(const std::string& file_path)
196192
}
197193
}
198194

199-
#ifdef USING_ROS
200-
201-
#ifdef _WIN32
202-
const char os_pathsep(';'); // NOLINT
203-
#else
204-
const char os_pathsep(':'); // NOLINT
205-
#endif
206-
207-
// This function is a copy from the one in class_loader_imp.hpp in ROS pluginlib
208-
// package, licensed under BSD.
209-
// https://github.com/ros/pluginlib
210-
std::vector<std::string> getCatkinLibraryPaths()
211-
{
212-
std::vector<std::string> lib_paths;
213-
const char* env = std::getenv("CMAKE_PREFIX_PATH");
214-
if(env)
215-
{
216-
const std::string env_catkin_prefix_paths(env);
217-
std::vector<BT::StringView> catkin_prefix_paths =
218-
splitString(env_catkin_prefix_paths, os_pathsep);
219-
for(BT::StringView catkin_prefix_path : catkin_prefix_paths)
220-
{
221-
std::filesystem::path path(static_cast<std::string>(catkin_prefix_path));
222-
std::filesystem::path lib("lib");
223-
lib_paths.push_back((path / lib).string());
224-
}
225-
}
226-
return lib_paths;
227-
}
228-
229-
void BehaviorTreeFactory::registerFromROSPlugins()
230-
{
231-
std::vector<std::string> plugins;
232-
ros::package::getPlugins("behaviortree_cpp", "bt_lib_plugin", plugins, true);
233-
std::vector<std::string> catkin_lib_paths = getCatkinLibraryPaths();
234-
235-
for(const auto& plugin : plugins)
236-
{
237-
auto filename = std::filesystem::path(plugin + BT::SharedLibrary::suffix());
238-
for(const auto& lib_path : catkin_lib_paths)
239-
{
240-
const auto full_path = std::filesystem::path(lib_path) / filename;
241-
if(std::filesystem::exists(full_path))
242-
{
243-
std::cout << "Registering ROS plugins from " << full_path.string() << std::endl;
244-
registerFromPlugin(full_path.string());
245-
break;
246-
}
247-
}
248-
}
249-
}
250-
#else
251-
252195
void BehaviorTreeFactory::registerFromROSPlugins()
253196
{
254197
throw RuntimeError("Using attribute [ros_pkg] in <include>, but this library was "
255198
"compiled without ROS support. Recompile the BehaviorTree.CPP "
256199
"using catkin");
257200
}
258-
#endif
259201

260202
void BehaviorTreeFactory::registerBehaviorTreeFromFile(
261203
const std::filesystem::path& filename)

src/xml_parsing.cpp

+1-7
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,6 @@
3636
#include "tinyxml2/tinyxml2.h"
3737
#include <filesystem>
3838

39-
#ifdef USING_ROS
40-
#include <ros/package.h>
41-
#endif
42-
4339
#ifdef USING_ROS2
4440
#include <ament_index_cpp/get_package_share_directory.hpp>
4541
#endif
@@ -283,9 +279,7 @@ void XMLParser::PImpl::loadDocImpl(XMLDocument* doc, bool add_includes)
283279
else
284280
{
285281
std::string ros_pkg_path;
286-
#ifdef USING_ROS
287-
ros_pkg_path = ros::package::getPath(ros_pkg_relative_path);
288-
#elif defined USING_ROS2
282+
#if defined USING_ROS2
289283
ros_pkg_path =
290284
ament_index_cpp::get_package_share_directory(ros_pkg_relative_path);
291285
#else

0 commit comments

Comments
 (0)