Revision 8c6c1163

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

  
7
set(ROS_BUILD_TYPE Debug)
8

  
9

  
10
#######################################
11
# check if we have RSB support:
12
FIND_PACKAGE(RSB 0.11)
13
IF (RSB_FOUND)
14
    #RSB
15
    SET(CMAKE_INSTALL_RPATH "\$ORIGIN/../lib:\$ORIGIN/")
16
    FIND_PACKAGE(RSC 0.11 REQUIRED)
17
    FIND_PACKAGE(RSB 0.11 REQUIRED)
18
    #RST
19
    FIND_PACKAGE(RST REQUIRED COMPONENTS sandbox)
20
    INCLUDE_DIRECTORIES(BEFORE SYSTEM ${RST_INCLUDE_DIRS})
21
    ADD_DEFINITIONS(${RST_CFLAGS} ${RSTSANDBOX_CFLAGS})
22

  
23
    INCLUDE_DIRECTORIES(BEFORE SYSTEM ${RSB_INCLUDE_DIRS})
24
    LIST(INSERT CMAKE_MODULE_PATH 0 ${RSC_CMAKE_MODULE_PATH})
25
    #RSB
26
    SET(CMAKE_INSTALL_RPATH "\$ORIGIN/../lib:\$ORIGIN/")
27
    FIND_PACKAGE(RSC 0.11 REQUIRED)
28
    FIND_PACKAGE(RSB 0.11 REQUIRED)
29
    #RST
30
    FIND_PACKAGE(RST REQUIRED COMPONENTS sandbox)
31
    INCLUDE_DIRECTORIES(BEFORE SYSTEM ${RST_INCLUDE_DIRS})
32
    ADD_DEFINITIONS(${RST_CFLAGS} ${RSTSANDBOX_CFLAGS})
33

  
34
    INCLUDE_DIRECTORIES(BEFORE SYSTEM ${RSB_INCLUDE_DIRS})
35
    LIST(INSERT CMAKE_MODULE_PATH 0 ${RSC_CMAKE_MODULE_PATH})
36

  
37
    message(STATUS "RSB Support is ON")
38
    add_definitions(-DRSB_SUPPORT=1)
39
ENDIF (RSB_FOUND)
40

  
41
################################################################
42
# check for ROS support:
43
find_package(catkin)
44
IF (catkin_FOUND)
45
    SET(ROS_FOUND 1)
46

  
47
    find_package(catkin REQUIRED COMPONENTS roscpp std_msgs sensor_msgs message_generation genmsg)
48

  
49
    message(STATUS "ROS Support is ON")
50
    add_definitions(-DROS_SUPPORT=1)
51
ENDIF (catkin_FOUND)
52

  
53

  
54
INCLUDE(FindPkgConfig)
55

  
56
##libreflexxes
57
IF (libreflexxes_DIR)
58
  MESSAGE("using libreflexxes_DIR as override ('${libreflexxes_DIR}')")
59
  SET(REFLEXXES_PREFIX ${libreflexxes_DIR})
60
ELSE ()
61
  PKG_CHECK_MODULES(REFLEXXES REQUIRED libReflexxesTypeII>=1.2.3)
62
  IF (NOT REFLEXXES_FOUND)
63
    message(FATAL_ERROR "Error: could not find lib libReflexxesTypeII")
64
  ENDIF ()
65
ENDIF()
66

  
67
IF (NOT catkin_FOUND)
68
    IF (NOT RSB_FOUND)
69
        message(FATAL_ERROR "Error: could neither find RSB or ROS middleware!")
70
    ENDIF (NOT RSB_FOUND)
71
ENDIF (NOT catkin_FOUND)
72

  
73

  
74
SET(REFLEXXES_LIBRARY_DIRS "${REFLEXXES_PREFIX}/lib")
75
SET(REFLEXXES_INCLUDE_DIRS "${REFLEXXES_PREFIX}/include")
76
MESSAGE("using libReflexxesTypeII version ${REFLEXXES_VERSION} from ${REFLEXXES_INCLUDE_DIRS} and ${REFLEXXES_LIBRARY_DIRS}")
77

  
78
set(CMAKE_CXX_FLAGS "-g -Wall")
79
add_definitions ("-Wall")
80

  
81

  
82
IF (catkin_FOUND)
83
    #######################################
84
    ## Declare ROS messages and services ##
85
    #######################################
86

  
87
    add_message_files(
88
            FILES
89
            gaze.msg
90
            position_lcr.msg
91
            mouth.msg
92
    )
93

  
94
    ## Generate added messages and services with any dependencies listed here
95
    generate_messages(
96
            DEPENDENCIES
97
            std_msgs
98
            humotion
99
    )
100

  
101

  
102
    #
103
    ###################################
104
    ## catkin specific configuration ##
105
    ###################################
106
    ## The catkin_package macro generates cmake config files for your package
107
    ## Declare things to be passed to dependent projects
108
    ## INCLUDE_DIRS: uncomment this if you package contains header files
109
    ## LIBRARIES: libraries you create in this project that dependent projects also need
110
    ## CATKIN_DEPENDS: catkin_packages dependent projects also need
111
    ## DEPENDS: system dependencies of this project that dependent projects also need
112
    catkin_package(
113
        INCLUDE_DIRS include
114
        LIBRARIES humotion
115
        #CATKIN_DEPENDS message_runtime
116
        #DEPENDS system_lib
117
    )
118
ENDIF (catkin_FOUND)
119

  
120
###########
121
## Build ##
122
###########
123

  
124
## Specify additional locations of header files
125
## Your package locations should be listed before other locations
126
include_directories (BEFORE ${Boost_INCLUDE_DIRS} ${REFLEXXES_INCLUDE_DIRS})
127
include_directories(include)
128
include_directories( ${catkin_INCLUDE_DIRS})
129
link_directories (${Boost_LIBRARY_DIRS} ${REFLEXXES_LIBRARY_DIRS} ${catkin_LIBRARY_DIRS})
130

  
131
file(GLOB DUMMY_HEADER_LIST RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} include/*.h  include/client/*.h  include/server/*.h srv/*.srv msg/*.msg etc/*)
132

  
133
## Declare a cpp library
134
add_library(humotion
135
    src/mouth_state.cpp
136
    src/gaze_state.cpp
137

  
138
    src/client/client.cpp
139
    src/client/middleware.cpp
140
    src/client/middleware_ros.cpp
141
    src/client/middleware_rsb.cpp
142

  
143
    src/server/server.cpp
144
    src/server/middleware.cpp
145
    src/server/middleware_ros.cpp
146
    src/server/middleware_rsb.cpp
147

  
148
    src/server/controller.cpp
149
    src/server/joint_interface.cpp
150
    src/server/motion_generator.cpp
151
    src/server/gaze_motion_generator.cpp
152
    src/server/reflexxes_motion_generator.cpp
153
    src/server/mouth_motion_generator.cpp
154
    src/server/eye_motion_generator.cpp
155
    src/server/eyelid_motion_generator.cpp
156
    src/server/eyebrow_motion_generator.cpp
157
    src/server/neck_motion_generator.cpp
158

  
159
    src/timestamped_list.cpp
160

  
161
    ${DUMMY_HEADER_LIST}
162
)
163

  
164
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x")
165

  
166

  
167
## Add cmake target dependencies of the executable/library
168
## as an example, message headers may need to be generated before nodes
169
add_dependencies(humotion ${catkin_EXPORTED_TARGETS} humotion_gencpp)
170

  
171
## Specify libraries to link a library or executable target against
172
target_link_libraries(humotion
173
			${Boost_LIBRARIES} 
174
			${catkin_LIBRARIES}
175
                        ${REFLEXXES_LIBRARIES}
176
                        ${RST_LIBRARIES}
177
                        ${RSB_LIBRARIES}
178
)
179

  
180
set_property(TARGET humotion PROPERTY INSTALL_RPATH_USE_LINK_PATH TRUE)
181

  
182
#############
183
## Install ##
184
#############
185

  
186
# all install targets should use catkin DESTINATION variables
187
# See http://ros.org/doc/api/catkin/html/adv_user_guide/variables.html
188

  
189
## Mark executable scripts (Python etc.) for installation
190
## in contrast to setup.py, you can choose the destination
191
# install(PROGRAMS
192
#   scripts/my_python_script
193
#   DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
194
# )
195

  
196
## Mark executables and/or libraries for installation
197
IF (catkin_FOUND)
198
    install(TARGETS humotion
199
        ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
200
        LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
201
        RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
202
    )
203
    ## Mark cpp header files for installation
204
    install(DIRECTORY include/
205
        DESTINATION ${CATKIN_PACKAGE_INCLUDE_DESTINATION}
206
        PATTERN ".svn" EXCLUDE
207
    )
208
ENDIF (catkin_FOUND)
209

  
210

  
211
#############
212
## Testing ##
213
#############
214
IF (catkin_FOUND)
215
    ## Add gtest based cpp test target and link libraries
216
    catkin_add_gtest(${PROJECT_NAME}-test-server test/server.cpp)
217
    if(TARGET ${PROJECT_NAME}-test-server)
218
    target_link_libraries(${PROJECT_NAME}-test-server ${PROJECT_NAME})
219
    endif()
220
    catkin_add_gtest(${PROJECT_NAME}-test-client test/client.cpp)
221
    if(TARGET ${PROJECT_NAME}-test-client)
222
    target_link_libraries(${PROJECT_NAME}-test-client ${PROJECT_NAME})
223
    endif()
224
ENDIF (catkin_FOUND)
225

  
226

  
227
### Add folders to be run by python nosetests
228
# catkin_add_nosetests(test)
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
# [hu]man [motion] low-level robot ontrol library
2

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

  
examples/yarp_icub/CMakeLists.txt
1
PROJECT(icub_humotion)
2
cmake_minimum_required(VERSION 2.8)
3

  
4
FIND_PACKAGE(YARP)
5
FIND_PACKAGE(ICUB)
6
FIND_PACKAGE(Boost REQUIRED COMPONENTS system thread)
7
FIND_PACKAGE(humotion)
8

  
9
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x")
10

  
11
# add include directories
12
INCLUDE_DIRECTORIES(${YARP_INCLUDE_DIRS} ${ICUB_INCLUDE_DIRS} ${humotion_INCLUDE_DIRS} ${Boost_INCLUDE_DIRS} include/)
13
link_directories(${Boost_LIBRARY_DIRS} ${humotion_LIBRARY_DIRS})
14

  
15
# add required linker flags
16
SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${ICUB_LINK_FLAGS}")
17
SET(MAIN icub_humotion_server)
18

  
19
file(GLOB DUMMY_HEADER_LIST RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} include/*.h)
20

  
21
ADD_EXECUTABLE(${MAIN} src/main.cpp src/icub_jointinterface.cpp src/icub_data_receiver.cpp ${DUMMY_HEADER_LIST})
22

  
23
# we now add the YARP and iCub libraries to our project.
24
TARGET_LINK_LIBRARIES(${MAIN} ${Boost_LIBRARIES} ${YARP_LIBRARIES} ${ICUB_LIBRARIES} ${humotion_LIBRARIES})
25
set_property(TARGET ${MAIN} PROPERTY INSTALL_RPATH_USE_LINK_PATH TRUE)
26

  
27

  
28
INSTALL(TARGETS ${MAIN} DESTINATION bin)
29

  
examples/yarp_icub/CMakeLists.txt.user
1
<?xml version="1.0" encoding="UTF-8"?>
2
<!DOCTYPE QtCreatorProject>
3
<!-- Written by QtCreator 3.0.1, 2015-03-12T13:07:35. -->
4
<qtcreator>
5
 <data>
6
  <variable>ProjectExplorer.Project.ActiveTarget</variable>
7
  <value type="int">0</value>
8
 </data>
9
 <data>
10
  <variable>ProjectExplorer.Project.EditorSettings</variable>
11
  <valuemap type="QVariantMap">
12
   <value type="bool" key="EditorConfiguration.AutoIndent">true</value>
13
   <value type="bool" key="EditorConfiguration.AutoSpacesForTabs">false</value>
14
   <value type="bool" key="EditorConfiguration.CamelCaseNavigation">true</value>
15
   <valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.0">
16
    <value type="QString" key="language">Cpp</value>
17
    <valuemap type="QVariantMap" key="value">
18
     <value type="QByteArray" key="CurrentPreferences">CppGlobal</value>
19
    </valuemap>
20
   </valuemap>
21
   <valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.1">
22
    <value type="QString" key="language">QmlJS</value>
23
    <valuemap type="QVariantMap" key="value">
24
     <value type="QByteArray" key="CurrentPreferences">QmlJSGlobal</value>
25
    </valuemap>