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 | ||
---|---|---|
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/humotion/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/humotion/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/mouth_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 <string> |
|
30 |
|
|
31 |
namespace humotion{ |
|
32 |
class MouthState{ |
|
33 |
public: |
|
34 |
MouthState(); |
|
35 |
~MouthState(); |
|
36 |
|
|
37 |
void dump(); |
|
38 |
|
|
39 |
float opening_left; |
|
40 |
float opening_center; |
|
41 |
float opening_right; |
|
42 |
|
|
43 |
float position_left; |
|
44 |
float position_center; |
|
45 |
float position_right; |
|
46 |
|
|
47 |
}; |
|
48 |
|
|
49 |
} |
include/humotion/server/controller.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 "../gaze_state.h" |
|
30 |
#include "../mouth_state.h" |
|
31 |
#include "motion_generator.h" |
|
32 |
#include "joint_interface.h" |
|
33 |
|
|
34 |
namespace humotion{ |
|
35 |
namespace server{ |
|
36 |
|
|
37 |
class Controller{ |
|
38 |
public: |
|
39 |
Controller(JointInterface *j); |
|
40 |
~Controller(); |
|
41 |
|
|
42 |
void init_motion_generators(); |
|
43 |
void calculate_targets(); |
|
44 |
void publish_targets(); |
|
45 |
|
|
46 |
|
|
47 |
void set_gaze_target(GazeState s); |
|
48 |
void set_mouth_target(MouthState s); |
|
49 |
|
|
50 |
private: |
|
51 |
void add_motion_generator(MotionGenerator *m); |
|
52 |
|
|
53 |
typedef std::vector<MotionGenerator *> motion_generator_vector_t; |
|
54 |
motion_generator_vector_t motion_generator_vector; |
|
55 |
JointInterface *joint_interface; |
|
56 |
|
|
57 |
|
|
58 |
}; |
|
59 |
|
|
60 |
} |
|
61 |
} |
include/humotion/server/eye_motion_generator.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 "gaze_motion_generator.h" |
|
30 |
#include "timestamped_list.h" |
|
31 |
|
|
32 |
namespace humotion{ |
|
33 |
namespace server{ |
|
34 |
|
|
35 |
class EyeMotionGenerator : public GazeMotionGenerator{ |
|
36 |
public: |
|
37 |
EyeMotionGenerator(JointInterface *j); |
|
38 |
~EyeMotionGenerator(); |
|
39 |
|
|
40 |
void calculate_targets(); |
|
41 |
void publish_targets(); |
|
42 |
|
|
43 |
|
|
44 |
static const float SACCADE_SPEED_THRESHOLD; |
|
45 |
private: |
|
46 |
void setup_eyemotion(int dof, float target, float now); |
|
47 |
|
|
48 |
TimestampedList tsl_gaze_target_pan; |
|
49 |
TimestampedList tsl_gaze_target_tilt; |
|
50 |
TimestampedList tsl_gaze_target_vergence; |
|
51 |
|
|
52 |
}; |
|
53 |
|
|
54 |
} |
|
55 |
} |
include/humotion/server/eyebrow_motion_generator.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 "motion_generator.h" |
|
30 |
|
|
31 |
namespace humotion{ |
|
32 |
namespace server{ |
|
33 |
|
|
34 |
class EyebrowMotionGenerator : public MotionGenerator{ |
|
35 |
public: |
|
36 |
EyebrowMotionGenerator(JointInterface *j); |
|
37 |
~EyebrowMotionGenerator(); |
|
38 |
void calculate_targets(); |
|
39 |
void publish_targets(); |
|
40 |
private: |
|
41 |
|
|
42 |
}; |
|
43 |
|
|
44 |
} |
|
45 |
} |
include/humotion/server/eyelid_motion_generator.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 "eye_motion_generator.h" |
|
30 |
#include "boost/date_time/posix_time/posix_time.hpp" |
|
31 |
#include <boost/thread/thread_time.hpp> |
|
32 |
|
|
33 |
namespace humotion{ |
|
34 |
namespace server{ |
|
35 |
|
|
36 |
class EyelidMotionGenerator : public EyeMotionGenerator{ |
|
37 |
public: |
|
38 |
EyelidMotionGenerator(JointInterface *j); |
|
39 |
~EyelidMotionGenerator(); |
|
40 |
|
|
41 |
void calculate_targets(); |
|
42 |
void publish_targets(); |
|
43 |
|
|
44 |
|
|
45 |
|
|
46 |
private: |
|
47 |
bool saccade_blink_active; |
|
48 |
bool saccade_blink_requested; |
|
49 |
|
|
50 |
enum SIDE_ID{ |
|
51 |
LEFT = 0, |
|
52 |
RIGHT, |
|
53 |
SIDE_ID_SIZE |
|
54 |
}; |
|
55 |
|
|
56 |
bool eyeblink_active[SIDE_ID_SIZE]; |
|
57 |
bool eyelid_closed[SIDE_ID_SIZE]; |
|
58 |
|
|
59 |
void start_external_eyeblinks(int duration_left, int duration_right); |
|
60 |
void process_saccadic_eyeblinks(); |
|
61 |
void process_periodic_eyeblinks(); |
|
62 |
void handle_eyeblink_timeout(); |
|
63 |
void override_lids_for_eyeblink(); |
|
64 |
void check_for_saccade(); |
|
65 |
void start_eyeblink(int side, int duration=EYEBLINK_DURATION_MS); |
|
66 |
|
|
67 |
void close_eyelid(int joint_id); |
|
68 |
|
|
69 |
static const float SACCADE_SPEED_THRESHOLD; |
|
70 |
static const float EYEBLINK_DURATION_MS; |
|
71 |
static const float EYEBLINK_EYERY_MS_MIN; |
|
72 |
static const float EYEBLINK_EYERY_MS_MAX; |
|
73 |
static const float EYEBLINK_BLOCKING_TIME; |
|
74 |
|
|
75 |
boost::system_time periodic_blink_start_time; |
|
76 |
boost::system_time eyeblink_timeout[SIDE_ID_SIZE]; |
|
77 |
boost::system_time eyeblink_blocked_timeout; |
|
78 |
|
|
79 |
}; |
|
80 |
|
|
81 |
} |
|
82 |
} |
include/humotion/server/gaze_motion_generator.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 "reflexxes_motion_generator.h" |
|
30 |
#include "timestamped_list.h" |
|
31 |
|
|
32 |
namespace humotion{ |
|
33 |
namespace server{ |
|
34 |
|
|
35 |
class GazeMotionGenerator : public ReflexxesMotionGenerator{ |
|
36 |
public: |
|
37 |
GazeMotionGenerator(JointInterface *j, int dof, float t); |
|
38 |
~GazeMotionGenerator(); |
|
39 |
|
|
40 |
void set_gaze_target(GazeState s); |
|
41 |
|
|
42 |
static const float SACCADE_SPEED_THRESHOLD; |
|
43 |
static const float SACCADE_LATENCY; |
|
44 |
|
|
45 |
protected: |
|
46 |
GazeState get_current_gaze(); |
|
47 |
|
|
48 |
bool get_eye_saccade_active(); |
|
49 |
bool neck_saccade_requested; |
|
50 |
bool neck_saccade_omr; |
|
51 |
|
|
52 |
private: |
|
53 |
|
|
54 |
//constants |
|
55 |
static const float NECK_SACCADE_THRESHOLD; |
|
56 |
static const float EYE_SACCADE_SPEED_THRESHOLD; |
|
57 |
static const float OMR_LIMIT_TRIGGERS_NECK_SACCADE; |
|
58 |
|
|
59 |
}; |
|
60 |
|
|
61 |
} |
|
62 |
} |
|
63 |
|
include/humotion/server/joint_interface.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 <map> |
|
33 |
#include "../timestamped_list.h" |
|
34 |
#include "../mouth_state.h" |
|
35 |
#include "../gaze_state.h" |
|
36 |
#include "boost/date_time/posix_time/posix_time.hpp" |
|
37 |
#include <boost/thread/thread_time.hpp> |
|
38 |
#include <boost/thread/thread.hpp> |
|
39 |
#include <boost/thread/mutex.hpp> |
|
40 |
|
|
41 |
namespace humotion{ |
|
42 |
namespace server{ |
|
43 |
|
|
44 |
//forward declaration to solve include loop |
|
45 |
class Controller; |
|
46 |
|
|
47 |
|
|
48 |
class JointInterface{ |
|
49 |
public: |
|
50 |
JointInterface(); |
|
51 |
~JointInterface(); |
|
52 |
|
|
53 |
void set_target_position(int joint_id, float position); |
|
54 |
float get_target_position(int joint_id); |
|
55 |
virtual void publish_target_position(int joint_id) = 0; |
|
56 |
virtual void execute_motion() = 0; |
|
57 |
|
|
58 |
typedef std::map<int, TimestampedList> joint_tsl_map_t; |
|
59 |
|
|
60 |
TimestampedList get_ts_position(int joint_id); |
|
61 |
TimestampedList get_ts_speed(int joint_id); |
|
62 |
|
|
63 |
void set_framerate(float f); |
|
64 |
|
|
65 |
void enable_mouth_joints(); |
|
66 |
void disable_mouth_joints(); |
|
67 |
bool mouth_target_input_active(); |
|
68 |
|
|
69 |
void enable_gaze_joints(); |
|
70 |
void disable_gaze_joints(); |
|
71 |
bool gaze_target_input_active(); |
|
72 |
|
|
73 |
float get_joint_min(int joint_id); |
|
74 |
float get_joint_max(int joint_id); |
|
75 |
|
|
76 |
void dump_angles(); |
|
77 |
|
|
78 |
unsigned int get_and_clear_incoming_position_count(); |
|
79 |
|
|
80 |
enum JOINT_ID_ENUM{ |
|
81 |
ZERO = 0, |
|
82 |
ID_LIP_LEFT_UPPER, |
|
83 |
ID_LIP_LEFT_LOWER, |
|
84 |
ID_LIP_CENTER_UPPER, |
|
85 |
ID_LIP_CENTER_LOWER, |
|
86 |
ID_LIP_RIGHT_UPPER, |
|
87 |
ID_LIP_RIGHT_LOWER, |
|
88 |
ID_NECK_PAN, |
|
89 |
ID_NECK_TILT, |
|
90 |
ID_NECK_ROLL, |
|
91 |
ID_EYES_LEFT_LR, |
|
92 |
ID_EYES_RIGHT_LR, |
|
93 |
ID_EYES_BOTH_UD, |
|
94 |
ID_EYES_LEFT_LID_LOWER, |
|
95 |
ID_EYES_LEFT_LID_UPPER, |
|
96 |
ID_EYES_RIGHT_LID_LOWER, |
|
97 |
ID_EYES_RIGHT_LID_UPPER, |
|
98 |
ID_EYES_LEFT_BROW, |
|
99 |
ID_EYES_RIGHT_BROW, |
|
100 |
JOINT_ID_ENUM_SIZE |
|
101 |
}; |
|
102 |
|
|
103 |
bool get_joint_position_map_empty(); |
|
104 |
|
|
105 |
protected: |
|
106 |
|
|
107 |
void store_incoming_position(int joint_id, float position, double timestamp); |
|
108 |
void store_incoming_speed(int joint_id, float speed, double timestamp); |
|
109 |
|
|
110 |
virtual void enable_joint(int id) = 0; |
|
111 |
virtual void disable_joint(int id) = 0; |
|
112 |
float framerate; |
|
113 |
|
|
114 |
float joint_min[JOINT_ID_ENUM_SIZE]; |
|
115 |
float joint_max[JOINT_ID_ENUM_SIZE]; |
|
116 |
float joint_target[JOINT_ID_ENUM_SIZE]; |
|
117 |
|
|
118 |
|
|
119 |
|
|
120 |
private: |
|
121 |
boost::mutex joint_ts_position_map_access_mutex; |
|
122 |
boost::mutex joint_ts_speed_map_access_mutex; |
|
123 |
joint_tsl_map_t joint_ts_position_map; |
|
124 |
joint_tsl_map_t joint_ts_speed_map; |
|
125 |
|
|
126 |
bool mouth_enabled; |
|
127 |
bool gaze_enabled; |
|
128 |
unsigned int incoming_position_count; |
|
129 |
|
|
130 |
}; |
|
131 |
|
|
132 |
} |
|
133 |
} |
include/humotion/server/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 |
#include "controller.h" |
|
35 |
|
|
36 |
namespace humotion{ |
|
37 |
namespace server{ |
|
38 |
|
|
39 |
class Middleware{ |
|
40 |
public: |
|
41 |
Middleware(std::string name, Controller *c); |
|
42 |
~Middleware(); |
|
43 |
|
|
44 |
virtual bool ok() = 0; |
|
45 |
virtual void tick() = 0; |
|
46 |
|
|
47 |
protected: |
|
48 |
Controller *controller; |
|
49 |
std::string base_scope; |
|
50 |
|
|
51 |
|
|
52 |
}; |
|
53 |
|
|
54 |
} |
|
55 |
} |
include/humotion/server/middleware_ros.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 "humotion/mouth.h" |
|
31 |
#include "humotion/gaze.h" |
|
32 |
|
|
33 |
#ifdef ROS_SUPPORT |
|
34 |
#include "ros/ros.h" |
|
35 |
#endif |
|
36 |
|
|
37 |
#include <boost/shared_ptr.hpp> |
|
38 |
|
|
39 |
namespace humotion{ |
|
40 |
namespace server{ |
|
41 |
|
|
42 |
class MiddlewareROS : public Middleware{ |
|
43 |
#ifndef ROS_SUPPORT |
|
44 |
public: |
|
45 |
MiddlewareROS(std::string name, Controller *c) : Middleware(name, c){ |
|
46 |
printf("> ERROR: humotion was compiled without ROS middleware support. Please use MiddlewareRSB() instead!\n\n"); |
|
47 |
exit(EXIT_FAILURE); |
|
48 |
} |
|
49 |
|
|
50 |
~MiddlewareROS(){} |
|
51 |
bool ok(){ return false; } |
|
52 |
void tick(){} |
|
53 |
|
|
54 |
#else |
|
55 |
public: |
|
56 |
MiddlewareROS(std::string name, Controller *c); |
|
57 |
~MiddlewareROS(); |
|
58 |
bool ok(); |
|
59 |
void tick(); |
|
60 |
|
|
61 |
private: |
|
62 |
double convert_ros_to_timestamp_ms(ros::Time t); |
|
63 |
bool tick_necessary; |
|
64 |
void incoming_mouth_target(const humotion::mouth::ConstPtr& msg); |
|
65 |
void incoming_gaze_target(const humotion::gaze::ConstPtr& msg); |
|
66 |
|
|
67 |
ros::Subscriber mouth_target_subscriber; |
|
68 |
ros::Subscriber gaze_target_subscriber; |
|
69 |
#endif |
|
70 |
}; |
|
71 |
|
|
72 |
} |
|
73 |
} |
|
74 |
|
include/humotion/server/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 |
#include "humotion/mouth.h" |
|
31 |
#include "humotion/gaze.h" |
Also available in: Unified diff