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:
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
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()
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).
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
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.