// do_loiter_unlimited - start loitering with no end conditions // note: caller should set yaw_mode void Copter::do_loiter_unlimited(const AP_Mission::Mission_Command& cmd) { // convert back to location Location_Class target_loc(cmd.content.location); // use current location if not provided if (target_loc.lat == 0 && target_loc.lng == 0) { // To-Do: make this simpler Vector3f temp_pos; wp_nav.get_wp_stopping_point_xy(temp_pos); Location_Class temp_loc(temp_pos); target_loc.lat = temp_loc.lat; target_loc.lng = temp_loc.lng; } // use current altitude if not provided // To-Do: use z-axis stopping point instead of current alt if (target_loc.alt == 0) { // set to current altitude but in command's alt frame int32_t curr_alt; if (current_loc.get_alt_cm(target_loc.get_alt_frame(),curr_alt)) { target_loc.set_alt_cm(curr_alt, target_loc.get_alt_frame()); } else { // default to current altitude as alt-above-home target_loc.set_alt_cm(current_loc.alt, current_loc.get_alt_frame()); } } // start way point navigator and provide it the desired location auto_wp_start(target_loc); }
// do_loiter_unlimited - start loitering with no end conditions // note: caller should set yaw_mode void Sub::do_loiter_unlimited(const AP_Mission::Mission_Command& cmd) { // convert back to location Location_Class target_loc(cmd.content.location); // use current location if not provided if (target_loc.lat == 0 && target_loc.lng == 0) { // To-Do: make this simpler Vector3f temp_pos; wp_nav.get_wp_stopping_point_xy(temp_pos); Location_Class temp_loc(temp_pos); target_loc.lat = temp_loc.lat; target_loc.lng = temp_loc.lng; } // In mavproxy misseditor: Abs = 0 = ALT_FRAME_ABSOLUTE // Rel = 1 = ALT_FRAME_ABOVE_HOME // AGL = 3 = ALT_FRAME_ABOVE_TERRAIN // 2 = ALT_FRAME_ABOVE_ORIGIN, not an option in mavproxy misseditor // use current altitude if not provided // To-Do: use z-axis stopping point instead of current alt if (target_loc.alt == 0) { // set to current altitude but in command's alt frame int32_t curr_alt; if (current_loc.get_alt_cm(target_loc.get_alt_frame(),curr_alt)) { target_loc.set_alt_cm(curr_alt, target_loc.get_alt_frame()); } else { // default to current altitude as alt-above-home target_loc.set_alt_cm(current_loc.alt, current_loc.get_alt_frame()); } } // start way point navigator and provide it the desired location auto_wp_start(target_loc); }