Services Quiz autograder failing for expected turn

I’ve submitted my quiz and got an error for when the grader checked if it performed the turn correctly (a right turn at 0.2 rad/s for 10 secs)

However, I printed before and after the turn and the delta in the timestamps is approximately 10 secs.

image

And I also echoed /cmd_vel to make sure its turning right at 0.2 rad/s (listed as -0.2 for angular.z)

image

I was wondering if you could give some advice on what’s wrong or if it’s an autograder issue?

Thank you

Hi,

I’ve tested it with the offitial solution and its working the autograder as expected. So It might be something in your code or that you move the robot around before executing the test?

The main core of the client should have something like this:

    request = Turn.Request()
    request.direction = "right"
    request.angular_velocity = 0.2  # rad/s
    request.time = 10.0  # Turn for 10 seconds

You should the robot perform this exact turn form this exact location.
turnds

PLease let us know if you continue getting this error.

Hello,

I refreshed the simulation to make sure that the rover was at the same spot before running the grader and got the same error. I also have the same client structure as you listed above. (where self.req is initialized as Turn.Request() in init)
self.req.direction=“RIGHT”
self.req.angular_velocity=0.2
self.req.time=10.0
self.future = self.client.call_async(self.req)

I also compared my turn with the gif you have above and they look similar

Course simulation - ROS2 Basics in 5 Days (Python) _ Robotics & ROS Online Courses _ The Construct - Screencastify - September 9, 2025 7_35 AM (3)

Hi,

One thing is that it work when you executed using your own server an dthe other is executing it with the server of the grader.
When you execute teh grading doesn the robot turn? I knwo its a bit difficult to see becuas eteh simulation window gets blurred but you cn see that its turning.

I say this becuase I see that you are using “RIGHT” instead of “right”. This would make teh server NOT work or turn the other way round, becuas ethe server does this:

import rclpy
from rclpy.node import Node
from services_quiz_srv.srv import Turn
from geometry_msgs.msg import Twist
import time


class QuizService(Node):

    def __init__(self):

        super().__init__('service_moving')

        self.srv = self.create_service(
            Turn, 'turn', self.srv_callback)

        self.publisher_ = self.create_publisher(Twist, 'cmd_vel', 10)
        self.twist = Twist()

    def srv_callback(self, request, response):

        if request.direction == "right":
            self.twist.angular.z = -request.angular_velocity
        else:
            self.twist.angular.z = request.angular_velocity

        i = 0.0
        # loop to publish the velocity estimate, current_distance = velocity * (t1 - t0)

        while (i <= request.time):

            self.publisher_.publish(self.twist)
            i += 0.1
            time.sleep(0.1)
            self.get_logger().info("i = " + str(i) +" <= " + str(request.time) + " seconds")

        # set velocity to zero to stop the robot
        self.twist.angular.z = 0.0
        self.publisher_.publish(self.twist)

        self.get_logger().info("Turned robot " + request.direction +
                               " for " + str(request.time) + " seconds")

        response.success = True

        return response


def main(args=None):

    rclpy.init(args=args)
    quiz_service = QuizService()
    rclpy.spin(quiz_service)
    rclpy.shutdown()


if __name__ == '__main__':
    main()

Hello,

I changed my client to send over lowercase “right” and I saw that it did perform the turn in the simulation during the grading process, but I am still obtaining the same error. Also I was wondering if it would be possible to add more attempts to the grader so I can continue to debug (I ran out).

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.

Let me check deeply this issue becuase it make no sense that you don’t get the correct grades. If you tell me I can erase those grades an dyou can retry 5 times more

Please let me know

Hi, Sorry for the late reply. We made a ne version for the correction script that is more robust to any slight difference in coding. Now your service quiz passes with a 10 and we updated your grade . Sorry again for the inconvenience.