-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathcall_register_cap.py
More file actions
50 lines (37 loc) · 1.12 KB
/
call_register_cap.py
File metadata and controls
50 lines (37 loc) · 1.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
''' test call cap services '''
import rclpy
from capabilities2_msgs.srv import RegisterCapability
def test_register_cap(n):
# try establish bond
# add service client
client = n.create_client(
RegisterCapability,
'/capabilities/register_capability'
)
# wait for service
client.wait_for_service()
# send request
request: RegisterCapability.Request = RegisterCapability.Request()
# fill request
request.capability_spec.package = 'std_capabilities'
request.capability_spec.type = 'capability_provider'
request.capability_spec.content = """
name: test_cap_server_provider
spec_type: provider
spec_version: 1.1
description: capability server test provider
implements: std_capabilities/empty
runner: capabilities2_runner::DummyRunner
"""
future = client.call_async(request)
rclpy.spin_until_future_complete(n, future)
# print result
print(future.result())
# main
if __name__ == '__main__':
rclpy.init()
node = rclpy.create_node('test_call_cap_srvs')
# do tests
test_register_cap(node)
rclpy.shutdown()
exit(0)