Skip to content

Commit 097cdeb

Browse files
committed
Update back to upstream/devel
1 parent 7425eef commit 097cdeb

File tree

242 files changed

+20940
-20569
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

242 files changed

+20940
-20569
lines changed

CMakeLists.txt

Lines changed: 5 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
cmake_minimum_required(VERSION 3.0)
1+
cmake_minimum_required(VERSION 2.6)
22

33
project(libbarrett)
44
set(libbarrett_VERSION_MAJOR 3)
@@ -22,7 +22,7 @@ set(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake/modules/")
2222
option(BUILD_SHARED_LIBS "Set to OFF to build static libraries" ON)
2323
option(OPTIMIZE_FOR_PROCESSOR "Set to ON to build binaries that are optimized for this specific computer and can't be copied to other machines" OFF)
2424
option(WITH_PYTHON "Set to ON to build Python bindings for libbarrett" ON)
25-
option(INSTALL_EXAMPLES "Set to ON to copy libbarrett example programs to the current user's home folder when the library is installed" OFF)
25+
option(INSTALL_EXAMPLES "Set to ON to copy libbarrett example programs to the current user's home folder when the library is installed" ON)
2626
option(INSTALL_SANDBOX "Set to ON to copy libbarrett sandbox programs to the current user's home folder when the library is installed" ON)
2727
option(CONFIG_PACKAGE "Set to ON to set up CPACK variables necessary for packaging" OFF)
2828
option(CONFIG_DEBIAN "Set to ON to copy standard barrett-config.cmake, required for Debian packaging" OFF)
@@ -79,10 +79,7 @@ set(exported_link_dirs ${exported_link_dirs} ${CMAKE_INSTALL_PREFIX}/lib)
7979
## GSL
8080
find_package(GSL REQUIRED)
8181
include_directories(${GSL_INCLUDE_DIRS})
82-
link_directories(${GSL_LIBRARY_DIRS})
83-
8482
set(exported_include_dirs ${exported_include_dirs} ${GSL_INCLUDE_DIRS})
85-
set(exported_link_dirs ${exported_link_dirs} ${GSL_LIBRARY_DIRS})
8683

8784
## Python
8885
if (WITH_PYTHON)
@@ -103,10 +100,6 @@ endif()
103100
message(STATUS "Boost components: ${boost_components}")
104101
find_package(Boost REQUIRED ${boost_components})
105102

106-
# Ignore Boost internal deprecation
107-
add_definitions("-DBOOST_ALLOW_DEPRECATED_HEADERS")
108-
add_definitions("-DBOOST_BIND_GLOBAL_PLACEHOLDERS")
109-
110103
## Translate cmake's new "Boost::blah" library naming format to a normal "libboost_blah" name that can be passed to the linker.
111104
## TODO(bz): Hunt down anyone who makes stupid changes like this and make them suffer.
112105
set(boost_libraries "")
@@ -125,9 +118,9 @@ set(exported_link_dirs ${exported_link_dirs} ${Boost_LIBRARY_DIRS})
125118

126119
## Eigen3
127120
find_package(Eigen3 REQUIRED)
128-
include_directories(${EIGEN3_INCLUDE_DIRS})
129-
set(exported_include_dirs ${exported_include_dirs} ${EIGEN3_INCLUDE_DIRS})
130-
message(STATUS "Eigen Include Dirs: ${EIGEN3_INCLUDE_DIRS}")
121+
include_directories(${Eigen_INCLUDE_DIRS})
122+
set(exported_include_dirs ${exported_include_dirs} ${Eigen_INCLUDE_DIRS})
123+
131124

132125
## curses
133126
find_package(Curses REQUIRED)
@@ -140,28 +133,6 @@ include_directories(${CURSES_INCLUDE_DIR})
140133
# barrett-config.cmake is generated.
141134
add_subdirectory(src)
142135

143-
### Auto Format
144-
# Only files that are substantially different from upstream libbarrett should
145-
# be formatted.
146-
include(ClangFormat)
147-
clang_format_setup(VERSION 14)
148-
149-
if (CLANG_FORMAT_EXECUTABLE)
150-
file(GLOB_RECURSE ALL_SOURCE_FILES
151-
LIST_DIRECTORIES false
152-
include/*.h
153-
include/*.hpp
154-
src/*.c
155-
src/*.cpp
156-
tests/*.cpp
157-
tests/*.hpp
158-
tests/*.h
159-
programs/*.cpp
160-
examples/*.h
161-
examples/*.cpp)
162-
clang_format_add_sources(${ALL_SOURCE_FILES})
163-
clang_format_add_targets()
164-
endif()
165136

166137

167138
### Installation
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
set(BARRETT_INCLUDE_DIRS /usr/xenomai/include;/usr/include/xenomai;/usr/local/include/eigen3;/usr/include/eigen3)
22
set(BARRETT_DEFINITIONS -D_GNU_SOURCE -D_REENTRANT -Wall -pipe -D__XENO__)
3-
set(BARRETT_LIBRARIES libboost_thread-mt.so;pthread;libboost_python-py36.so;-L/usr/lib;-lgsl;-lgslcblas;-lm;config;config++;/usr/xenomai/lib/libalchemy.so;/usr/xenomai/lib/libxenomai.so;/usr/xenomai/lib/librtdm.so;libpython2.7.so;barrett)
3+
set(BARRETT_LIBRARIES libboost_thread-mt.so;pthread;libboost_python.so;-L/usr/lib;-lgsl;-lgslcblas;-lm;config;config++;/usr/xenomai/lib/libnative.so;/usr/xenomai/lib/libxenomai.so;/usr/xenomai/lib/librtdm.so;libpython2.7.so;barrett)

cmake/modules/ClangFormat.cmake

Lines changed: 0 additions & 90 deletions
This file was deleted.

cmake/modules/FindEigen2.cmake

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
# - Try to find Eigen2 lib
2+
# Once done this will define
3+
#
4+
# EIGEN2_FOUND - system has eigen lib with correct version
5+
# EIGEN2_INCLUDE_DIR - the eigen include directory
6+
# EIGEN2_VERSION - eigen version
7+
8+
# Copyright (c) 2006, 2007 Montel Laurent, <[email protected]>
9+
# Copyright (c) 2008, 2009 Gael Guennebaud, <[email protected]>
10+
# Redistribution and use is allowed according to the terms of the BSD license.
11+
12+
if(NOT EIGEN2_MIN_VERSION)
13+
if(NOT Eigen2_FIND_VERSION_MAJOR)
14+
set(Eigen2_FIND_VERSION_MAJOR 2)
15+
endif(NOT Eigen2_FIND_VERSION_MAJOR)
16+
if(NOT Eigen2_FIND_VERSION_MINOR)
17+
set(Eigen2_FIND_VERSION_MINOR 0)
18+
endif(NOT Eigen2_FIND_VERSION_MINOR)
19+
if(NOT Eigen2_FIND_VERSION_PATCH)
20+
set(Eigen2_FIND_VERSION_PATCH 0)
21+
endif(NOT Eigen2_FIND_VERSION_PATCH)
22+
23+
set(EIGEN2_MIN_VERSION "${Eigen2_FIND_VERSION_MAJOR}.${Eigen2_FIND_VERSION_MINOR}.${Eigen2_FIND_VERSION_PATCH}")
24+
endif(NOT EIGEN2_MIN_VERSION)
25+
26+
macro(_eigen2_check_version)
27+
file(READ "${EIGEN2_INCLUDE_DIR}/Eigen/src/Core/util/Macros.h" _eigen2_version_header LIMIT 5000 OFFSET 1000)
28+
29+
string(REGEX MATCH "define *EIGEN_WORLD_VERSION ([0-9]*)" _eigen2_world_version_match "${_eigen2_version_header}")
30+
set(EIGEN2_WORLD_VERSION "${CMAKE_MATCH_1}")
31+
string(REGEX MATCH "define *EIGEN_MAJOR_VERSION ([0-9]*)" _eigen2_major_version_match "${_eigen2_version_header}")
32+
set(EIGEN2_MAJOR_VERSION "${CMAKE_MATCH_1}")
33+
string(REGEX MATCH "define *EIGEN_MINOR_VERSION ([0-9]*)" _eigen2_minor_version_match "${_eigen2_version_header}")
34+
set(EIGEN2_MINOR_VERSION "${CMAKE_MATCH_1}")
35+
36+
set(EIGEN2_VERSION ${EIGEN2_WORLD_VERSION}.${EIGEN2_MAJOR_VERSION}.${EIGEN2_MINOR_VERSION})
37+
if(${EIGEN2_VERSION} VERSION_LESS ${EIGEN2_MIN_VERSION})
38+
set(EIGEN2_VERSION_OK FALSE)
39+
else(${EIGEN2_VERSION} VERSION_LESS ${EIGEN2_MIN_VERSION})
40+
set(EIGEN2_VERSION_OK TRUE)
41+
endif(${EIGEN2_VERSION} VERSION_LESS ${EIGEN2_MIN_VERSION})
42+
43+
if(NOT EIGEN2_VERSION_OK)
44+
45+
message(STATUS "Eigen2 version ${EIGEN2_VERSION} found in ${EIGEN2_INCLUDE_DIR}, "
46+
"but at least version ${EIGEN2_MIN_VERSION} is required")
47+
endif(NOT EIGEN2_VERSION_OK)
48+
endmacro(_eigen2_check_version)
49+
50+
if (EIGEN2_INCLUDE_DIR)
51+
52+
# in cache already
53+
_eigen2_check_version()
54+
set(EIGEN2_FOUND ${EIGEN2_VERSION_OK})
55+
56+
else (EIGEN2_INCLUDE_DIR)
57+
58+
find_path(EIGEN2_INCLUDE_DIR NAMES Eigen/Core
59+
PATHS
60+
${INCLUDE_INSTALL_DIR}
61+
${KDE4_INCLUDE_DIR}
62+
PATH_SUFFIXES eigen2
63+
)
64+
65+
if(EIGEN2_INCLUDE_DIR)
66+
_eigen2_check_version()
67+
endif(EIGEN2_INCLUDE_DIR)
68+
69+
include(FindPackageHandleStandardArgs)
70+
find_package_handle_standard_args(Eigen2 DEFAULT_MSG EIGEN2_INCLUDE_DIR EIGEN2_VERSION_OK)
71+
72+
mark_as_advanced(EIGEN2_INCLUDE_DIR)
73+
74+
endif(EIGEN2_INCLUDE_DIR)

cmake/modules/FindEigen3.cmake

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# - Try to find Eigen3 lib
2+
#
3+
# This module supports requiring a minimum version, e.g. you can do
4+
# find_package(Eigen3 3.1.2)
5+
# to require version 3.1.2 or newer of Eigen3.
6+
#
7+
# Once done this will define
8+
#
9+
# Eigen_FOUND - system has eigen lib with correct version
10+
# Eigen_INCLUDE_DIR - the eigen include directory
11+
# Eigen_VERSION - eigen version
12+
13+
# Copyright (c) 2006, 2007 Montel Laurent, <[email protected]>
14+
# Copyright (c) 2008, 2009 Gael Guennebaud, <[email protected]>
15+
# Copyright (c) 2009 Benoit Jacob <[email protected]>
16+
# Redistribution and use is allowed according to the terms of the 2-clause BSD license.
17+
18+
find_package(PkgConfig)
19+
pkg_check_modules(PC_EIGEN eigen3)
20+
set(EIGEN_DEFINITIONS ${PC_EIGEN_CFLAGS_OTHER})
21+
22+
find_path(EIGEN_INCLUDE_DIR Eigen/Core
23+
HINTS ${PC_EIGEN_INCLUDEDIR} ${PC_EIGEN_INCLUDE_DIRS} "${EIGEN_ROOT}" "$ENV{EIGEN_ROOT}"
24+
PATHS "$ENV{PROGRAMFILES}/Eigen" "$ENV{PROGRAMW6432}/Eigen"
25+
"$ENV{PROGRAMFILES}/Eigen 3.0.0" "$ENV{PROGRAMW6432}/Eigen 3.0.0"
26+
PATH_SUFFIXES eigen3 include/eigen3 include)
27+
28+
set(EIGEN_INCLUDE_DIRS ${EIGEN_INCLUDE_DIR})
29+
30+
include(FindPackageHandleStandardArgs)
31+
find_package_handle_standard_args(Eigen DEFAULT_MSG EIGEN_INCLUDE_DIR)
32+
33+
mark_as_advanced(EIGEN_INCLUDE_DIR)
34+
35+
if(EIGEN_FOUND)
36+
message(STATUS "Eigen found (include: ${EIGEN_INCLUDE_DIRS})")
37+
endif(EIGEN_FOUND)
38+
39+
40+
set(Eigen_INCLUDE_DIRS ${EIGEN_INCLUDE_DIRS})
41+
set(Eigen_FOUND ${EIGEN_FOUND})

cmake/modules/FindGSL.cmake

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -102,24 +102,14 @@ else( WIN32 AND NOT CYGWIN AND NOT MSYS )
102102
ERROR_QUIET
103103
)
104104
if( RET EQUAL 0 )
105-
string(STRIP "${GSL_LIBRARIES}" GSL_CONFIG_LIBRARIES )
106-
separate_arguments( GSL_CONFIG_LIBRARIES )
105+
string(STRIP "${GSL_LIBRARIES}" GSL_LIBRARIES )
106+
separate_arguments( GSL_LIBRARIES )
107107

108108
# extract linkdirs (-L) for rpath (i.e., LINK_DIRECTORIES)
109109
string( REGEX MATCHALL "-L[^;]+"
110-
GSL_LIBRARY_DIRS "${GSL_CONFIG_LIBRARIES}" )
110+
GSL_LIBRARY_DIRS "${GSL_LIBRARIES}" )
111111
string( REPLACE "-L" ""
112112
GSL_LIBRARY_DIRS "${GSL_LIBRARY_DIRS}" )
113-
114-
# extract libraries (-l)
115-
# ignore "x86_64-linux-gnu"
116-
string( REGEX MATCHALL ";-l[^;]+"
117-
GSL_LIBRARIES "${GSL_CONFIG_LIBRARIES}" )
118-
string( REGEX MATCHALL "-l[^;]+"
119-
GSL_LIBRARIES "${GSL_LIBRARIES}" )
120-
string( REPLACE "-l" ""
121-
GSL_LIBRARIES "${GSL_LIBRARIES}" )
122-
123113
else( RET EQUAL 0 )
124114
set( GSL_FOUND FALSE )
125115
endif( RET EQUAL 0 )

cmake/modules/FindXenomai.cmake

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,10 @@ if( UNIX )
3636

3737

3838
# find the xenomai pthread library
39-
find_library( XENOMAI_LIBRARY_ALCHEMY alchemy copperplate ${XENOMAI_DIR}/lib )
40-
find_library( XENOMAI_LIBRARY_XENOMAI cobalt copperplate ${XENOMAI_DIR}/lib )
41-
find_library( XENOMAI_LIBRARY_COPPERPLATE copperplate ${XENOMAI_DIR}/lib )
42-
find_library( XENOMAI_LIBRARY_PTHREAD_RT trank ${XENOMAI_DIR}/lib )
43-
find_library( XENOMAI_LIBRARY_RTDM trank ${XENOMAI_DIR}/lib )
39+
find_library( XENOMAI_LIBRARY_NATIVE native ${XENOMAI_DIR}/lib )
40+
find_library( XENOMAI_LIBRARY_XENOMAI xenomai ${XENOMAI_DIR}/lib )
41+
find_library( XENOMAI_LIBRARY_PTHREAD_RT pthread_rt rtdm ${XENOMAI_DIR}/lib )
42+
find_library( XENOMAI_LIBRARY_RTDM rtdm ${XENOMAI_DIR}/lib )
4443

4544
# find the posix wrappers
4645
find_file(XENOMAI_POSIX_WRAPPERS lib/posix.wrappers ${XENOMAI_SEARCH_PATH} )

examples/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
cmake_minimum_required(VERSION 3.0)
1+
cmake_minimum_required(VERSION 2.6)
22
project(libbarrett_examples)
33

44

examples/ex01_initialize_wam.cpp

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,9 @@
2020
* Shift-idle the WAM and it will again be ready to use.
2121
*/
2222

23-
#include <barrett/products/product_manager.h>
23+
2424
#include <barrett/systems.h>
25+
#include <barrett/products/product_manager.h>
2526

2627
// The file below defines Barrett's standard main() function (SMF). It helps you
2728
// initialize Barrett's products properly without having to repeat the necessary
@@ -30,9 +31,11 @@
3031
// wam_main() function below once the WAM is ready to start applying torques.
3132
#include <barrett/standard_main_function.h>
3233

34+
3335
// The root namespace for libbarrett
3436
using namespace barrett;
3537

38+
3639
// In this case, wam_main() is a function template. For a brief introduction to
3740
// C++ templates, see:
3841
// http://www.devarticles.com/c/a/Cplusplus/An-Introduction-to-C-plus-Templates/
@@ -45,14 +48,15 @@ using namespace barrett;
4548
// version of this function where DOF = 7, and a version where DOF = 4. The SMF
4649
// will choose between the two versions based on what kind of robot is present
4750
// when the program is executed.
48-
template <size_t DOF>
49-
int wam_main(int argc, char **argv, ProductManager &pm,
50-
systems::Wam<DOF> &wam) {
51+
template<size_t DOF>
52+
int wam_main(int argc, char** argv, ProductManager& pm, systems::Wam<DOF>& wam) {
53+
54+
55+
// The WAM is now Shift-activated and applying zero torque with a loop-rate
56+
// of 500Hz.
5157

52-
// The WAM is now Shift-activated and applying zero torque with a loop-rate
53-
// of 500Hz.
5458

55-
// Wait for the user to press Shift-idle
56-
pm.getSafetyModule()->waitForMode(SafetyModule::IDLE);
57-
return 0;
59+
// Wait for the user to press Shift-idle
60+
pm.getSafetyModule()->waitForMode(SafetyModule::IDLE);
61+
return 0;
5862
}

0 commit comments

Comments
 (0)