-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathcall_establish_bond.py
More file actions
47 lines (32 loc) · 921 Bytes
/
call_establish_bond.py
File metadata and controls
47 lines (32 loc) · 921 Bytes
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
''' test call cap services '''
from bondpy import bondpy
import rclpy
from capabilities2_msgs.srv import EstablishBond
def test_establish_bond(n):
# try establish bond
# add service client
client = n.create_client(
EstablishBond,
'/capabilities/establish_bond'
)
# wait for service
client.wait_for_service()
# send request
request = EstablishBond.Request()
future = client.call_async(request)
rclpy.spin_until_future_complete(n, future)
# print result
print(future.result())
# try maintain bond for a bit
bond = bondpy.Bond(n, "/capabilities/bonds", future.result().bond_id)
bond.start()
# Do some work while the bond is active
rclpy.spin(n)
# main
if __name__ == '__main__':
rclpy.init()
node = rclpy.create_node('test_call_cap_srvs')
# do tests
test_establish_bond(node)
rclpy.shutdown()
exit(0)