ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |

The site is read-only. Please transition to use Robotics Stack Exchange

1 | initial version |

The numpy serialization/deserialization stubs has been generated in the corresponding PKG.srv.*; So one can probably override the default serialize() deserialize() in the same manner as numpy_msg does. Take the rospy_tutorial/005_AddTwoInts for an example:

```
import ros.numpy_msg
from rospy_tutorials.srv import *
AddTwoInts._request_class = rospy.numpy_msg.numpy_msg(AddTwoIntsRequest)
AddTwoInts._response_class = rospy.numpy_msg.numpy_msg(AddTwoIntsResponse)
AddTwoIntsRequest = rospy.numpy_msg.numpy_msg(AddTwoIntsRequest)
AddTwoIntsResponse= rospy.numpy_msg.numpy_msg(AddTwoIntsResponse)
```

I haven't test the code myself. But this should give you some idea.

2 | No.2 Revision |

The numpy serialization/deserialization stubs has been generated in the corresponding PKG.srv.*; So one can probably override the default serialize() deserialize() in the same manner as numpy_msg does. Take the rospy_tutorial/005_AddTwoInts for an ~~example:~~example,
You'll probably need to add these new lines:

```
import ros.numpy_msg
```~~from rospy_tutorials.srv import *
~~AddTwoInts._request_class = rospy.numpy_msg.numpy_msg(AddTwoIntsRequest)
AddTwoInts._response_class = rospy.numpy_msg.numpy_msg(AddTwoIntsResponse)
AddTwoIntsRequest = rospy.numpy_msg.numpy_msg(AddTwoIntsRequest)
AddTwoIntsResponse= rospy.numpy_msg.numpy_msg(AddTwoIntsResponse)

I haven't got a chance to test the code ~~myself. But ~~myself, but hope this ~~should ~~give you some idea.

3 | No.3 Revision |

The numpy serialization/deserialization stubs has been generated in the corresponding PKG.srv.*; So one can probably override the default serialize() deserialize() in the same manner as numpy_msg does. Take the rospy_tutorial/005_AddTwoInts for an example, You'll probably need to add these new lines:

`import `~~ros.numpy_msg
~~rospy.numpy_msg
AddTwoInts._request_class = rospy.numpy_msg.numpy_msg(AddTwoIntsRequest)
AddTwoInts._response_class = rospy.numpy_msg.numpy_msg(AddTwoIntsResponse)
AddTwoIntsRequest = rospy.numpy_msg.numpy_msg(AddTwoIntsRequest)
AddTwoIntsResponse= rospy.numpy_msg.numpy_msg(AddTwoIntsResponse)

I haven't got a chance to test the code myself, but hope this give you some idea.

ROS Answers is licensed under Creative Commons Attribution 3.0 Content on this site is licensed under a Creative Commons Attribution Share Alike 3.0 license.