Action_quiz :Able to takeoff and land manually but gradebot failed to takeoff and landing

I am able to Takeoff and Land the drone using below code as per the quiz.
But when submit the quiz , it just give me marks 6 and said not successfully take off and landing.

Please correct me if my understanding is not right.
Here is the code :slight_smile: #! /usr/bin/env python
import rospy
import actionlib
import time

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

class drone_move(object):
_feedback = CustomActionMsgFeedback()
_result = CustomActionMsgResult()

def __init__(self):
    self._as = actionlib.SimpleActionServer(
        "action_custom_msg_as", CustomActionMsgAction, self.goal_callback, False)
    self._as.start()

def goal_callback(self, goal):

    success = True
    #r = rate.sleep(1)
    #r = rospy.Rate(10)

    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 self._as.is_preempt_requested():
        rospy.loginfo('The goal has been cancelled/preempted')
        self._as.set_preempted()
        success = False
        

    drone_actions = goal.goal

    if drone_actions == "TAKEOFF":
        self._pub_takeoff.publish(self._takeoff_msg)
        rospy.loginfo('Taking off...')

    elif drone_actions == "LAND":
        self._pub_land.publish(self._land_msg)
        rospy.loginfo('LANDING...')

    self._feedback.feedback = goal.goal
    self._as.publish_feedback(self._feedback)

    if success:
        self._as.set_succeeded(self._result)

if name == ‘main’:
rospy.init_node(‘actions_quiz_node’)
rate = rospy.Rate(1)
drone_move()
rospy.spin()

I can see manually its able to takeoff and land.

And land as well.

Sorry to upload issue in multiple parts as this platform does not allow to upload images at one go.

Now , I have only one last chance to submit the quiz. please advice.

Please take heed to the message from the bot, and also in the notebook:

  • When you send the takeoff command, it must takeoff the drone and leave it in the takeoff state (it must not land it).
  • When you send the land command, it must just land the drone and do nothing else (it should not takeoff the drone and then land it).

Exatly the same problem here.
If i run it in the comandline the drone is doing what it should but Gradebot isn’t able to take it off.
Did you find an solution ?
I don’t know what else to do.

Have you checked what is mentioned here?

of course.
But that is exactly what my code is doing.
That’s why I asked in my Topic if anyone can tell me what should be wrong on my code.

But well… the Quiz is over for me and no one will tell me why the bot can’t TAKEOFF the Drone.
It is how it is.
And in the Simulation it works so the code can’t be so wrong.

Thx, Kevin

@ewettke
Don’t panic yet. I’ll check your code and then give you more trials.
It’s likely one small detail that you or us missed.

@ewettke
So I tested your actions quiz package and it worked perfectly the first time, with the gradebot!

So, the diagnosis is that something in your workspace is not right. An error in the log of your last submission suggests that your custom action message was not probably built. You probably made some changes to the message after an initial built but it was not rebuilt.

Try:

cd ~/catkin_ws
rm -rf build/ devel/
catkin_make
source devel/setup.bash

then submit the quiz again. I have given you two more trials.

Hey thank you soooooo much :slight_smile:
Yea that’s right , first i had also a result in the message that i removed later.

Thx and greetings,
Kevin