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

Rospy Services with method class

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

Dreadma gravatar image


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

The .srv file is

int64 a
int64 b
bool response

The code in the is

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

The signature of the setVelocity method

def setVelocity (self, r, l)

In the i've

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

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

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


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

Seen: 1,651 times

Last updated: Mar 04 '15