Main Page
Related Pages
Namespaces
Namespace List
Namespace Members
All
Variables
Classes
Class List
Class Hierarchy
Class Members
All
_
a
b
c
e
f
g
h
i
l
m
n
p
r
s
t
w
Functions
_
a
b
c
e
g
h
i
m
p
r
s
t
w
Variables
a
b
c
e
f
g
l
m
n
p
r
s
t
w
Files
File List
test
test_say.py
Go to the documentation of this file.
1
#!/usr/bin/env python
2
#
3
# Copyright 2017 Fraunhofer Institute for Manufacturing Engineering and Automation (IPA)
4
#
5
# Licensed under the Apache License, Version 2.0 (the "License");
6
# you may not use this file except in compliance with the License.
7
# You may obtain a copy of the License at
8
#
9
# http://www.apache.org/licenses/LICENSE-2.0
10
#
11
# Unless required by applicable law or agreed to in writing, software
12
# distributed under the License is distributed on an "AS IS" BASIS,
13
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
# See the License for the specific language governing permissions and
15
# limitations under the License.
16
17
18
import
sys
19
import
unittest
20
21
import
rospy
22
import
rostest
23
24
import
actionlib
25
from
cob_sound.msg
import
SayAction, SayResult
26
from
simple_script_server
import
*
27
sss =
simple_script_server
()
28
29
class
SayTest
(unittest.TestCase):
30
def
__init__
(self, *args):
31
super(SayTest, self).
__init__
(*args)
32
rospy.init_node(
'test_say_test'
)
33
self.
cb_executed
=
False
34
35
def
test_say
(self):
36
as_name =
"/sound/say"
37
self.
as_server
=
actionlib.SimpleActionServer
(as_name, SayAction, execute_cb=self.
say_cb
, auto_start=
False
)
38
self.
as_server
.start()
39
self.
cb_executed
=
False
40
handle = sss.say(
"sound"
, [
"hello"
])
41
if
not
self.
cb_executed
:
42
self.fail(
'Service Server not called. script server error_code: '
+ str(handle.get_error_code()))
43
44
def
say_cb
(self, goal):
45
self.
cb_executed
=
True
46
result = SayResult()
47
self.
as_server
.set_succeeded(result)
48
49
if
__name__ ==
'__main__'
:
50
try
:
51
rostest.run(
'rostest'
,
'test_say_test'
, SayTest, sys.argv)
52
except
KeyboardInterrupt
as
e:
53
pass
54
print(
"exiting"
)
55
test_say.SayTest.test_say
def test_say(self)
Definition:
test_say.py:35
test_say.SayTest
Definition:
test_say.py:29
test_say.SayTest.cb_executed
cb_executed
Definition:
test_say.py:33
test_say.SayTest.as_server
as_server
Definition:
test_say.py:37
test_say.SayTest.__init__
def __init__(self, *args)
Definition:
test_say.py:30
test_say.SayTest.say_cb
def say_cb(self, goal)
Definition:
test_say.py:44
simple_script_server.simple_script_server.simple_script_server
Simple script server class.
Definition:
simple_script_server.py:126
actionlib::SimpleActionServer
cob_script_server
Author(s): Florian Weisshardt
autogenerated on Fri Aug 2 2024 09:45:45