I have attached the screenshots of the service_server and service_client codes running and performing the turn.
I see that if I add a ‘time.sleep(10)’ in the client code, the Gradebot doesn’t mind it and passes me there. But if I remove it, the Gradebot fails me.
When I have passed this check by using ‘time.sleep(10)’, even it felt wrong to do so, the Gradebot failed my code saying, the signals to the motors are not continuous.
You need not add a manual sleep to your client.
The idea is that your client should NOT exit until the service completes and returns a response. I doubt that the service could be completed in less than 10 seconds. In other words, your service client program must not end before the service completes.
Please check the sample service client logic to see how to make your client “wait” for the service.
my client exits in less than 10s.
user:~/ros2_ws$ ros2 launch services_quiz services_quiz_client.launch.py
[INFO] [launch]: All log files can be found below /home/user/.ros/log/2025-11-14-16-18-56-724152-1_xterm-19779
[INFO] [launch]: Default logging verbosity is set to INFO
[INFO] [turn_s_client_executable-1]: process started with pid [19782]
[turn_s_client_executable-1] [INFO] [1763137137.063579764] [turn_s_client]: Request sent!
[turn_s_client_executable-1] [INFO] [1763137141.136347053] [turn_s_client]: Success: True
[turn_s_client_executable-1] [INFO] [1763137141.137180984] [turn_s_client]: Turned the rover at 0.5rad/s for 4.0secs towards LEFT.
[turn_s_client_executable-1] [INFO] [1763137141.137777022] [turn_s_client]: Client stayed alive for 4.0896546840667725s.
[INFO] [turn_s_client_executable-1]: process has finished cleanly [pid 19782]
I will keep trying and think about your comment. Thanks
Thank you for getting back. Please review the instructions for the quiz. The robot should be made to spin to the right, for 10 seconds:
- The Client
turn_s_client.pycalls the Service/turn, and makes the robot spin with the following specifications:
- It will spin to the right.
- It will spin at an angular velocity of 0.2 rad/s.
- It will turn for
10seconds.
All those conditions must be met before your server returns True and your client ends. You can see why it should not end in less than 10 seconds.
This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.
