Solves tasks, but fails grading + grader freeze

Hi,

I’ve been trying to finish the prerequisite exam to get the accomplishment, however, despite trying to follow the specifications very precisely, several of the tasks fail while grading. This is despite all the tasks being performed, to my knowledge, correctly. Also, the grader only manages to get this far in the process before it just hangs/freezes. I’ve let it sit for 30 mins and no progress.

Could you please look into this? I’ll add the relevant code from the failed tasks:

All the best.

small_square.py:

#!/usr/bin/env python

import rospy

from robot_control_class import RobotControl

rc = RobotControl()

while not rospy.is_shutdown():

    rc.move_straight_time("forward", 0.7, 1)

    rc.turn("clockwise", 1,1.49)

task2.sh:

#!/bin/bash

strval1="small_square"

strval2="medium_square"

strval3="big_square"

#Check equality two string variables

if [ $1 == $strval1 ]; then

  echo "Running small_square program!"

  rosrun linux_exam small_square.py

fi

if [ $1 == $strval2 ]; then

  echo "Running medium_square program!"

  rosrun linux_exam medium_square.py

fi

if [ $1 == $strval3 ]; then

  echo "Running big_square program!"

  rosrun linux_exam big_square.py

fi

task1.py:

#!/usr/bin/env python

from robot_control_class import RobotControl

def get_highest_lowest():

    instance = RobotControl()

    scan_data = instance.get_laser_full()

    l = scan_data

    minimum = l[0]      # first input

    maximum = l[0]      # first input

    # minimum loop

    for number in l:

        if number != float("inf") and number != float("-inf"):

            if minimum > number:

                minimum = number

        min_index = l.index(minimum)

    # maximum loop

    for number in l:

        if number != float("inf") and number != float("-inf"):

            if maximum < number:

                maximum = number

        max_index = l.index(maximum)


    return max_index, min_index

    #get_highest_lowest()

Hello @torpanvil ,

From what I can see in your files, you have created ROS packages instead of regular folders. This might be causing some conflicts with the correction system. The linux_exam and python_exam folders have to be regular folders.

Best,

1 Like

Thank you @albertoezquerro. It worked creating new folders and move the files there, and delete the old ones.

However, the grader still hangs. I’ve left it for 20-30mins. No change.

Hello @torpanvil ,

The problem is that your program never ends because you are checking if rospy.is_shutdown(). Therefore, if nobody terminates the program it will never end.

Thanks @albertoezquerro.
I added a rospy.on_shutdown(“reason”) to the end of the while loops, and that fixed it.

Thanks for your awesome work with the material.