test_client.py 945 Bytes
Newer Older
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
#!/usr/bin/env python

import sys
import rospy
from gbs.msg import *
from gbs.srv import *

def linmove(cmd, x, y, z, a, b, c, s, ac):
    cmd.array[0] = 10;
    cmd.array[1] = 1;
    cmd.array[2] = 1;
    cmd.array[3] = x;
    cmd.array[4] = y;
    cmd.array[5] = z;
    cmd.array[6] = a;
    cmd.array[7] = b;
    cmd.array[8] = c;
    cmd.array[9] = s;
    cmd.array[10] = ac;

def post_gbs_cmdarray_client():
    rospy.wait_for_service('post_gbs_cmdarray')
    try:
        post_gbs_cmdarray = rospy.ServiceProxy('post_gbs_cmdarray', PostGBSCmdArray)
        array = GBSCmdArray()
        array.n = 2
        linmove(array.cmd[0], 10, 11, 12, 35, 0, 0, 10, 5)
        linmove(array.cmd[1], 10, 11, 12, 35, 0, 0, 10, 6)
        resp = post_gbs_cmdarray(array)
    except rospy.ServiceException, e:
        print "Service call failed: %s"%e

def usage():
    return "%s"%sys.argv[0]

if __name__ == "__main__":
    post_gbs_cmdarray_client()