Skip to content

Commit

Permalink
Modified pid test
Browse files Browse the repository at this point in the history
  • Loading branch information
romi2002 committed Apr 17, 2024
1 parent 0f5fe6d commit e9fba51
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
18 changes: 14 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.5)
cmake_minimum_required(VERSION 3.20)
project(vanttec_controllers)
set(CMAKE_CXX_STANDARD 17)

Expand All @@ -14,9 +14,19 @@ FetchContent_MakeAvailable(googletest)

file(GLOB_RECURSE vanttec_controllers_SRC src/*.cpp)

# TODO Once refactor is done, all files will be used
add_library(vanttec_controllers src/controllers/control_laws/PID/first_order/pid.cpp)
target_include_directories(vanttec_controllers PUBLIC src/)
add_library(vanttec_controllers "")

# Add header files that can be included in other projects.
target_include_directories(vanttec_controllers
PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/src>
$<INSTALL_INTERFACE:include/vanttec_controllers> # This will install headers prefixed with "vanttec_controllers"
)
# Add cpp sources here.
target_sources(vanttec_controllers
PRIVATE
src/controllers/control_laws/PID/first_order/pid.cpp
)

include(GoogleTest)
file(GLOB_RECURSE vanttec_controllers_TESTS tests/*.cpp)
Expand Down
2 changes: 1 addition & 1 deletion tests/controllers/control_laws/pid_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ TEST(PID, ClampU) {
PIDParameters no_negative_param = param;
no_negative_param.kUMin = 0;
PID no_negative_pid(no_negative_param);
EXPECT_GE(pid.update(0, -1), 0);
EXPECT_GE(no_negative_pid.update(0, -1), 0);
}

TEST(PID, RampRateLimit){
Expand Down

0 comments on commit e9fba51

Please sign in to comment.