Skip to content

Commit 31ca43d

Browse files
committed
Merge branch 'Gamecontroller-update-for-HSL' into feature/whistle_detection
2 parents 903670e + 1813faa commit 31ca43d

31 files changed

Lines changed: 11111 additions & 3 deletions

.pre-commit-config.yaml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
exclude: |
2+
^src/lib/|
3+
^src/bitbots_team_communication/bitbots_team_communication/bitbots_team_communication/RobocupProtocol/
4+
15
repos:
26
- repo: https://github.com/astral-sh/ruff-pre-commit
37
rev: v0.9.6
@@ -17,7 +21,6 @@ repos:
1721
args:
1822
- "-i"
1923
- id: cppcheck
20-
exclude: &exclude_robocup_protocol ^src/bitbots_team_communication/bitbots_team_communication/bitbots_team_communication/RobocupProtocol/
2124
args:
2225
- "--inline-suppr"
2326
- "--suppress=missingIncludeSystem"
@@ -31,13 +34,11 @@ repos:
3134
hooks:
3235
- id: cmake-format
3336
- id: cmake-lint
34-
exclude: *exclude_robocup_protocol
3537
- repo: https://github.com/pre-commit/pre-commit-hooks
3638
rev: v5.0.0
3739
hooks:
3840
- id: check-merge-conflict
3941
- id: check-toml
4042
- id: check-xml
4143
- id: check-yaml
42-
exclude: *exclude_robocup_protocol
4344
- id: detect-private-key

src/lib/bio_ik/.gitrepo

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
; DO NOT EDIT (unless you know what you are doing)
2+
;
3+
; This subdirectory is a git "subrepo", and this file is maintained by the
4+
; git-subrepo command. See https://github.com/ingydotnet/git-subrepo#readme
5+
;
6+
[subrepo]
7+
remote = git@github.com:bit-bots/bio_ik.git
8+
branch = ros2
9+
commit = ffec29f7aebb16a9ae67667db4a29d375046c23b
10+
parent = f103e55158ff81138583dcffe2a56546fc193590
11+
method = merge
12+
cmdver = 0.4.9

src/lib/bio_ik/CMakeLists.txt

Lines changed: 184 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,184 @@
1+
cmake_minimum_required(VERSION 3.15)
2+
project(bio_ik)
3+
4+
if(NOT CMAKE_CONFIGURATION_TYPES AND NOT CMAKE_BUILD_TYPE)
5+
set(CMAKE_BUILD_TYPE Release)
6+
endif()
7+
8+
find_package(ament_cmake REQUIRED)
9+
find_package(ament_cmake_ros REQUIRED)
10+
11+
set(THIS_PACKAGE_INCLUDE_DEPENDS
12+
Eigen3
13+
moveit_core
14+
moveit_ros_planning
15+
pluginlib
16+
rclcpp
17+
tf2_eigen
18+
tf2_ros
19+
tf2_kdl
20+
tf2_geometry_msgs
21+
)
22+
23+
foreach(Dependency IN ITEMS ${THIS_PACKAGE_INCLUDE_DEPENDS})
24+
find_package(${Dependency} REQUIRED)
25+
endforeach()
26+
27+
find_package(OpenMP)
28+
# the specific flag is not yet present in cmake 2.8.12
29+
if(OpenMP_CXX_FOUND OR OPENMP_FOUND)
30+
message(STATUS "OPENMP FOUND")
31+
add_compile_options(${OpenMP_CXX_FLAGS})
32+
if(NOT OpenMP_CXX_LIBRARIES)
33+
# cmake 2.8.12 does not yet specify the library - assume we might need libgomp
34+
set(OpenMP_LIBS gomp)
35+
else()
36+
set(OpenMP_LIBS ${OpenMP_CXX_LIBRARIES})
37+
endif()
38+
else()
39+
message(WARNING "OPENMP NOT FOUND. You will suffer performance loss.")
40+
set(OpenMP_LIBS)
41+
endif()
42+
43+
option(USE_FANN "build the neural-network-based IK solver (experimental)" OFF)
44+
if(USE_FANN)
45+
find_library(FANN_LIBRARIES NAMES fann)
46+
find_path(FANN_INCLUDE_DIRS NAMES fann.h)
47+
if(NOT FANN_INCLUDE_DIRS OR NOT FANN_LIBRARIES)
48+
message(FATAL_ERROR "Neural network solver requested, but libfann was not found.")
49+
else()
50+
message("Found libfann: ${FANN_LIBRARIES} / ${FANN_INCLUDE_DIRS}")
51+
endif()
52+
else()
53+
set(FANN_LIBRARIES)
54+
set(FANN_INCLUDE_DIRS)
55+
endif()
56+
57+
option(USE_CPPOPTLIB "Include gradient-based solvers from CppNumericalSolvers (bio_ik also provides its own solver)" OFF)
58+
if(USE_CPPOPTLIB)
59+
find_path(CPPOPTLIB_INCLUDE_DIRS
60+
NAMES cppoptlib/solver/bfgssolver.h
61+
HINTS ../../CppNumericalSolvers/include)
62+
if(NOT CPPOPTLIB_INCLUDE_DIRS)
63+
message(FATAL_ERROR "cppoptlib support requested, but the headers could not be found.")
64+
else()
65+
message("Found cppoptlib: ${CPPOPTLIB_INCLUDE_DIRS}")
66+
endif()
67+
add_definitions(-DENABLE_CPP_OPTLIB)
68+
else()
69+
set(CPPOPTLIB_INCLUDE_DIRS)
70+
endif()
71+
72+
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
73+
add_compile_options(-frecord-gcc-switches)
74+
endif()
75+
76+
add_compile_options($<$<CONFIG:Release>:-O3>)
77+
add_compile_options($<$<CONFIG:Release>:-ftree-vectorize>)
78+
add_compile_options($<$<CONFIG:Release>:-ffast-math>)
79+
80+
include_directories(
81+
include
82+
${FANN_INCLUDE_DIRS}
83+
${CPPOPTLIB_INCLUDE_DIRS}
84+
)
85+
86+
set(SOURCES
87+
src/goal_types.cpp
88+
src/problem.cpp
89+
src/ik_test.cpp
90+
src/ik_gradient.cpp
91+
src/ik_evolution_1.cpp
92+
src/ik_evolution_2.cpp
93+
)
94+
95+
if(USE_FANN)
96+
list(APPEND SOURCES src/ik_neural.cpp)
97+
endif()
98+
99+
if(USE_CPPOPTLIB)
100+
list(APPEND SOURCES src/ik_cppoptlib.cpp)
101+
endif()
102+
103+
add_library(${PROJECT_NAME} ${SOURCES})
104+
105+
target_include_directories(${PROJECT_NAME} PUBLIC
106+
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
107+
$<INSTALL_INTERFACE:include>
108+
)
109+
110+
ament_target_dependencies(
111+
${PROJECT_NAME}
112+
PUBLIC
113+
${THIS_PACKAGE_INCLUDE_DEPENDS}
114+
)
115+
116+
target_link_libraries(
117+
${PROJECT_NAME}
118+
PUBLIC
119+
${FANN_LIBRARIES}
120+
${OpenMP_LIBS}
121+
)
122+
123+
add_library(${PROJECT_NAME}_plugin SHARED
124+
${SOURCES}
125+
src/kinematics_plugin.cpp
126+
)
127+
128+
target_include_directories(${PROJECT_NAME}_plugin PUBLIC
129+
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
130+
$<INSTALL_INTERFACE:include>
131+
)
132+
133+
target_link_libraries(
134+
${PROJECT_NAME}_plugin
135+
PRIVATE
136+
${PROJECT_NAME}
137+
)
138+
139+
140+
install(
141+
DIRECTORY include/
142+
DESTINATION include
143+
)
144+
install(
145+
TARGETS ${PROJECT_NAME} ${PROJECT_NAME}_plugin
146+
EXPORT export_${PROJECT_NAME}
147+
LIBRARY DESTINATION lib
148+
ARCHIVE DESTINATION lib
149+
RUNTIME DESTINATION bin
150+
INCLUDES DESTINATION include
151+
)
152+
153+
154+
pluginlib_export_plugin_description_file(
155+
moveit_core
156+
bio_ik_kinematics_description.xml
157+
)
158+
159+
ament_export_include_directories(
160+
include
161+
)
162+
ament_export_libraries(
163+
${PROJECT_NAME}_plugin
164+
)
165+
ament_export_targets(
166+
export_${PROJECT_NAME}
167+
)
168+
169+
ament_export_dependencies(${THIS_PACKAGE_INCLUDE_DEPENDS})
170+
171+
if(BUILD_TESTING)
172+
find_package(ament_cmake_gtest REQUIRED)
173+
174+
ament_add_gtest(bio_ik_test test/utest.cpp)
175+
target_link_libraries(bio_ik_test
176+
bio_ik
177+
)
178+
target_include_directories(bio_ik_test
179+
PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
180+
PUBLIC $<INSTALL_INTERFACE:include>)
181+
182+
endif()
183+
184+
ament_package()

0 commit comments

Comments
 (0)