Ejemplo n.º 1
0
def my_callback(request):
    rospy.loginfo("The Service move_bb8_in_square has been called")
    movebb8_object = MoveBB8()
    movebb8_object.move_square()
    rospy.loginfo("Finished service move_bb8_in_square that as called")
    return EmptyResponse(
    )  # the service response class, in this case EmptyResponse
Ejemplo n.º 2
0
def my_callback(request):
    rospy.loginfo('Service has been called')
    obj = MoveBB8()
    obj.move_bb8(request.duration)
    rospy.loginfo('Finished')
    response = MyCustomServiceMessageResponse()
    response.success = True
    return response
def my_callback(request):
    rospy.loginfo("The Service move_bb8_in_circle has been called")
    movebb8_object = MoveBB8()
    movebb8_object.move_bb8(request.duration)
    rospy.loginfo("Finished service move_bb8_in_circle")
    response = MyCustomServiceMessageResponse()
    response.success = True
    return response
Ejemplo n.º 4
0
def my_callback(request):
    print "My_callback has been called"

    x = MoveBB8()
    x.move_square(request.side, request.repetitions)

    response = BB8CustomServiceMessageResponse()
    response.success = True

    return response  # the service Response class, in this case EmptyResponse
Ejemplo n.º 5
0
def my_callback(request):
    print "Request Data==> side=" + str(request.side) + ", repetitions=" + str(
        request.repetitions)
    my_response = BB8CustomServiceMessageResponse()
    move_square = MoveBB8()
    try:
        for i in range(request.repetitions):
            move_square.move_square(request.side)
        my_response.success = True
    except Exception as e:
        print e.message
        my_response.success = False
    rospy.loginfo('Finished service move bb8 in square')
    return my_response
def my_callback(request):
    rospy.loginfo("The Service move_bb8_in_square has been called")
    movebb8_object = MoveBB8()
    repetions_of_square = request.repetitions + 1
    new_side = request.side

    for i in range(repetions_of_square):
        rospy.loginfo("Start Movement with side =" + str(new_side) +
                      " Repetition = " + str(i))
        movebb8_object.move_square(side=new_side)

    rospy.loginfo("Finished service move_bb8_in_square that was called called")
    response = BB8CustomServiceMessageResponse()
    response.success = True
    return response
Ejemplo n.º 7
0
def my_callback(request):
    rospy.loginfo("The Service move_bb8_in_square_custom has been called")

    movebb8_object = MoveBB8()

    # We need to add because if we ask 0 repetitions means to execute once, not zero times.
    repetitions_of_square = request.repetitions + 1
    new_side = request.side
    for i in range(repetitions_of_square):
        rospy.loginfo("Start Movement with side = "+str(new_side)+"Repetition = "+str(i))
        movebb8_object.move_square(side=new_side)

    rospy.loginfo("Finished service move_bb8_in_square that was called called")
    response = BB8CustomServiceMessageResponse()
    response.success = True
    return response
Ejemplo n.º 8
0
def squareCallback(request):
    rospy.loginfo("Lets initialize the robot move...")
    ##initializing our response object
    response = MyCustomServiceMessageResponse()

    #create the robot movement object
    square = MoveBB8()
    errors = 0
    for i in range(request.repetitions):
        #movin with a side size
        try:
            square.movesinSquare(request.radius)
        except Exception as e:
            errors += 1
    if errors == 0:
        response.success = True
    else:
        response.success = False

    return response
def my_callback(request):
    print "My_callback has been called"
    x = MoveBB8()
    x.move_square()
    
    return EmptyResponse() # the service Response class, in this case EmptyResponse
Ejemplo n.º 10
0
#! /usr/bin/env python

import rospy
from std_srvs.srv import Empty, EmptyResponse  # you import the service message python classes generated from Empty.srv.
from move_bb8 import MoveBB8


def move_callback(request):
    print("move_callback has been called")
    moveBB8.move_square(0.7)
    print("move complete")
    return EmptyResponse(
    )  # the service Response class, in this case EmptyResponse
    #return MyServiceResponse(len(request.words.split()))


rospy.init_node('service_server')
#rate = rospy.Rate(4)
moveBB8 = MoveBB8()
print("Starting bb8_service")
bb8_service = rospy.Service(
    '/bb8_service', Empty, move_callback
)  # create the Service called my_service with the defined callback
rospy.spin()  # mantain the service open.
Ejemplo n.º 11
0
def squareCallback(request):
    rospy.loginfo("Lets initialize the robot move...")
    square = MoveBB8()
    square.movesinSquare()

    return EmptyResponse()
Ejemplo n.º 12
0
def my_callback(request):
    print "move_bb8_in_square has been called"
    moveBB =  MoveBB8('/cmd_vel')
    moveBB.moveSquare()
    return EmptyResponse() # the service Response class, in this case EmptyResponse