Skip to content

Commit

Permalink
Backward compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
christophfroehlich committed Nov 4, 2024
1 parent 1ec808b commit e04739b
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 9 deletions.
16 changes: 8 additions & 8 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -62,20 +62,20 @@ generate_parameter_library(
src/control_filters/low_pass_filter_parameters.yaml
)

add_library(low_pass_filter SHARED
add_library(low_pass_filter_ros SHARED
src/control_filters/low_pass_filter_ros.cpp
)
target_compile_features(low_pass_filter PUBLIC cxx_std_17)
target_include_directories(low_pass_filter PUBLIC
target_compile_features(low_pass_filter_ros PUBLIC cxx_std_17)
target_include_directories(low_pass_filter_ros PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<BUILD_INTERFACE:${EIGEN3_INCLUDE_DIR}>
$<INSTALL_INTERFACE:include/control_toolbox>
)
target_link_libraries(low_pass_filter PUBLIC
target_link_libraries(low_pass_filter_ros PUBLIC
low_pass_filter_parameters
Eigen3::Eigen
)
ament_target_dependencies(low_pass_filter PUBLIC ${CONTROL_FILTERS_INCLUDE_DEPENDS})
ament_target_dependencies(low_pass_filter_ros PUBLIC ${CONTROL_FILTERS_INCLUDE_DEPENDS})

# Install pluginlib xml
pluginlib_export_plugin_description_file(filters control_filters.xml)
Expand All @@ -102,11 +102,11 @@ if(BUILD_TESTING)
add_rostest_with_parameters_gmock(test_low_pass_filter_ros test/control_filters/test_low_pass_filter_ros.cpp
${CMAKE_CURRENT_SOURCE_DIR}/test/control_filters/test_low_pass_filter_parameters.yaml
)
target_link_libraries(test_low_pass_filter_ros low_pass_filter low_pass_filter_parameters)
target_link_libraries(test_low_pass_filter_ros low_pass_filter_ros low_pass_filter_parameters)
ament_target_dependencies(test_low_pass_filter_ros ${CONTROL_FILTERS_INCLUDE_DEPENDS})

ament_add_gmock(test_load_low_pass_filter test/control_filters/test_load_low_pass_filter_ros.cpp)
target_link_libraries(test_load_low_pass_filter low_pass_filter low_pass_filter_parameters)
target_link_libraries(test_load_low_pass_filter low_pass_filter_ros low_pass_filter_parameters)
ament_target_dependencies(test_load_low_pass_filter ${CONTROL_FILTERS_INCLUDE_DEPENDS})
endif()

Expand All @@ -115,7 +115,7 @@ install(
DIRECTORY include/
DESTINATION include/control_toolbox
)
install(TARGETS control_toolbox low_pass_filter low_pass_filter_parameters
install(TARGETS control_toolbox low_pass_filter_ros low_pass_filter_parameters
EXPORT export_control_toolbox
ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib
Expand Down
2 changes: 1 addition & 1 deletion control_filters.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<class_libraries>
<library path="low_pass_filter">
<library path="low_pass_filter_ros">
<class name="control_filters/LowPassFilterDouble"
type="control_filters::LowPassFilterRos&lt;double&gt;"
base_class_type="filters::FilterBase&lt;double&gt;">
Expand Down
37 changes: 37 additions & 0 deletions include/control_filters/low_pass_filter.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
// Copyright (c) 2023, Stogl Robotics Consulting UG (haftungsbeschränkt)
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

#ifndef CONTROL_FILTERS__LOW_PASS_FILTER_HPP_
#define CONTROL_FILTERS__LOW_PASS_FILTER_HPP_

#include "low_pass_filter_ros.hpp"

// TODO(christophfroehlich) file is only for backwards compatibility, remove this file in the future

// Deprecation notice
#ifdef _WIN32
#pragma message( \
"This header include is deprecated. Please update your code to use 'low_pass_filter_ros.hpp' header and link against 'control_toolbox' library.") //NOLINT
#else
#warning \
"This header include is deprecated. Please update your code to use 'low_pass_filter_ros.hpp' header and link against 'control_toolbox' library." //NOLINT
#endif

namespace control_filters
{
template <typename T>
using LowPassFilter = control_filters::LowPassFilterRos<T>;
} // namespace control_filters

#endif // CONTROL_FILTERS__LOW_PASS_FILTER_HPP_

0 comments on commit e04739b

Please sign in to comment.