Hello, when I am doing my service quiz, I named the service message as MyCustomServiceMessage.srv instead of BB8CustomServiceMessage.srv. Everything works okay, but when the grader told me that I needed to use the name BB8CustomServiceMessage, I changed the name, but the arguments went wrong. Where did I miss to change?
This is strange that it worked with a certain name but not the other. The issue probably lies in a sourcing problem. I would just create a new package from scratch since you know it has worked before.
@roalgoal Thank you so much, I figured out what is my problem now. My old oject request was from BB8CustomServiceMessage():requestobject = BB8CustomServiceMessage() # Create an object of type EmptyRequest When I changed to BB8CustomServiceMessageRequest() everything works now!
@roalgoal Hello Gonzalez, I think I meet the requirement but the autograder said it is not. What should be the problem? The task finished within 2 mins 47 secs
Here is my code
Client
#! /usr/bin/env python
import rospkg
import rospy
from services_quiz.srv import BB8CustomServiceMessage, BB8CustomServiceMessageRequest
rospy.init_node('service_move_bb8_in_square_custom_client') # Initialise a ROS node with the name service_client
rospy.wait_for_service('/move_bb8_in_square_custom') # Wait for the service client /move_bb8_in_circle_custom to be running
move_bb8_in_square_service_client = rospy.ServiceProxy('/move_bb8_in_square_custom', BB8CustomServiceMessage) # Create the connection to the service
requestobject = BB8CustomServiceMessageRequest() # Create an object of type EmptyRequest
"""
# BB8CustomServiceMessage
float64 side # The distance of each side of the circle
int32 repetitions # The number of times BB-8 has to execute the circle movement when the service is called
---
bool success # Did it achieve it?
"""
requestobject.side = 4
requestobject.repetitions = 2
rospy.loginfo("Doing Service Call...")
result = move_bb8_in_square_service_client(requestobject) # Send through the connection the path to the trajectory file to be executed
rospy.loginfo(str(result)) # Print the result given by the service called
rospy.loginfo("END of Service call...")
Make sure all the terminals are killed before running the grader, and go through the instructions to make sure you didn’t miss something like a file name.