def drive(self):
start_time =rospy.get_rostime()
while not rospy.is_shutdown():
curent = rospy.get_rostime()
if (curent - start_time) < rospy.Duration(1,0):
self.controller.SendTakeoff()
self.status =0
elif (curent - start_time) < rospy.Duration(22,0):
self.controller.SetCommand(pitch=1)
self.status =1
elif (curent - start_time) < rospy.Duration(23,0):
self.controller.SetCommand(pitch=0)
self.status =2
elif (curent - start_time) < rospy.Duration(24,0):
#self.controller.SetCommand(yaw_velocity=2)
self.turnLeft()
self.status =3
rate =rospy.Rate(1)
elif (curent - start_time) < rospy.Duration(40.5,0):
self.controller.SetCommand(pitch=1)
self.status =4
else:
self.controller.SetCommand(pitch=0)
self.controller.SendLand()
评论列表
文章目录