Services_quiz problem

Hi,
Can I ask why we are putting this line in the bb8_move_custom_service_server.py?
from std_srvs.srv import Empty, EmptyResponse

I also have no problems when I run both launch files separately. But when I run both, I get the error as below and the launch file starts to give an error.
process[service_move_bb8_in_square_service_server-1]: started with pid [12975]
[INFO] [1589064462.422127, 0.000000]: Service /move_bb8_in_square_custom Ready
[INFO] [1589064484.427233, 5671.607000]: The Service move_bb8_in_square_custom has been called
[ERROR] [1589064484.429982, 5671.610000]: Error processing request: range() integer end argument expected, got float.
[‘Traceback (most recent call last):\n’, ’ File “/opt/ros/kinetic/lib/python2.7/dist-packages/rospy/impl/tcpros_service.py”, line 625, in _handle_request\n response = convert_return_to_response(self.handler(request), self.response_class)\n’, ’ File “/home/user/catkin_ws/src/services_quiz/src/bb8_move_custom_service_server.py”, line 12, in my_callback\n for i in range(request.repetitions):\n’, ‘TypeError: range() integer end argument expected, got float.\n’]
^C[service_move_bb8_in_square_service_server-1] killing on exit

I solved this problem. It must be

for i in range(int(request.repetitions))

instead of

for i in range((request.repetitions):
1 Like

Hi @kagizman,

Welcome to the Community!

In the line you referenced above, we are importing some inbuilt service messages that are used for…
Empty - This is the message type that the service server accepts. A service client will use this when calling the server.
EmptyResponse - the service server responds to the client using this message.

The “Empty” parts indicates that nothing is being sent in reality, just to fulfil the convention that there must be an exchange of messages between client and server. And in this case it’s “empty in empty out” :slight_smile:.

By the way, thanks for sharing the solution to the other problem.

Cheers.

1 Like

3 posts were split to a new topic: ImportError: No module named services_quiz.srv