Unknown error in actions_quiz (ROS basics in 5 days)

Hi!
I have some troubles with the actions quiz in the ROS in 5 days course (Python). The code I wrote works well if I run it, but every time I started autocorrection this was the result:


There is no infinite loops or logic errors inside my code, as I wrote, it works well.
I reached the maximum trials for the quiz, and it gave me 0/10. How can I fix the problem and complete this unit? Could I get some extra attempts?
Thanks in advance

Hi @Simo97 ,

Here are some things you can check for:

  1. Does your action call complete the action execution and return the action result within 3 minutes?
  2. Were you able to start the action server and/or the action client and successfully complete the action call with the client?

If your answer to any one of the above two questions is “No” then you need to revise your program code/logic.

I am guessing that your action completes the execution but fails to return the result. Check your client program.

Let us know if you have any issues.

Regards,
Girish

Thanks @girishkumar.kannan for your response.
There is no client to write for the quiz, I simply call the action server with the “rostopic pub” command. The answer to both questions are yes, the result is returned, it seems.
This is my code:

#! /usr/bin/env python
import rospy
import time
import actionlib

from actions_quiz.msg import CustomActionMsgFeedback, CustomActionMsgResult, CustomActionMsgAction
from geometry_msgs.msg import Twist
from std_msgs.msg import Empty

class ActionQuizClass(object):

_feedback = CustomActionMsgFeedback()
_result   = CustomActionMsgResult()

def __init__(self):
    
    self._as = actionlib.SimpleActionServer("action_custom_msg_as", CustomActionMsgAction, self.goal_callback, False)
    self._as.start()
    self.ctrl_c = False
    self.rate = rospy.Rate(10)
   
def goal_callback(self,goal):

    r = rospy.Rate(1)
    success = True

    decision = goal.goal

    self._pub_cmd_vel = rospy.Publisher('/cmd_vel', Twist, queue_size=1)
    self._move_msg = Twist()
    self._pub_takeoff = rospy.Publisher('/drone/takeoff', Empty, queue_size=1)
    self._takeoff_msg = Empty()
    self._pub_land = rospy.Publisher('/drone/land', Empty, queue_size=1)
    self._land_msg = Empty()

    if decision == 'TAKEOFF':
        i = 0
        while not i == 3:
            rospy.loginfo('Taking off!')
            self._pub_takeoff.publish(self._takeoff_msg)
            self._feedback.feedback = 'Taking off...'
            self._as.publish_feedback(self._feedback)
            time.sleep(1)
            i += 1

    elif decision == 'LAND':
        i = 0
        while not i == 3:
            rospy.loginfo('Landing!')
            self._pub_land.publish(self._land_msg)
            self._feedback.feedback = 'Landing...'
            self._as.publish_feedback(self._feedback)
            time.sleep(1)
            i += 1

    if success:
        self._result = Empty()
        rospy.loginfo('Finished maneuver!')
        self._as.set_succeeded(self._result)

if name == ‘main’:
rospy.init_node(‘action_quiz’)
ActionQuizClass()
rospy.spin()

Is there any glaring error?
Having no further attemps, I cannot test the code again. How can I go on with the course? Could I have some extra trials?
Thanks in advance

Hi @Simo97 ,

You cannot “call” the action server with rostopic pub command. That is wrong way to do it.

Yes, I see that you have written the action server. The code looks fine to me.

Now that you have exhausted your quiz trials, I would advise you to continue with the course and finish it. Also, complete the course project (rosject)

Once you have completed the rosject, you can request any of the admins from The Construct team to add few more trials so you can complete the quiz.

From now on, test your program before submitting it to the autograder. If it works then submit it.
If anything fails in the first trial, try to fix it and try again. If it still fails, then report here.
Don’t exhaust your all your trial attempts.

Regards,
Girish

Hi @girishkumar.kannan,
thank you for your response.
I’m sorry for the inconvenience, I made some small changes to the code between one test and another, not understanding what was wrong, and I ran out of attempts.
I have already completed the course and the rosject, I’m stuck at 92% for this last quiz.
How do I contact The Construct team to get more attempts?
Thanks for your help

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