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

Rospy Services with method class

asked 2015-03-04 10:21:30 -0500

Dreadma gravatar image

Hi,

How can i use a class method for rospy.Service()?

The .srv file is

int64 a
int64 b
---
bool response

The code in the server.py is

s = rospy.Service('setVelocity', SetVelocity, self.setVelocity)

The signature of the setVelocity method

def setVelocity (self, r, l)

In the client.py i've

s = rospy.ServiceProxy('setVelocity', SetVelocity)
s(3,5)

and i get this error:

error processing request: setVelocity() takes exactly 3 arguments (2 given)

Sorry for my bad english

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2015-03-04 11:25:43 -0500

The service callback should only take one argument other than self, which will be of type [YourService]Request.

edit flag offensive delete link more

Question Tools

Stats

Asked: 2015-03-04 10:21:30 -0500

Seen: 1,650 times

Last updated: Mar 04 '15