ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | Q&A
Ask Your Question

Rospy Services with method class

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

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 -0600

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

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools


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

Seen: 1,585 times

Last updated: Mar 04 '15