while not rospy.is_shutdown(): print state # NOTE: There are some subtleties here. We want to be able to use more than # one mode for certain modes which is why follow mode is on it's own # Check if we're in takeoff mode if (state == 'takeoff'): print "Takeoff Mode" # NOTE: This was copy and pasted from the takeoff node # To get this guy to take off! For some reason just calling this # function once does not work. This value (50) was determined # experimentally # TODO: Turn on takeoff mode's timer and turn off every other mode's # timers EXCEPT take picture takeoff.turn_on_timer(takeoff.timer, 'Takeoff') land.turn_off_timer(land.timer, 'Land') reac.turn_off_timer(reac.prev_state_timer, 'Reac prev state') reac.turn_off_timer(reac.land_timer, 'Reac land') # print "Turned on Takeoff Timer" # print "Turned off Land, Previous State, and Land timers" while takeoff_counter < 50: takeoff.launch() takeoff_counter += 1 rate.sleep() if(takeoff.altitude < takeoff.max_altitude): rospy.loginfo("Go up!") takeoff.change_altitude(takeoff_speed) elif(takeoff.altitude >= takeoff.max_altitude): takeoff_speed = 0 rospy.loginfo("Stop!")
while not rospy.is_shutdown(): print state # NOTE: There are some subtleties here. We want to be able to use more than # one mode for certain modes which is why follow mode is on it's own # Check if we're in takeoff mode if (state == 'takeoff'): print "Takeoff Mode" # NOTE: This was copy and pasted from the takeoff node # To get this guy to take off! For some reason just calling this # function once does not work. This value (50) was determined # experimentally # TODO: Turn on takeoff mode's timer and turn off every other mode's # timers EXCEPT take picture takeoff.turn_on_timer(takeoff.timer, 'Takeoff') land.turn_off_timer(land.timer, 'Land') reac.turn_off_timer(reac.prev_state_timer, 'Reac prev state') reac.turn_off_timer(reac.land_timer, 'Reac land') # print "Turned on Takeoff Timer" # print "Turned off Land, Previous State, and Land timers" while takeoff_counter < 50: takeoff.launch() takeoff_counter += 1 rate.sleep() if (takeoff.altitude < takeoff.max_altitude): rospy.loginfo("Go up!") takeoff.change_altitude(takeoff_speed) elif (takeoff.altitude >= takeoff.max_altitude): takeoff_speed = 0 rospy.loginfo("Stop!")