6.4 Services Quiz

I am getting an error constantly for the quiz
please guide me through this

indent preformatted text by 4 spaces

#! /usr/bin/env python

import rospy

from my_custom_srv_msg_pkg.srv import BB8CustomServiceMessage, BB8CustomServiceMessageResponse

from geometry_msgs.msg import Twist

def my_callback(request):

rospy.loginfo("The Service move_bb8_in_square_custom has been called")

i = 0

while  i <=request.repetitions:

    move_square.linear.x = 1*request.size

    move_square.angular.z = 1.57

    move_sqaure.angular.y = 1*request.size

    move_ssquare.angular.z = 1.57


rospy.loginfo("Finished service move_bb8_in_square_custom")

response = BB8CustomServiceMessageResponse()

response.success = True

return response # the service Response class, in this case EmptyResponse


my_service = rospy.Service(’/move_bb8_in_square_custom’, BB8CustomServiceMessage , my_callback) # create the Service called move_bb8_in_circle with the defined callback

my_pub = rospy.Publisher(’/cmd_vel’, Twist, queue_size=1)

move_circle = Twist()

rate = rospy.Rate(1)

rospy.loginfo(“Service /move_bb8_in_square_custom Ready”)

rospy.spin() # mantain the service open.

Hello @Ankit_Kumar ,

Well, the error is clearly in this line

from my_custom_srv_msg_pkg.srv import BB8CustomServiceMessage, BB8CustomServiceMessageResponse

Apparently, your script is not able to do this import. Have you properly compiled this message in the my_custom_srv_msg_pkg package? In case you have done so, have you added this package as a dependency of the services_quiz package?

In any case, I’d suggest you create this custom message BB8CustomServiceMessage in the services_quiz package (instead of the my_custom_srv_msg_pkg package), as it is requested by the Quiz.

I tried creating BB8CustomServiceMessage in the services_quiz package. However, when I am running catkin_make it’s giving me this error.

I am using this file that you can download from -

Hello @Ankit_Kumar ,

I’ve done some modifications that should fix this error you showed in the image.

I tried everything yet I this error is coming. Please guide me through this it’s being more than two weeks I am struck at this. I might be doing wrong in Cmake and pakage.xml
here’s the download link

Hello @Ankit_Kumar ,

This line of code

from my_custom_srv.srv import BB8CustomServiceMessage, BB8CustomServiceMessageRequest

says that you have a package named my_custom_srv where you have created the custom service message. From what the error is saying (No module named ‘my_custom_srv’) and what I can see in your screenshot, it looks like you don’t have this package.