Revision 064198fb
CMakeLists.txt | ||
---|---|---|
119 | 119 |
## Specify additional locations of header files |
120 | 120 |
## Your package locations should be listed before other locations |
121 | 121 |
include_directories (BEFORE ${Boost_INCLUDE_DIRS} ${REFLEXXES_INCLUDE_DIRS}) |
122 |
include_directories(include) |
|
122 |
include_directories(include/humotion)
|
|
123 | 123 |
include_directories( ${catkin_INCLUDE_DIRS}) |
124 | 124 |
link_directories (${Boost_LIBRARY_DIRS} ${REFLEXXES_LIBRARY_DIRS} ${catkin_LIBRARY_DIRS}) |
125 | 125 |
|
include/client/client.h | ||
---|---|---|
1 |
/* |
|
2 |
* This file is part of humotion |
|
3 |
* |
|
4 |
* Copyright(c) sschulz <AT> techfak.uni-bielefeld.de |
|
5 |
* http://opensource.cit-ec.de/projects/humotion |
|
6 |
* |
|
7 |
* This file may be licensed under the terms of the |
|
8 |
* GNU Lesser General Public License Version 3 (the ``LGPL''), |
|
9 |
* or (at your option) any later version. |
|
10 |
* |
|
11 |
* Software distributed under the License is distributed |
|
12 |
* on an ``AS IS'' basis, WITHOUT WARRANTY OF ANY KIND, either |
|
13 |
* express or implied. See the LGPL for the specific language |
|
14 |
* governing rights and limitations. |
|
15 |
* |
|
16 |
* You should have received a copy of the LGPL along with this |
|
17 |
* program. If not, go to http://www.gnu.org/licenses/lgpl.html |
|
18 |
* or write to the Free Software Foundation, Inc., |
|
19 |
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
|
20 |
* |
|
21 |
* The development of this software was supported by the |
|
22 |
* Excellence Cluster EXC 277 Cognitive Interaction Technology. |
|
23 |
* The Excellence Cluster EXC 277 is a grant of the Deutsche |
|
24 |
* Forschungsgemeinschaft (DFG) in the context of the German |
|
25 |
* Excellence Initiative. |
|
26 |
*/ |
|
27 |
|
|
28 |
#pragma once |
|
29 |
#include "middleware.h" |
|
30 |
#include <cstdio> |
|
31 |
#include <cstdint> |
|
32 |
#include <string> |
|
33 |
|
|
34 |
namespace humotion{ |
|
35 |
namespace client{ |
|
36 |
|
|
37 |
class Client{ |
|
38 |
public: |
|
39 |
Client(std::string name, std::string mw); |
|
40 |
~Client(); |
|
41 |
|
|
42 |
bool ok(); |
|
43 |
void tick(); |
|
44 |
|
|
45 |
void update_mouth_target(MouthState s, bool send=false); |
|
46 |
void update_gaze_target(GazeState s, bool send=false); |
|
47 |
|
|
48 |
void send_all(); |
|
49 |
|
|
50 |
|
|
51 |
private: |
|
52 |
Middleware *middleware; |
|
53 |
}; |
|
54 |
|
|
55 |
} |
|
56 |
} |
include/client/middleware.h | ||
---|---|---|
1 |
/* |
|
2 |
* This file is part of humotion |
|
3 |
* |
|
4 |
* Copyright(c) sschulz <AT> techfak.uni-bielefeld.de |
|
5 |
* http://opensource.cit-ec.de/projects/humotion |
|
6 |
* |
|
7 |
* This file may be licensed under the terms of the |
|
8 |
* GNU Lesser General Public License Version 3 (the ``LGPL''), |
|
9 |
* or (at your option) any later version. |
|
10 |
* |
|
11 |
* Software distributed under the License is distributed |
|
12 |
* on an ``AS IS'' basis, WITHOUT WARRANTY OF ANY KIND, either |
|
13 |
* express or implied. See the LGPL for the specific language |
|
14 |
* governing rights and limitations. |
|
15 |
* |
|
16 |
* You should have received a copy of the LGPL along with this |
|
17 |
* program. If not, go to http://www.gnu.org/licenses/lgpl.html |
|
18 |
* or write to the Free Software Foundation, Inc., |
|
19 |
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
|
20 |
* |
|
21 |
* The development of this software was supported by the |
|
22 |
* Excellence Cluster EXC 277 Cognitive Interaction Technology. |
|
23 |
* The Excellence Cluster EXC 277 is a grant of the Deutsche |
|
24 |
* Forschungsgemeinschaft (DFG) in the context of the German |
|
25 |
* Excellence Initiative. |
|
26 |
*/ |
|
27 |
|
|
28 |
#pragma once |
|
29 |
#include <cstdio> |
|
30 |
#include <cstdint> |
|
31 |
#include <string> |
|
32 |
#include "../mouth_state.h" |
|
33 |
#include "../gaze_state.h" |
|
34 |
|
|
35 |
namespace humotion{ |
|
36 |
namespace client{ |
|
37 |
|
|
38 |
|
|
39 |
class Middleware{ |
|
40 |
public: |
|
41 |
Middleware(std::string name); |
|
42 |
~Middleware(); |
|
43 |
|
|
44 |
void update_mouth_target(MouthState s, bool send); |
|
45 |
void update_gaze_target(GazeState s, bool send); |
|
46 |
void send_all(); |
|
47 |
|
|
48 |
virtual void send_mouth_target() = 0; |
|
49 |
virtual void send_gaze_target() = 0; |
|
50 |
virtual bool ok() = 0; |
|
51 |
virtual void tick() = 0; |
|
52 |
|
|
53 |
protected: |
|
54 |
MouthState mouth_state; |
|
55 |
GazeState gaze_state; |
|
56 |
std::string base_scope; |
|
57 |
}; |
|
58 |
|
|
59 |
} |
|
60 |
} |
include/client/middleware_ros.h | ||
---|---|---|
1 |
#pragma once |
|
2 |
#include "middleware.h" |
|
3 |
#ifdef ROS_SUPPORT |
|
4 |
#include "ros/ros.h" |
|
5 |
#endif |
|
6 |
#include <boost/shared_ptr.hpp> |
|
7 |
/* |
|
8 |
* This file is part of humotion |
|
9 |
* |
|
10 |
* Copyright(c) sschulz <AT> techfak.uni-bielefeld.de |
|
11 |
* http://opensource.cit-ec.de/projects/humotion |
|
12 |
* |
|
13 |
* This file may be licensed under the terms of the |
|
14 |
* GNU Lesser General Public License Version 3 (the ``LGPL''), |
|
15 |
* or (at your option) any later version. |
|
16 |
* |
|
17 |
* Software distributed under the License is distributed |
|
18 |
* on an ``AS IS'' basis, WITHOUT WARRANTY OF ANY KIND, either |
|
19 |
* express or implied. See the LGPL for the specific language |
|
20 |
* governing rights and limitations. |
|
21 |
* |
|
22 |
* You should have received a copy of the LGPL along with this |
|
23 |
* program. If not, go to http://www.gnu.org/licenses/lgpl.html |
|
24 |
* or write to the Free Software Foundation, Inc., |
|
25 |
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
|
26 |
* |
|
27 |
* The development of this software was supported by the |
|
28 |
* Excellence Cluster EXC 277 Cognitive Interaction Technology. |
|
29 |
* The Excellence Cluster EXC 277 is a grant of the Deutsche |
|
30 |
* Forschungsgemeinschaft (DFG) in the context of the German |
|
31 |
* Excellence Initiative. |
|
32 |
*/ |
|
33 |
|
|
34 |
namespace humotion{ |
|
35 |
namespace client{ |
|
36 |
|
|
37 |
class MiddlewareROS : public Middleware{ |
|
38 |
#ifndef ROS_SUPPORT |
|
39 |
public: |
|
40 |
MiddlewareROS(std::string name) : Middleware(name){ |
|
41 |
printf("> ERROR: humotion was compiled without ROS middleware support. Please use MiddlewareRSB() instead!\n\n"); |
|
42 |
exit(EXIT_FAILURE); |
|
43 |
} |
|
44 |
|
|
45 |
~MiddlewareROS(){} |
|
46 |
void send_mouth_target(){}; |
|
47 |
void send_gaze_target(){}; |
|
48 |
bool ok(){ return false; } |
|
49 |
void tick(){} |
|
50 |
|
|
51 |
#else |
|
52 |
public: |
|
53 |
MiddlewareROS(std::string name); |
|
54 |
~MiddlewareROS(); |
|
55 |
|
|
56 |
void send_mouth_target(); |
|
57 |
void send_gaze_target(); |
|
58 |
bool ok(); |
|
59 |
void tick(); |
|
60 |
|
|
61 |
|
|
62 |
private: |
|
63 |
bool tick_necessary; |
|
64 |
//boost::shared_ptr<ros::NodeHandle> node_handle; |
|
65 |
ros::Publisher mouth_target_publisher; |
|
66 |
ros::Publisher gaze_target_publisher; |
|
67 |
#endif |
|
68 |
}; |
|
69 |
|
|
70 |
} |
|
71 |
} |
include/client/middleware_rsb.h | ||
---|---|---|
1 |
/* |
|
2 |
* This file is part of humotion |
|
3 |
* |
|
4 |
* Copyright(c) sschulz <AT> techfak.uni-bielefeld.de |
|
5 |
* http://opensource.cit-ec.de/projects/humotion |
|
6 |
* |
|
7 |
* This file may be licensed under the terms of the |
|
8 |
* GNU Lesser General Public License Version 3 (the ``LGPL''), |
|
9 |
* or (at your option) any later version. |
|
10 |
* |
|
11 |
* Software distributed under the License is distributed |
|
12 |
* on an ``AS IS'' basis, WITHOUT WARRANTY OF ANY KIND, either |
|
13 |
* express or implied. See the LGPL for the specific language |
|
14 |
* governing rights and limitations. |
|
15 |
* |
|
16 |
* You should have received a copy of the LGPL along with this |
|
17 |
* program. If not, go to http://www.gnu.org/licenses/lgpl.html |
|
18 |
* or write to the Free Software Foundation, Inc., |
|
19 |
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
|
20 |
* |
|
21 |
* The development of this software was supported by the |
|
22 |
* Excellence Cluster EXC 277 Cognitive Interaction Technology. |
|
23 |
* The Excellence Cluster EXC 277 is a grant of the Deutsche |
|
24 |
* Forschungsgemeinschaft (DFG) in the context of the German |
|
25 |
* Excellence Initiative. |
|
26 |
*/ |
|
27 |
|
|
28 |
#pragma once |
|
29 |
#include "middleware.h" |
|
30 |
|
|
31 |
#ifdef RSB_SUPPORT |
|
32 |
#define BOOST_SIGNALS_NO_DEPRECATION_WARNING 1 |
|
33 |
#include <rsb/Informer.h> |
|
34 |
#include <rst/robot/HumotionGazeTarget.pb.h> |
|
35 |
#include <rst/robot/MouthTarget.pb.h> |
|
36 |
#endif |
|
37 |
|
|
38 |
|
|
39 |
namespace humotion{ |
|
40 |
namespace client{ |
|
41 |
|
|
42 |
class MiddlewareRSB : public Middleware{ |
|
43 |
|
|
44 |
#ifndef RSB_SUPPORT |
|
45 |
public: |
|
46 |
MiddlewareRSB(std::string name) : Middleware(name){ |
|
47 |
printf("> ERROR: humotion was compiled without RSB middleware support. Please use MiddlewareROS() instead!\n\n"); |
|
48 |
exit(EXIT_FAILURE); |
|
49 |
} |
|
50 |
|
|
51 |
~MiddlewareRSB(){} |
|
52 |
bool ok(){ return false; } |
|
53 |
void tick(){} |
|
54 |
void send_mouth_target(){}; |
|
55 |
void send_gaze_target(){}; |
|
56 |
|
|
57 |
#else |
|
58 |
public: |
|
59 |
MiddlewareRSB(std::string name); |
|
60 |
~MiddlewareRSB(); |
|
61 |
|
|
62 |
void send_mouth_target(); |
|
63 |
void send_gaze_target(); |
|
64 |
bool ok(); |
|
65 |
void tick(); |
|
66 |
|
|
67 |
|
|
68 |
private: |
|
69 |
rsb::Informer<rst::robot::MouthTarget>::Ptr mouth_target_informer; |
|
70 |
rsb::Informer<rst::robot::HumotionGazeTarget>::Ptr gaze_target_informer; |
|
71 |
#endif |
|
72 |
}; |
|
73 |
|
|
74 |
} |
|
75 |
} |
include/gaze_state.h | ||
---|---|---|
1 |
/* |
|
2 |
* This file is part of humotion |
|
3 |
* |
|
4 |
* Copyright(c) sschulz <AT> techfak.uni-bielefeld.de |
|
5 |
* http://opensource.cit-ec.de/projects/humotion |
|
6 |
* |
|
7 |
* This file may be licensed under the terms of the |
|
8 |
* GNU Lesser General Public License Version 3 (the ``LGPL''), |
|
9 |
* or (at your option) any later version. |
|
10 |
* |
|
11 |
* Software distributed under the License is distributed |
|
12 |
* on an ``AS IS'' basis, WITHOUT WARRANTY OF ANY KIND, either |
|
13 |
* express or implied. See the LGPL for the specific language |
|
14 |
* governing rights and limitations. |
|
15 |
* |
|
16 |
* You should have received a copy of the LGPL along with this |
|
17 |
* program. If not, go to http://www.gnu.org/licenses/lgpl.html |
|
18 |
* or write to the Free Software Foundation, Inc., |
|
19 |
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
|
20 |
* |
|
21 |
* The development of this software was supported by the |
|
22 |
* Excellence Cluster EXC 277 Cognitive Interaction Technology. |
|
23 |
* The Excellence Cluster EXC 277 is a grant of the Deutsche |
|
24 |
* Forschungsgemeinschaft (DFG) in the context of the German |
|
25 |
* Excellence Initiative. |
|
26 |
*/ |
|
27 |
|
|
28 |
#pragma once |
|
29 |
#include <math.h> |
|
30 |
|
|
31 |
namespace humotion{ |
|
32 |
class GazeState{ |
|
33 |
public: |
|
34 |
GazeState(); |
|
35 |
~GazeState(); |
|
36 |
|
|
37 |
void dump(); |
|
38 |
|
|
39 |
//pan tilt roll |
|
40 |
float pan; |
|
41 |
float tilt; |
|
42 |
float roll; |
|
43 |
|
|
44 |
float pan_offset; |
|
45 |
float tilt_offset; |
|
46 |
float roll_offset; |
|
47 |
|
|
48 |
//pan,tilt,roll can be relative or absolute |
|
49 |
int type; |
|
50 |
|
|
51 |
//when was this target requested? |
|
52 |
double timestamp; |
|
53 |
|
|
54 |
//is this relative or |
|
55 |
enum GAZE_STATE_TYPE{ |
|
56 |
ABSOLUTE=0, |
|
57 |
RELATIVE=1, |
|
58 |
OVERRIDE=2 |
|
59 |
}; |
|
60 |
|
|
61 |
// |
|
62 |
float vergence; |
|
63 |
|
|
64 |
//eyelid opening angle |
|
65 |
float eyelid_opening_upper; |
|
66 |
float eyelid_opening_lower; |
|
67 |
|
|
68 |
//eyebrow angles |
|
69 |
float eyebrow_left; |
|
70 |
float eyebrow_right; |
|
71 |
|
|
72 |
//eyeblink request |
|
73 |
int eyeblink_request_left; |
|
74 |
int eyeblink_request_right; |
|
75 |
static const int EYEBLINK_TIME_DEFAULT = 150; //ms |
|
76 |
|
|
77 |
float distance_pt_abs(GazeState b){ |
|
78 |
float dist_pan = (b.pan + b.pan_offset) - (pan + pan_offset); |
|
79 |
float dist_tilt = (b.tilt + b.tilt_offset) - (tilt + tilt_offset); |
|
80 |
return sqrt(pow(dist_pan, 2.0) + pow(dist_tilt, 2.0)); |
|
81 |
} |
|
82 |
|
|
83 |
float distance_tilt_abs(GazeState b){ |
|
84 |
float dist_tilt = (b.tilt + b.tilt_offset) - (tilt + tilt_offset); |
|
85 |
return fabs(dist_tilt); |
|
86 |
} |
|
87 |
|
|
88 |
float distance_pan_abs(GazeState b){ |
|
89 |
float dist_pan = (b.pan + b.pan_offset) - (pan + pan_offset); |
|
90 |
return fabs(dist_pan); |
|
91 |
} |
|
92 |
}; |
|
93 |
|
|
94 |
} |
include/humotion/client/client.h | ||
---|---|---|
1 |
/* |
|
2 |
* This file is part of humotion |
|
3 |
* |
|
4 |
* Copyright(c) sschulz <AT> techfak.uni-bielefeld.de |
|
5 |
* http://opensource.cit-ec.de/projects/humotion |
|
6 |
* |
|
7 |
* This file may be licensed under the terms of the |
|
8 |
* GNU Lesser General Public License Version 3 (the ``LGPL''), |
|
9 |
* or (at your option) any later version. |
|
10 |
* |
|
11 |
* Software distributed under the License is distributed |
|
12 |
* on an ``AS IS'' basis, WITHOUT WARRANTY OF ANY KIND, either |
|
13 |
* express or implied. See the LGPL for the specific language |
|
14 |
* governing rights and limitations. |
|
15 |
* |
|
16 |
* You should have received a copy of the LGPL along with this |
|
17 |
* program. If not, go to http://www.gnu.org/licenses/lgpl.html |
|
18 |
* or write to the Free Software Foundation, Inc., |
|
19 |
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
|
20 |
* |
|
21 |
* The development of this software was supported by the |
|
22 |
* Excellence Cluster EXC 277 Cognitive Interaction Technology. |
|
23 |
* The Excellence Cluster EXC 277 is a grant of the Deutsche |
|
24 |
* Forschungsgemeinschaft (DFG) in the context of the German |
|
25 |
* Excellence Initiative. |
|
26 |
*/ |
|
27 |
|
|
28 |
#pragma once |
|
29 |
#include "middleware.h" |
|
30 |
#include <cstdio> |
|
31 |
#include <cstdint> |
|
32 |
#include <string> |
|
33 |
|
|
34 |
namespace humotion{ |
|
35 |
namespace client{ |
|
36 |
|
|
37 |
class Client{ |
|
38 |
public: |
|
39 |
Client(std::string name, std::string mw); |
|
40 |
~Client(); |
|
41 |
|
|
42 |
bool ok(); |
|
43 |
void tick(); |
|
44 |
|
|
45 |
void update_mouth_target(MouthState s, bool send=false); |
|
46 |
void update_gaze_target(GazeState s, bool send=false); |
|
47 |
|
|
48 |
void send_all(); |
|
49 |
|
|
50 |
|
|
51 |
private: |
|
52 |
Middleware *middleware; |
|
53 |
}; |
|
54 |
|
|
55 |
} |
|
56 |
} |
include/humotion/client/middleware.h | ||
---|---|---|
1 |
/* |
|
2 |
* This file is part of humotion |
|
3 |
* |
|
4 |
* Copyright(c) sschulz <AT> techfak.uni-bielefeld.de |
|
5 |
* http://opensource.cit-ec.de/projects/humotion |
|
6 |
* |
|
7 |
* This file may be licensed under the terms of the |
|
8 |
* GNU Lesser General Public License Version 3 (the ``LGPL''), |
|
9 |
* or (at your option) any later version. |
|
10 |
* |
|
11 |
* Software distributed under the License is distributed |
|
12 |
* on an ``AS IS'' basis, WITHOUT WARRANTY OF ANY KIND, either |
|
13 |
* express or implied. See the LGPL for the specific language |
|
14 |
* governing rights and limitations. |
|
15 |
* |
|
16 |
* You should have received a copy of the LGPL along with this |
|
17 |
* program. If not, go to http://www.gnu.org/licenses/lgpl.html |
|
18 |
* or write to the Free Software Foundation, Inc., |
|
19 |
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
|
20 |
* |
|
21 |
* The development of this software was supported by the |
|
22 |
* Excellence Cluster EXC 277 Cognitive Interaction Technology. |
|
23 |
* The Excellence Cluster EXC 277 is a grant of the Deutsche |
|
24 |
* Forschungsgemeinschaft (DFG) in the context of the German |
|
25 |
* Excellence Initiative. |
|
26 |
*/ |
|
27 |
|
|
28 |
#pragma once |
|
29 |
#include <cstdio> |
|
30 |
#include <cstdint> |
|
31 |
#include <string> |
|
32 |
#include "../mouth_state.h" |
|
33 |
#include "../gaze_state.h" |
|
34 |
|
|
35 |
namespace humotion{ |
|
36 |
namespace client{ |
|
37 |
|
|
38 |
|
|
39 |
class Middleware{ |
|
40 |
public: |
|
41 |
Middleware(std::string name); |
|
42 |
~Middleware(); |
|
43 |
|
|
44 |
void update_mouth_target(MouthState s, bool send); |
|
45 |
void update_gaze_target(GazeState s, bool send); |
|
46 |
void send_all(); |
|
47 |
|
|
48 |
virtual void send_mouth_target() = 0; |
|
49 |
virtual void send_gaze_target() = 0; |
|
50 |
virtual bool ok() = 0; |
|
51 |
virtual void tick() = 0; |
|
52 |
|
|
53 |
protected: |
|
54 |
MouthState mouth_state; |
|
55 |
GazeState gaze_state; |
|
56 |
std::string base_scope; |
|
57 |
}; |
|
58 |
|
|
59 |
} |
|
60 |
} |
include/humotion/client/middleware_ros.h | ||
---|---|---|