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
my_pub.publish(move_square)
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
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.
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.