Service Quiz Solution did not work

Hello everyone. I managed to let the BB8 perform two small squares or one big square but not both with the same service call. If I understand correctly, the objective is to let him perform both by only launching the call_bb8_move_in_square_custom_service_server.launch file. Even with the exact same code from the solutions, he does only the two small squares without the big one. What did I do wrong?

Hi @lennarttoenjes97,
welcome to the community :slight_smile: !

What you have to do is create a service server, which executes certain actions depending on your call. Then you have to create a client which calls the server. It is here that you define the size/length of the square and how many repetitions it runs.

Example functionality:

Server(side, repetitions):
    for r in range(repetitions)
        for i in range(4)
            move_straight(side):
            turn_90_deg():

Client():
    call_server(2,2)
    call_server(4,1)

This is not actual code, just what the functionality should be. Hope that helps :slight_smile:

1 Like

Hi @lennarttoenjes97,

Sorry about the confusion, which might be due to the image in the notebook:

  • Only two squares are required: one small (1sqm or more), one big (2sqm or more).
  • Your code must repeat the squares as many times as specified in the repetitions variable. Repetitions can be >= 1, so your code needs to be prepared for this, as hinted by @simon.steinmann91.

Hi @lennarttoenjes97,

We have just fixed an error in the solution of the Services Quiz (ROS Basics C++ Course). Please feel free to check it out and let us know if it works as expected now.

Best,

1 Like

Thanks for the help.
The new solutions did work for me. But in line 16 of the file ‘bb8_move_custom_service_server.cpp’, there is a ‘;’ missing and the loop must get changed to ‘for (int i=0; i < reps; ++i)’. Then it’s working fine, thanks.

1 Like