Servicios en ROS

Hola estoy teniendo un problema con una actividad. Cree un servidor de servicios en el cual tambien tiene una funcion llamada my_callback que llama al servicio pero no me estaria funcionando. Cuando ejecuto el script de python me crea el servicio lo intente llamar con rosservice call /nombre_servicio pero cuando apreto TAB + TAB no me aparece ningún parámetro para introducir y el tipo de mensaje que tiene este servicio si tiene un REQUEST.
Aca les dejo el código que hize.
#!/usr/bin/env python

import rospy

from my_custom_srv_msg_pkg.srv import MyCustomServiceMessage, MyCustomServiceMessageResponse

from geometry_msgs.msg import Twist

var = Twist()

pub = rospy.Publisher("/cmd_vel", Twist, queue_size=1)

def my_callback(request):

request.duration = 10

resultado = MyCustomServiceMessageResponse()

while request.duration > 0: 

    var.linear.x = 0.7

    var.angular.z = 0.7

    pub.publish(var)

    rospy.sleep(1)

    request.duration -= 1

    resultado.success = False

else:

    var.linear.x = 0

    var.angular.z = 0

    pub.publish(var)

    resultado.success = True

    return resultado

rospy.init_node(“bb8_move_custom”)

ser = rospy.Service("/move_bb8_in_circle_custom", MyCustomServiceMessage, my_callback)

rospy.spin()

Kindly post you request in English and tell us the course and the unit you are working on.

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.