示例#1
0
			#Move to landing position
			if sequence == 5:
				error_z = controller.rc_alt(alt_com)
				error_yaw = controller.rc_yaw(0)
				#error_x_y = controller.rc_xy(x_com, y_com)
				err_x = 0#error_x_y[0]
				err_y = 0#error_x_y[1]
				print('Seq: '+repr(sequence)+' Err Z: '+repr(round(error_z))+' Err Yaw: '+repr(round(error_yaw))+' Err X: '+repr(round(err_x))+' Err y: '+repr(round(err_y)))
				if ((abs(error_z) < pos_bound_err) and (abs(error_yaw) < yaw_bound_err) and (abs(err_y) < pos_bound_err) and (abs(err_x) < pos_bound_err)):# Closes Error 
					alt_com-=1
					if(alt_com<170):
						sequence = 6

			# Land
			if sequence == 6: 
				controller.vidro.set_rc_throttle(0)# it'll round it to minimum which is like 1100
				controller.vidro.rc_throttle_reset()
				controller.vidro.rc_yaw_reset()
				controller.vidro.rc_pitch_reset()
				controller.vidro.rc_roll_reset()
				reset_val = 0
				vidro.close()
				break	# this break won't break all the loops, just the auto loop			

			if vidro.current_rc_channels[5] < 1600:
				reset_val = 1