コード例 #1
0
	state_pub = rospy.Publisher('/state_machine/state', StateMachine, queue_size=100)
	#service proxies for arming and setting mode
	armCommandSrv = rospy.ServiceProxy("/mavros/cmd/arming", CommandBool)
	setModeSrv = rospy.ServiceProxy("/mavros/set_mode", SetMode) #http://wiki.ros.org/mavros/CustomModes

	#msgs sent at 60hz
	rate = rospy.Rate(10)

	#creating pose msg
	pose = PoseStamped()
	pose.pose.position.x = 0
	pose.pose.position.y = 0
	pose.pose.position.z = .5

	#StateMachine msg that will switch Lakitu to 'hover' state
	state = StateMachine()
	state.preflight = False
	state.takeoff = False
	state.flight = False
	state.hover = True
	state.land = False
	state.emergency = False

	# last_request = rospy.Time.now()

	#main loop of program
	while not rospy.is_shutdown():

		if(flight_state is None):
			# print('what the f**k')
			continue