void Plane::do_loiter_to_alt(const AP_Mission::Mission_Command& cmd) { //set target alt next_WP_loc.alt = cmd.content.location.alt; // convert relative alt to absolute alt if (cmd.content.location.flags.relative_alt) { next_WP_loc.flags.relative_alt = false; next_WP_loc.alt += home.alt; } //I know I'm storing this twice -- I'm doing that on purpose -- //see verify_loiter_alt() function condition_value = next_WP_loc.alt; //are lat and lon 0? if so, don't change the current wp lat/lon if (cmd.content.location.lat != 0 || cmd.content.location.lng != 0) { set_next_WP(cmd.content.location); } //set loiter direction loiter_set_direction_wp(cmd); //must the plane be heading towards the next waypoint before breaking? condition_value2 = LOWBYTE(cmd.p1); }
void Plane::do_loiter_unlimited(const AP_Mission::Mission_Command& cmd) { Location cmdloc = cmd.content.location; location_sanitize(current_loc, cmdloc); set_next_WP(cmdloc); loiter_set_direction_wp(cmd); }
void Plane::do_loiter_time(const AP_Mission::Mission_Command& cmd) { set_next_WP(cmd.content.location); // we set start_time_ms when we reach the waypoint loiter.time_max_ms = cmd.p1 * (uint32_t)1000; // units are seconds loiter_set_direction_wp(cmd); }
void Plane::do_loiter_turns(const AP_Mission::Mission_Command& cmd) { Location cmdloc = cmd.content.location; location_sanitize(current_loc, cmdloc); set_next_WP(cmdloc); loiter_set_direction_wp(cmd); loiter.total_cd = (uint32_t)(LOWBYTE(cmd.p1)) * 36000UL; condition_value = 1; // used to signify primary turns goal not yet met }
void Plane::do_loiter_to_alt(const AP_Mission::Mission_Command& cmd) { //set target alt Location loc = cmd.content.location; location_sanitize(current_loc, loc); set_next_WP(loc); loiter_set_direction_wp(cmd); // init to 0, set to 1 when altitude is reached condition_value = 0; }
void Plane::do_loiter_time(const AP_Mission::Mission_Command& cmd) { Location cmdloc = cmd.content.location; location_sanitize(current_loc, cmdloc); set_next_WP(cmdloc); loiter_set_direction_wp(cmd); // we set start_time_ms when we reach the waypoint loiter.time_max_ms = cmd.p1 * (uint32_t)1000; // convert sec to ms condition_value = 1; // used to signify primary time goal not yet met }
void Plane::do_loiter_turns(const AP_Mission::Mission_Command& cmd) { set_next_WP(cmd.content.location); loiter.total_cd = (uint32_t)(LOWBYTE(cmd.p1)) * 36000UL; loiter_set_direction_wp(cmd); }
void Plane::do_loiter_unlimited(const AP_Mission::Mission_Command& cmd) { set_next_WP(cmd.content.location); loiter_set_direction_wp(cmd); }