Skip to content
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
6 changes: 3 additions & 3 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
version: 2
updates:
- package-ecosystem: github-actions
directory: /
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: monthly
interval: "monthly"
4 changes: 2 additions & 2 deletions .github/workflows/nix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
steps:
- uses: actions/checkout@v6
- uses: cachix/install-nix-action@v31
- uses: cachix/cachix-action@v16
- uses: cachix/cachix-action@v17
with:
name: gepetto
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'
Expand All @@ -39,7 +39,7 @@ jobs:
steps:
- uses: actions/checkout@v6
- uses: cachix/install-nix-action@v31
- uses: cachix/cachix-action@v16
- uses: cachix/cachix-action@v17
with:
name: gepetto
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'
Expand Down
4 changes: 1 addition & 3 deletions .github/workflows/update-flake-lock.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
name: update-flake-lock

on:
workflow_dispatch:
schedule:
- cron: '0 11 8 * *'

jobs:
update-flake-inputs:
runs-on: ubuntu-slim
Expand All @@ -14,7 +12,7 @@ jobs:
steps:
- name: Generate GitHub App Token
id: app-token
uses: actions/create-github-app-token@v2
uses: actions/create-github-app-token@v3
with:
app-id: ${{ secrets.GEPETTO_NIX_APP_ID }}
private-key: ${{ secrets.GEPETTO_NIX_APP_PRIVATE_KEY }}
Expand Down
70 changes: 37 additions & 33 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,36 +1,40 @@
ci:
autoupdate_schedule: quarterly
repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.15.5
hooks:
- id: ruff-check
- id: ruff-format
- repo: https://github.com/cheshirekow/cmake-format-precommit
rev: v0.6.13
hooks:
- id: cmake-format
- repo: https://github.com/pre-commit/mirrors-clang-format
rev: v22.1.0
hooks:
- id: clang-format
args:
- --style=Google
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v6.0.0
hooks:
- id: check-added-large-files
- id: check-ast
- id: check-executables-have-shebangs
- id: check-json
- id: check-merge-conflict
- id: check-symlinks
- id: check-toml
- id: check-yaml
- id: debug-statements
- id: destroyed-symlinks
- id: detect-private-key
- id: end-of-file-fixer
- id: fix-byte-order-marker
- id: mixed-line-ending
- id: trailing-whitespace
- repo: https://github.com/BlankSpruce/gersemi
rev: 0.26.1
hooks:
- id: gersemi
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.15.9
hooks:
- id: ruff-check
- id: ruff-format
- repo: https://github.com/pappasam/toml-sort
rev: v0.24.4
hooks:
- id: toml-sort-fix
- repo: https://github.com/pre-commit/mirrors-clang-format
rev: v22.1.2
hooks:
- id: clang-format
args:
- --style=Google
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v6.0.0
hooks:
- id: check-added-large-files
- id: check-ast
- id: check-executables-have-shebangs
- id: check-json
- id: check-merge-conflict
- id: check-symlinks
- id: check-toml
- id: check-yaml
- id: debug-statements
- id: destroyed-symlinks
- id: detect-private-key
- id: end-of-file-fixer
- id: fix-byte-order-marker
- id: mixed-line-ending
- id: trailing-whitespace
146 changes: 87 additions & 59 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,27 +4,32 @@ set(PROJECT_NAME linear_feedback_controller)
set(PROJECT_DESCRIPTION "ROS2 control with Ricatti gains")
set(PROJECT_URL "http://github.com/loco-3d/linear-feedback-controller")

option(BUILD_DOCUMENTATION
"Build the documentation for the linear-feedback-controller package" OFF)
option(
BUILD_DOCUMENTATION
"Build the documentation for the linear-feedback-controller package"
OFF
)

#
# Project definition
#
find_package(jrl-cmakemodules QUIET CONFIG)
if(jrl-cmakemodules_FOUND)
message(STATUS "JRL cmakemodules found on system at ${JRL_CMAKE_MODULES}")
get_property(
JRL_CMAKE_MODULES
TARGET jrl-cmakemodules::jrl-cmakemodules
PROPERTY INTERFACE_INCLUDE_DIRECTORIES)
message(STATUS "JRL cmakemodules found on system at ${JRL_CMAKE_MODULES}")
get_property(
JRL_CMAKE_MODULES
TARGET jrl-cmakemodules::jrl-cmakemodules
PROPERTY INTERFACE_INCLUDE_DIRECTORIES
)
else()
message(STATUS "JRL cmakemodules not found. Let's fetch it.")
include(FetchContent)
FetchContent_Declare(
"jrl-cmakemodules"
GIT_REPOSITORY "https://github.com/jrl-umi3218/jrl-cmakemodules.git")
FetchContent_MakeAvailable("jrl-cmakemodules")
FetchContent_GetProperties("jrl-cmakemodules" SOURCE_DIR JRL_CMAKE_MODULES)
message(STATUS "JRL cmakemodules not found. Let's fetch it.")
include(FetchContent)
FetchContent_Declare(
"jrl-cmakemodules"
GIT_REPOSITORY "https://github.com/jrl-umi3218/jrl-cmakemodules.git"
)
FetchContent_MakeAvailable("jrl-cmakemodules")
FetchContent_GetProperties("jrl-cmakemodules" SOURCE_DIR JRL_CMAKE_MODULES)
endif()
include("${JRL_CMAKE_MODULES}/base.cmake")
compute_project_args(PROJECT_ARGS LANGUAGES CXX)
Expand All @@ -47,7 +52,8 @@ ament_auto_find_build_dependencies()
include(cmake/sec_generate_parameter_library.cmake)
# Main node params
sec_generate_parameter_library_markdown(${PROJECT_NAME}_parameters_doc
src/${PROJECT_NAME}.yaml)
src/${PROJECT_NAME}.yaml
)
sec_generate_parameter_library(
generated_parameters # Lib name
${PROJECT_NAME}_parameters # CMake target name for the parameter library.
Expand All @@ -56,26 +62,32 @@ sec_generate_parameter_library(
add_dependencies(${PROJECT_NAME}_parameters ${PROJECT_NAME}_parameters_doc)
# Joint estimator params
sec_generate_parameter_library_markdown(joint_state_estimator_parameters_doc
src/joint_state_estimator.yaml)
src/joint_state_estimator.yaml
)
sec_generate_parameter_library(
joint_state_estimator_generated_parameters # Lib name
joint_state_estimator_parameters # CMake target name for the parameter
# library.
src/joint_state_estimator.yaml # Path to input yaml file
)
add_dependencies(joint_state_estimator_parameters
joint_state_estimator_parameters_doc)
add_dependencies(
joint_state_estimator_parameters
joint_state_estimator_parameters_doc
)
# Passthrough params
sec_generate_parameter_library_markdown(passthrough_controller_parameters_doc
src/passthrough_controller.yaml)
src/passthrough_controller.yaml
)
sec_generate_parameter_library(
passthrough_controller_generated_parameters # Lib name
passthrough_controller_parameters # CMake target name for the parameter
# library.
src/passthrough_controller.yaml # Path to input yaml file
)
add_dependencies(passthrough_controller_parameters
passthrough_controller_parameters_doc)
add_dependencies(
passthrough_controller_parameters
passthrough_controller_parameters_doc
)

#
# Main Library
Expand All @@ -88,24 +100,28 @@ set(${PROJECT_NAME}_headers
include/${PROJECT_NAME}/linear_feedback_controller_ros.hpp
include/${PROJECT_NAME}/passthrough_controller.hpp
include/${PROJECT_NAME}/pd_controller.hpp
include/${PROJECT_NAME}/robot_model_builder.hpp)
include/${PROJECT_NAME}/robot_model_builder.hpp
)
set(${PROJECT_NAME}_sources
src/joint_state_estimator.cpp #
src/lf_controller.cpp #
src/linear_feedback_controller.cpp #
src/linear_feedback_controller_ros.cpp #
src/passthrough_controller.cpp #
src/pd_controller.cpp #
src/robot_model_builder.cpp)
src/robot_model_builder.cpp
)
ament_auto_add_library(${PROJECT_NAME} ${${PROJECT_NAME}_sources}
${${PROJECT_NAME}_headers})
${${PROJECT_NAME}_headers}
)

set_target_properties(${PROJECT_NAME} PROPERTIES CXX_VISIBILITY_PRESET hidden)

target_compile_definitions(
${PROJECT_NAME}
PUBLIC -DLINEAR_FEEDBACK_CONTROLLER_IS_SHARED
PRIVATE -DLINEAR_FEEDBACK_CONTROLLER_DO_EXPORT)
${PROJECT_NAME}
PUBLIC -DLINEAR_FEEDBACK_CONTROLLER_IS_SHARED
PRIVATE -DLINEAR_FEEDBACK_CONTROLLER_DO_EXPORT
)

target_link_libraries(${PROJECT_NAME} Eigen3::Eigen)
# Extract the version components of the controller_interface package.
Expand All @@ -116,65 +132,77 @@ list(GET version_list 1 controller_interface_VERSION_MINOR)
list(GET version_list 2 controller_interface_VERSION_PATCH)
# Define macros for the version components.
target_compile_definitions(
${PROJECT_NAME}
PRIVATE
CONTROLLER_INTERFACE_MAJOR_VERSION=${controller_interface_VERSION_MAJOR}
CONTROLLER_INTERFACE_MINOR_VERSION=${controller_interface_VERSION_MINOR}
CONTROLLER_INTERFACE_PATCH_VERSION=${controller_interface_VERSION_PATCH})
${PROJECT_NAME}
PRIVATE
CONTROLLER_INTERFACE_MAJOR_VERSION=${controller_interface_VERSION_MAJOR}
CONTROLLER_INTERFACE_MINOR_VERSION=${controller_interface_VERSION_MINOR}
CONTROLLER_INTERFACE_PATCH_VERSION=${controller_interface_VERSION_PATCH}
)
target_link_libraries(${PROJECT_NAME} pinocchio::pinocchio)
target_link_libraries(
${PROJECT_NAME} ${PROJECT_NAME}_parameters joint_state_estimator_parameters
passthrough_controller_parameters)
${PROJECT_NAME}
${PROJECT_NAME}_parameters
joint_state_estimator_parameters
passthrough_controller_parameters
)

#
# Unit tests
#
if(BUILD_TESTING)
find_package(ament_lint_auto REQUIRED)
ament_auto_find_test_dependencies()
find_package(GTest CONFIG QUIET)
if(NOT GTest_FOUND)
find_package(GTest REQUIRED)
endif()

set(TESTS_LIST test_pd_controller test_linear_feedback_controller
test_robot_model_builder)

if(TARGET GTest::gmock)
set(TESTS_LIST ${TESTS_LIST} test_lf_controller)
endif()
find_package(ament_lint_auto REQUIRED)
ament_auto_find_test_dependencies()
find_package(GTest CONFIG QUIET)
if(NOT GTest_FOUND)
find_package(GTest REQUIRED)
endif()

foreach(test_name ${TESTS_LIST})
add_unit_test(${test_name} tests/${test_name}.cpp)
target_link_libraries(${test_name} PRIVATE ${PROJECT_NAME} GTest::gtest
GTest::gtest_main)
set(TESTS_LIST
test_pd_controller
test_linear_feedback_controller
test_robot_model_builder
)

if(TARGET GTest::gmock)
target_link_libraries(${test_name} PRIVATE GTest::gmock)
set(TESTS_LIST ${TESTS_LIST} test_lf_controller)
endif()
endforeach()

foreach(test_name ${TESTS_LIST})
add_unit_test(${test_name} tests/${test_name}.cpp)
target_link_libraries(
${test_name}
PRIVATE ${PROJECT_NAME} GTest::gtest GTest::gtest_main
)

if(TARGET GTest::gmock)
target_link_libraries(${test_name} PRIVATE GTest::gmock)
endif()
endforeach()
endif()

#
# Export plugins
#
pluginlib_export_plugin_description_file(controller_interface
controller_plugins.xml)
controller_plugins.xml
)

#
# Installation
#
install(
FILES ${CMAKE_CURRENT_BINARY_DIR}/linear_feedback_controller.md
FILES
${CMAKE_CURRENT_BINARY_DIR}/linear_feedback_controller.md
${CMAKE_CURRENT_BINARY_DIR}/joint_state_estimator.md
${CMAKE_CURRENT_BINARY_DIR}/passthrough_controller.md
DESTINATION share/${PROJECT_NAME}/doc)
DESTINATION share/${PROJECT_NAME}/doc
)

install(
PROGRAMS tests/pd_plus_controller.py
DESTINATION lib/${PROJECT_NAME}
RENAME pd_plus_controller)
PROGRAMS tests/pd_plus_controller.py
DESTINATION lib/${PROJECT_NAME}
RENAME pd_plus_controller
)
install(DIRECTORY config DESTINATION share/${PROJECT_NAME})
install(DIRECTORY launch DESTINATION share/${PROJECT_NAME})
ament_export_libraries(${PROJECT_NAME})
Expand Down
Loading
Loading