Revision 2df0ddb0

View differences:

CMakeLists.txt
1
cmake_minimum_required(VERSION 2.8.3)
2
project(humotion)
3

  
4
set(ENV{ROS_LANG_DISABLE} "genjava")
5

  
6
set(ROS_BUILD_TYPE Debug)
7

  
8
################################################################
9
# check for ROS support:
10
find_package(catkin REQUIRED COMPONENTS
11
    roscpp
12
    std_msgs
13
    sensor_msgs
14
    message_generation
15
    genmsg
16
    dynamic_reconfigure
17
)
18

  
19
IF (NOT catkin_FOUND)
20
  MESSAGE(FATAL_ERROR "Error: could not find ROS middleware!")
21
ENDIF (NOT catkin_FOUND)
22

  
23
INCLUDE(FindPkgConfig)
24

  
25
##libreflexxes
26
#IF (libreflexxes_DIR)
27
#  MESSAGE("using libreflexxes_DIR as override ('${libreflexxes_DIR}')")
28
#  SET(REFLEXXES_PREFIX ${libreflexxes_DIR})
29
#  SET(REFLEXXES_LIBRARY "ReflexxesTypeII")
30
#ELSE ()
31
  PKG_CHECK_MODULES(REFLEXXES REQUIRED libReflexxesTypeII>=1.2.3)
32
  IF (NOT REFLEXXES_FOUND)
33
    message(FATAL_ERROR "Error: could not find lib libReflexxesTypeII")
34
  ENDIF ()
35
#ENDIF ()
36

  
37

  
38
SET(REFLEXXES_LIBRARY_DIRS "${REFLEXXES_PREFIX}/lib")
39
SET(REFLEXXES_INCLUDE_DIRS "${REFLEXXES_PREFIX}/include")
40
#resolve to absolute library filename
41
#or is there an easier way to get the absolute lib filename from pkg config files?!
42
find_library(REFLEXXES_LIBRARY NAMES ${REFLEXXES_LIBRARIES} HINTS ${REFLEXXES_LIBRARY_DIRS})
43

  
44
MESSAGE("-- using libReflexxesTypeII version ${REFLEXXES_VERSION} from ${REFLEXXES_INCLUDE_DIRS} and ${REFLEXXES_LIBRARY_DIRS}")
45
MESSAGE("-- will link against ${REFLEXXES_LIBRARY}")
46

  
47
set(CMAKE_CXX_FLAGS "-g -Wall")
48
add_definitions ("-Wall")
49

  
50
#######################################
51
## Declare ROS messages and services ##
52
#######################################
53

  
54
add_message_files(
55
        FILES
56
        gaze.msg
57
        position_lcr.msg
58
        mouth.msg
59
)
60

  
61
## Generate added messages and services with any dependencies listed here
62
generate_messages(
63
        DEPENDENCIES
64
        std_msgs
65
        humotion
66
)
67

  
68
# add dynamic reconfigure api
69
generate_dynamic_reconfigure_options(
70
  cfg/humotion.cfg
71
)
72

  
73
#
74
###################################
75
## catkin specific configuration ##
76
###################################
77
## The catkin_package macro generates cmake config files for your package
78
## Declare things to be passed to dependent projects
79
## INCLUDE_DIRS: uncomment this if you package contains header files
80
## LIBRARIES: libraries you create in this project that dependent projects also need
81
## CATKIN_DEPENDS: catkin_packages dependent projects also need
82
## DEPENDS: system dependencies of this project that dependent projects also need
83
catkin_package(
84
    INCLUDE_DIRS include
85
    LIBRARIES humotion
86
    #CATKIN_DEPENDS message_runtime
87
    #DEPENDS system_lib
88
)
89

  
90
###########
91
## Build ##
92
###########
93

  
94
## Specify additional locations of header files
95
## Your package locations should be listed before other locations
96
include_directories(BEFORE ${Boost_INCLUDE_DIRS} ${REFLEXXES_INCLUDE_DIRS})
97
include_directories(BEFORE include)
98

  
99
#make sure to use ros messages from current build
100
include_directories(BEFORE ${CATKIN_DEVEL_PREFIX}/include)
101

  
102
#this should be appended:
103
include_directories(${catkin_INCLUDE_DIRS})
104

  
105
#link_directories (${Boost_LIBRARY_DIRS} ${REFLEXXES_LIBRARY_DIRS} ${catkin_LIBRARY_DIRS})
106

  
107
## Declare a cpp library
108
add_library(${PROJECT_NAME}
109
    src/client/client.cpp
110
    src/client/middleware.cpp
111
    src/client/middleware_ros.cpp
112

  
113
    src/server/server.cpp
114
    src/server/config.cpp
115
    src/server/middleware.cpp
116
    src/server/middleware_ros.cpp
117
    src/server/controller.cpp
118
    src/server/joint_interface.cpp
119
    src/server/motion_generator.cpp
120
    src/server/gaze_motion_generator.cpp
121
    src/server/reflexxes_motion_generator.cpp
122
    src/server/mouth_motion_generator.cpp
123
    src/server/eye_motion_generator.cpp
124
    src/server/eyelid_motion_generator.cpp
125
    src/server/eyebrow_motion_generator.cpp
126
    src/server/neck_motion_generator.cpp
127

  
128
    src/mouth_state.cpp
129
    src/gaze_state.cpp
130
    src/timestamp.cpp
131
    src/timestamped_list.cpp
132
)
133

  
134
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x")
135

  
136
## Add cmake target dependencies of the executable/library
137
## as an example, message headers may need to be generated before nodes
138
add_dependencies(${PROJECT_NAME} ${catkin_EXPORTED_TARGETS} ${PROJECT_NAME}_gencpp ${PROJECT_NAME}_gencfg)
139

  
140
## Specify libraries to link a library or executable target against
141
target_link_libraries(${PROJECT_NAME}
142
    ${Boost_LIBRARIES}
143
    ${catkin_LIBRARIES}
144
    ${REFLEXXES_LIBRARY}
145
)
146

  
147
set_property(TARGET ${PROJECT_NAME} PROPERTY INSTALL_RPATH_USE_LINK_PATH TRUE)
148

  
149
#############
150
## Install ##
151
#############
152

  
153
# all install targets should use catkin DESTINATION variables
154
# See http://ros.org/doc/api/catkin/html/adv_user_guide/variables.html
155

  
156
## Mark executable scripts (Python etc.) for installation
157
## in contrast to setup.py, you can choose the destination
158
# install(PROGRAMS
159
#   scripts/my_python_script
160
#   DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
161
# )
162

  
163
## Mark executables and/or libraries for installation
164
install(TARGETS ${PROJECT_NAME}
165
    ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
166
    LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
167
    RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
168
)
169
## Mark cpp header files for installation
170
install(DIRECTORY include/humotion/
171
    DESTINATION ${CATKIN_PACKAGE_INCLUDE_DESTINATION}
172
)
173

  
174
#############
175
## Testing ##
176
#############
177
## Add gtest based cpp test target and link libraries
178
catkin_add_gtest(${PROJECT_NAME}-test-server test/server.cpp)
179
if(TARGET ${PROJECT_NAME}-test-server)
180
target_link_libraries(${PROJECT_NAME}-test-server ${PROJECT_NAME})
181
endif()
182
catkin_add_gtest(${PROJECT_NAME}-test-client test/client.cpp)
183
if(TARGET ${PROJECT_NAME}-test-client)
184
target_link_libraries(${PROJECT_NAME}-test-client ${PROJECT_NAME})
185
endif()
186
catkin_add_gtest(${PROJECT_NAME}-test-timestamp test/timestamp.cpp)
187
if(TARGET ${PROJECT_NAME}-test-timestamp)
188
target_link_libraries(${PROJECT_NAME}-test-timestamp ${PROJECT_NAME})
189
endif()
190

  
191
### Add folders to be run by python nosetests
192
# catkin_add_nosetests(test)
193

  
194

  
195
#finally build (some) examples
196
#add_subdirectory(./examples)
197

  
198

  
199
#################
200
## style guide ##
201
#################
202
set(ENABLE_CPPLINT 1)
203
include(${CMAKE_CURRENT_SOURCE_DIR}/stylecheck/CpplintWrapper.cmake)
204
CPPLINT_RECURSIVE(cpplint_include
205
  ${CMAKE_CURRENT_SOURCE_DIR}/include
206
  ${CMAKE_CURRENT_SOURCE_DIR}/include
207
  ${CMAKE_CURRENT_BINARY_DIR}/include)
208
CPPLINT_RECURSIVE(cpplint_src
209
  ${CMAKE_CURRENT_SOURCE_DIR}/src
210
  ${CMAKE_CURRENT_SOURCE_DIR}/src
211
  ${CMAKE_CURRENT_BINARY_DIR}/src)
212
add_dependencies(${PROJECT_NAME} cpplint_src cpplint_include)
213

  
214
#workaround for qtcreator ide integration. do not remove!
215
file(GLOB_RECURSE NODE_DUMMY_TARGETS RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.h *.cfg *.yaml *.xml *.launch)
216
add_custom_target(_dummy_target SOURCES ${NODE_DUMMY_TARGETS})
COPYING
1
                   GNU LESSER GENERAL PUBLIC LICENSE
2
                       Version 3, 29 June 2007
3

  
4
 Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
5
 Everyone is permitted to copy and distribute verbatim copies
6
 of this license document, but changing it is not allowed.
7

  
8

  
9
  This version of the GNU Lesser General Public License incorporates
10
the terms and conditions of version 3 of the GNU General Public
11
License, supplemented by the additional permissions listed below.
12

  
13
  0. Additional Definitions.
14

  
15
  As used herein, "this License" refers to version 3 of the GNU Lesser
16
General Public License, and the "GNU GPL" refers to version 3 of the GNU
17
General Public License.
18

  
19
  "The Library" refers to a covered work governed by this License,
20
other than an Application or a Combined Work as defined below.
21

  
22
  An "Application" is any work that makes use of an interface provided
23
by the Library, but which is not otherwise based on the Library.
24
Defining a subclass of a class defined by the Library is deemed a mode
25
of using an interface provided by the Library.
26

  
27
  A "Combined Work" is a work produced by combining or linking an
28
Application with the Library.  The particular version of the Library
29
with which the Combined Work was made is also called the "Linked
30
Version".
31

  
32
  The "Minimal Corresponding Source" for a Combined Work means the
33
Corresponding Source for the Combined Work, excluding any source code
34
for portions of the Combined Work that, considered in isolation, are
35
based on the Application, and not on the Linked Version.
36

  
37
  The "Corresponding Application Code" for a Combined Work means the
38
object code and/or source code for the Application, including any data
39
and utility programs needed for reproducing the Combined Work from the
40
Application, but excluding the System Libraries of the Combined Work.
41

  
42
  1. Exception to Section 3 of the GNU GPL.
43

  
44
  You may convey a covered work under sections 3 and 4 of this License
45
without being bound by section 3 of the GNU GPL.
46

  
47
  2. Conveying Modified Versions.
48

  
49
  If you modify a copy of the Library, and, in your modifications, a
50
facility refers to a function or data to be supplied by an Application
51
that uses the facility (other than as an argument passed when the
52
facility is invoked), then you may convey a copy of the modified
53
version:
54

  
55
   a) under this License, provided that you make a good faith effort to
56
   ensure that, in the event an Application does not supply the
57
   function or data, the facility still operates, and performs
58
   whatever part of its purpose remains meaningful, or
59

  
60
   b) under the GNU GPL, with none of the additional permissions of
61
   this License applicable to that copy.
62

  
63
  3. Object Code Incorporating Material from Library Header Files.
64

  
65
  The object code form of an Application may incorporate material from
66
a header file that is part of the Library.  You may convey such object
67
code under terms of your choice, provided that, if the incorporated
68
material is not limited to numerical parameters, data structure
69
layouts and accessors, or small macros, inline functions and templates
70
(ten or fewer lines in length), you do both of the following:
71

  
72
   a) Give prominent notice with each copy of the object code that the
73
   Library is used in it and that the Library and its use are
74
   covered by this License.
75

  
76
   b) Accompany the object code with a copy of the GNU GPL and this license
77
   document.
78

  
79
  4. Combined Works.
80

  
81
  You may convey a Combined Work under terms of your choice that,
82
taken together, effectively do not restrict modification of the
83
portions of the Library contained in the Combined Work and reverse
84
engineering for debugging such modifications, if you also do each of
85
the following:
86

  
87
   a) Give prominent notice with each copy of the Combined Work that
88
   the Library is used in it and that the Library and its use are
89
   covered by this License.
90

  
91
   b) Accompany the Combined Work with a copy of the GNU GPL and this license
92
   document.
93

  
94
   c) For a Combined Work that displays copyright notices during
95
   execution, include the copyright notice for the Library among
96
   these notices, as well as a reference directing the user to the
97
   copies of the GNU GPL and this license document.
98

  
99
   d) Do one of the following:
100

  
101
       0) Convey the Minimal Corresponding Source under the terms of this
102
       License, and the Corresponding Application Code in a form
103
       suitable for, and under terms that permit, the user to
104
       recombine or relink the Application with a modified version of
105
       the Linked Version to produce a modified Combined Work, in the
106
       manner specified by section 6 of the GNU GPL for conveying
107
       Corresponding Source.
108

  
109
       1) Use a suitable shared library mechanism for linking with the
110
       Library.  A suitable mechanism is one that (a) uses at run time
111
       a copy of the Library already present on the user's computer
112
       system, and (b) will operate properly with a modified version
113
       of the Library that is interface-compatible with the Linked
114
       Version.
115

  
116
   e) Provide Installation Information, but only if you would otherwise
117
   be required to provide such information under section 6 of the
118
   GNU GPL, and only to the extent that such information is
119
   necessary to install and execute a modified version of the
120
   Combined Work produced by recombining or relinking the
121
   Application with a modified version of the Linked Version. (If
122
   you use option 4d0, the Installation Information must accompany
123
   the Minimal Corresponding Source and Corresponding Application
124
   Code. If you use option 4d1, you must provide the Installation
125
   Information in the manner specified by section 6 of the GNU GPL
126
   for conveying Corresponding Source.)
127

  
128
  5. Combined Libraries.
129

  
130
  You may place library facilities that are a work based on the
131
Library side by side in a single library together with other library
132
facilities that are not Applications and are not covered by this
133
License, and convey such a combined library under terms of your
134
choice, if you do both of the following:
135

  
136
   a) Accompany the combined library with a copy of the same work based
137
   on the Library, uncombined with any other library facilities,
138
   conveyed under the terms of this License.
139

  
140
   b) Give prominent notice with the combined library that part of it
141
   is a work based on the Library, and explaining where to find the
142
   accompanying uncombined form of the same work.
143

  
144
  6. Revised Versions of the GNU Lesser General Public License.
145

  
146
  The Free Software Foundation may publish revised and/or new versions
147
of the GNU Lesser General Public License from time to time. Such new
148
versions will be similar in spirit to the present version, but may
149
differ in detail to address new problems or concerns.
150

  
151
  Each version is given a distinguishing version number. If the
152
Library as you received it specifies that a certain numbered version
153
of the GNU Lesser General Public License "or any later version"
154
applies to it, you have the option of following the terms and
155
conditions either of that published version or of any later version
156
published by the Free Software Foundation. If the Library as you
157
received it does not specify a version number of the GNU Lesser
158
General Public License, you may choose any version of the GNU Lesser
159
General Public License ever published by the Free Software Foundation.
160

  
161
  If the Library as you received it specifies that a proxy can decide
162
whether future versions of the GNU Lesser General Public License shall
163
apply, that proxy's public statement of acceptance of any version is
164
permanent authorization for you to choose that version for the
165
Library.
README.md
1 1
# [hu]man [motion] low-level robot ontrol library
2 2

  
3
this is the low level robot control software to allow
4
human like motion generation on a humanoid robotic head
5

  
3
this has been moved to github. see
4
https://github.com/CentralLabFacilities/humotion
cfg/humotion.cfg
1
#!/usr/bin/env python
2
import re
3
PACKAGE = "humotion"
4
from dynamic_reconfigure.parameter_generator_catkin import *
5

  
6
def fetch_default(param_name):
7
    for line in open("../src/server/config.cpp"):
8
        if param_name in line:
9
            result = re.findall("=\s*([\d\w.]+);", line)
10
            print result
11
            if result:
12
                return result[0]
13
            else:
14
                print("ERROR: could not find parameter %s in config.cpp" % (param_name))
15
                sys.exit(1)
16

  
17
def add_entry(group, param_name, descr, min, max):
18
    default_str = fetch_default(param_name)
19
    default_val = float(default_str)
20
    if (default_val > max):
21
        print("ERROR: default value %f for %s exceeds max value (%f)" % (default_val, param_name, max))
22
        sys.exit(1)
23
    if (default_val < min):
24
        print("ERROR: default value %f for %s is under min value (%f)" % (default_val, param_name, min))
25
        sys.exit(1)
26

  
27
    group.add(param_name, double_t, 0, descr, default_val, min, max)
28

  
29
def add_entry_bool(group, param_name, descr):
30
    default = fetch_default(param_name)
31

  
32
    default_val = True
33
    if (default == "false"):
34
        default_val = False
35

  
36
    group.add(param_name, bool_t, 0, descr, default_val)
37

  
38

  
39
gen = ParameterGenerator()
40

  
41
debug_group = gen.add_group("debug")
42
add_entry_bool(debug_group, "publish_internals", "publish debugging data on different topics")
43

  
44
general_group = gen.add_group("thresholds")
45
add_entry(general_group, "threshold_velocity_eye_saccade", "velocity threshold for eye saccade detection (in deg/s)", 1.0, 30.0)
46
add_entry(general_group, "threshold_angle_neck_saccade", "magnitude of gaze change that triggers neck saccade (in deg)", 1.0, 30.0)
47
add_entry(general_group, "threshold_angle_omr_limit", "threshold for a deflection that triggers a correction neck saccade (in percent of OMR)", 0.1, 1.0)
48

  
49
neck_group = gen.add_group("neck")
50
add_entry(neck_group, "scale_velocity_neck", "scaling factor for neck velocity (in percent, 1.0 = full human velocities)", 0.1, 1.0)
51
add_entry(neck_group, "scale_acceleration_neck", "scaling factor for neck acceleration (in percent, 1.0 = full human acceleration)", 0.1, 1.0)
52
add_entry(neck_group, "limit_velocity_neck", "limit for neck velocity (in deg/s)", 100.0, 800.0)
53
add_entry(neck_group, "limit_acceleration_neck", "limit for neck acceleration (in deg/s^2)", 100.0, 10000.0)
54

  
55
eye_group = gen.add_group("eye")
56
add_entry(eye_group, "scale_velocity_eye", "scaling factor for eye velocity (in percent, 1.0 = full human velocities)",  0.1, 1.0)
57
add_entry(eye_group, "scale_acceleration_eye", "scaling factor for eye acceleration (in percent, 1.0 = full human acceleration)", 0.1, 1.0)
58
add_entry(eye_group, "limit_velocity_eye", "limit for eye velocity (in deg/s)", 100.0, 1000.0)
59
add_entry(eye_group, "limit_acceleration_eye", "limit for eye acceleration (in deg/s^2)", 100.0, 80000.0)
60
add_entry_bool(eye_group, "use_neck_target_instead_of_position_eye", "use neck target in difference calc instead of real position")
61

  
62<