Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

'resp' is here of type 'SetJointStatesReponse

Why is this so? Aren't you using your custom service getPoseArray? And why is it an array? Shouldn't it be a pose? It looks like you have some inconsistencies with the srv files.

The svc_set_joint_states is a service proxy. Based on:

i have written my own service which takes float values [x, y, z, a, b, c, d] and respond Pose

your custom srv should be getPose and look something like this:

float32 x
float32 y
float32 z
float32 a 
float32 b
float32 c
float32 d
---
geometry_msgs/Pose pose

If the response of your service is a geometry_msgs/Pose message can access the response fields like this:

try:
    svc_set_joint_states = rospy.ServiceProxy('get_pose_array', getPoseArray)

    req = getPoseRequest()
    req.x = pose[0]
    req.y = pose[1]
    req.z = pose[2]
    req.a = pose[3]
    req.b = pose[4]
    req.c = pose[5]
    req.d = pose[6]

    resp = scv_set_joint_states(req)

except rospy.ServiceException, e:
        print "Service call failed: %s"%e

resp.pose  ... # do something with the response

where resp.pose should be a geometry_msgs/Pose.

'resp' is here of type 'SetJointStatesReponse

Why is this so? Aren't you using your custom service getPoseArray? And why is it an array? Shouldn't it be a pose? It looks like you have some inconsistencies with the srv files.files. Dont confuse the geometry_msgs/Pose with geometry_msgs/PoseArray.

The svc_set_joint_states is a service proxy. Based on:

i have written my own service which takes float values [x, y, z, a, b, c, d] and respond Pose

your custom srv should be getPose and look something like this:

float32 x
float32 y
float32 z
float32 a 
float32 b
float32 c
float32 d
---
geometry_msgs/Pose pose

If the response of your service is a geometry_msgs/Pose message can access the response fields like this:

try:
    svc_set_joint_states = rospy.ServiceProxy('get_pose_array', getPoseArray)

    req = getPoseRequest()
    req.x = pose[0]
    req.y = pose[1]
    req.z = pose[2]
    req.a = pose[3]
    req.b = pose[4]
    req.c = pose[5]
    req.d = pose[6]

    resp = scv_set_joint_states(req)

except rospy.ServiceException, e:
        print "Service call failed: %s"%e

resp.pose  ... # do something with the response

where resp.pose should be a geometry_msgs/Pose.

.