ROS Basics in 5 days (python) Final Exam Drone Challenge

Hope you’re doing great
I have problem in the final exam Drone Challenge
Task1a,
Same code as below

#!/usr/bin/env python

import rospy
from std_msgs.msg import Empty

rospy.init_node(‘drone_takeoff_node’, anonymous=True)
pub = rospy.Publisher(‘/takeoff’, Empty, queue_size=1)
rospy.loginfo(“Publishing Ready…”)
rospy.sleep(5)

rospy.loginfo(“Taking Off…”)
pub_msg = Empty()
pub.publish(pub_msg)

rospy.spin()


one time the autocorrecter bot check it as correct other time as wrong
what should i do ??

Big Thanks in advance
Regards

Abdel Raouf DANNAOUI

It looks like your drone is not taking off consistently, perhaps because your messages are getting lost. Instead of using rospy.sleep(5), see:

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