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

Revision history [back]

click to hide/show revision 1
initial version
def handle_send_command(req):
    controller_response = cm.send_command(str(req.command)[6:])

this is most likely your problem: req.command is a std_msgs.String, not a str.

A std_msgs.String contains a data field, which is a str.

So you'll probably want to do something like:

 def handle_send_command(req):
    controller_response = cm.send_command(str(req.command.data)[6:])

Additionally:

def loop():
    ...
    send_command_service = rospy.Service('mswrapper/send_command', SendCommand, handle_send_command)

Are you (re)creating Service servers in a loop? That's probably not something you want to do.