Grader fails services_quiz after simulation randomly resets mid-movement


I’ve completed the services quiz, checked and ran it before putting it through the grader. BB8 draws 2 small squares >= 1m^2 and one big square >=2m^2.

While putting it through the grader, the simulation gets reset at the point noted in the error below while BB8 is moving and seems to fail. I am aware of the 3 minute time limit also but the complete movement is well within this.

[info] Checking that the robot performs the expected movements...

**(mark: 7)**

[assess] The robot did NOT fully perform the expected movements. Things your can check:
- Did the robot move the right distance for each side of the two squares as stated in the notebook?
- Did the robot complete the movements within the stipulated time?

Please help


You probably need to move your robot a little faster. If the simulation was reset while the robot was still moving, it means it had run out of time.

My speeds are as follows
vel_msg.linear.x = 0.3;
vel_msg.angular.z = 0.4;

I was in fact able to use slower speeds in the python version of the ROS Basics course and it passed through the grader without issues
linear.x = 0.2
angular.z = 0.2

Also, I only have 1 attempt left.
Would it help if I posted my code here? Is there a way to see logs or figure out why it could be failing only when put through the grader but not when I run it from the terminal?

Here is the terminal output when I do a timed run which is less than 3 minutes.

user:~$ time roslaunch services_quiz call_bb8_move_in_square_custom_service_server.launch
... logging to /home/user/.ros/log/341d07a2-e860-11ec-9558-0242c0a80004/roslaunch-4_xterm-7408.log
Checking log directory for disk usage. This may take a while.
Press Ctrl-C to interrupt
Done checking log file disk usage. Usage is <1GB.

started roslaunch server http://4_xterm:39539/


 * /rosdistro: noetic
 * /rosversion: 1.15.9

    service_move_bb8_in_square_custom_client (services_quiz/bb8_move_custom_service_client_node)


process[service_move_bb8_in_square_custom_client-1]: started with pid [7416]
[ INFO] [1654826147.179760746, 92.955000000]: Service call success
[ INFO] [1654826195.486118759, 138.960000000]: Service call success
[service_move_bb8_in_square_custom_client-1] process has finished cleanly
log file: /home/user/.ros/log/341d07a2-e860-11ec-9558-0242c0a80004/service_move_bb8_in_square_custom_client-1*.log
all processes on machine have died, roslaunch will exit
shutting down processing monitor...
... shutting down processing monitor complete

real    1m59.761s
user    0m4.099s
sys     0m6.214s

Let me have a look at your code and get back to you.

1 Like

Your logic seems okay, but it might not be optimal. It should be something like, simply implemented:

  • move the robot and let it keep moving for x seconds (depending the how long you want the side to be) - move and sleep.
  • turn the robot and repeat the above until you have done the four sides.

Things that may not work work:

  • duration should be an integer, but in some cases it seems it might not be because it’s a product of a division.
  • ROS::rate makes a best effort at running a loop at a given rate/sec. It’s not perfect. Try ditching this and use sleep directly.
  • Implement this in your logic, so you can be sure that your messages are not lost.

I have given you two more trials.

Thanks! I’ve implemented your suggestions; however, I am still seeing the same issue. It works fine when I run the example from terminal, but when run through the grader, it gets reset randomly at the same step as above.

Please try increasing the speed and simplify your logic further so it implements this in as simple way as possible:
Draw a square of size X:

  1. Move at a set speed for “x” seconds, which should directly proportional to X. Fine-tune both speed and “x” and move as fast as you can.
  2. Stop and turn. Does not need to be a perfect 90 degrees turn.
  3. Repeat 1 and 2 until you have the four sides.

@y.kartik @bayodesegun Hello, I am having this same issue. My code runs perfectly fine when I run it from the terminal but in the grader, it doesn’t. This is what goes on when I put it through the grader.

I can see that while the grader is doing all the checks, when it gets to " :heavy_check_mark: [info] Checking the service client… (mark: 6)" the simulated robot starts to move as if someone had launched the call_bb8_move_in_square_custom_service_server.launch file. Then, the next check appears on the grader “:heavy_check_mark: [assess] Can launch services_quiz service client successfully (mark: 7)” and also “:heavy_check_mark: [info] Checking that the robot performs the expected movements… (mark: 7)”, this happens as the simulated robot was still moving from the previous check and causes the simulation to just get stuck where it was when this notification came up on the grader.

I think that this check " :heavy_check_mark: [info] Checking the service client… (mark: 6)" is launching the script and causing the simulation to start moving. And then before it finishes the cycle the next notification comes up “:heavy_check_mark: [assess] Can launch services_quiz service client successfully (mark: 7)”, I’m guessing this one tries to launch the same file again and is causing something to fault because that’s where the robot just stops and gets stuck.

Please advise whether the issue is something I can fix in my code or if there’s something wrong with the functioning of the grader


:heavy_check_mark: [info] Checking the service client… (mark: 6)


:heavy_check_mark: [assess] Can launch services_quiz service client successfully (mark: 7)

Are part of the same check that the services quiz client can be successfully run and the service is called only once for both.

After this, the simulation is reset and the next check starts. The problem seems to be with the next step. What happens exactly in your case at this point?


These two checks cause the robot to start moving, then when the checks are done and the grader moves on to the next check, the robot just gets stuck doing what it was doing at the time. It doesn’t look like it resets. So then since the robot was stuck doing some random thing, it doesn’t pass the next check and after the time limit is over, the check fails.

In my opinion, the service and simulation are not resetting properly after the two checks above happen, and that’s causing the robot to get stuck and not pass the next check.

Let me check this and get back to you.

I have checked the logs of the gradebot and found that the simulation is actually reset after those two checks.

However, I found that the server node used in the previous test was not killed. This should not have any effect in theory because it’s killed when another one is started for the next test, but I have fixed this. Also, I have added another reset command for the simulation, just to be very sure.

Please try again, ensuring the quiz’s client or server is not running in any of your terminals (please kill any running node).

This worked, thanks!

This topic was automatically closed after 31 hours. New replies are no longer allowed.