// verify_command - this will be called repeatedly by ap_mission lib to ensure the active commands are progressing // should return true once the active navigation command completes successfully // called at 10hz or higher bool Copter::verify_command(const AP_Mission::Mission_Command& cmd) { switch(cmd.id) { // // navigation commands // case MAV_CMD_NAV_TAKEOFF: return verify_takeoff(); case MAV_CMD_NAV_WAYPOINT: return verify_nav_wp(cmd); case MAV_CMD_NAV_LAND: return verify_land(); case MAV_CMD_NAV_LOITER_UNLIM: return verify_loiter_unlimited(); case MAV_CMD_NAV_LOITER_TURNS: return verify_circle(cmd); case MAV_CMD_NAV_LOITER_TIME: return verify_loiter_time(); case MAV_CMD_NAV_RETURN_TO_LAUNCH: return verify_RTL(); case MAV_CMD_NAV_SPLINE_WAYPOINT: return verify_spline_wp(cmd); #if NAV_GUIDED == ENABLED case MAV_CMD_NAV_GUIDED_ENABLE: return verify_nav_guided_enable(cmd); #endif /// /// conditional commands /// case MAV_CMD_CONDITION_DELAY: return verify_wait_delay(); case MAV_CMD_CONDITION_DISTANCE: return verify_within_distance(); case MAV_CMD_CONDITION_CHANGE_ALT: return verify_change_alt(); case MAV_CMD_CONDITION_YAW: return verify_yaw(); case MAV_CMD_DO_PARACHUTE: // assume parachute was released successfully return true; default: // return true if we do not recognize the command so that we move on to the next command return true; } }
bool Rover::verify_command(const AP_Mission::Mission_Command& cmd) { switch (cmd.id) { case MAV_CMD_NAV_WAYPOINT: return verify_nav_wp(cmd); case MAV_CMD_NAV_RETURN_TO_LAUNCH: return verify_RTL(); case MAV_CMD_NAV_LOITER_UNLIM: return verify_loiter_unlimited(cmd); case MAV_CMD_NAV_LOITER_TIME: return verify_loiter_time(cmd); case MAV_CMD_CONDITION_DELAY: return verify_wait_delay(); case MAV_CMD_CONDITION_DISTANCE: return verify_within_distance(); case MAV_CMD_CONDITION_YAW: return verify_yaw(); // do commands (always return true) case MAV_CMD_DO_CHANGE_SPEED: case MAV_CMD_DO_SET_HOME: case MAV_CMD_DO_SET_SERVO: case MAV_CMD_DO_SET_RELAY: case MAV_CMD_DO_REPEAT_SERVO: case MAV_CMD_DO_REPEAT_RELAY: case MAV_CMD_DO_CONTROL_VIDEO: case MAV_CMD_DO_DIGICAM_CONFIGURE: case MAV_CMD_DO_DIGICAM_CONTROL: case MAV_CMD_DO_SET_CAM_TRIGG_DIST: case MAV_CMD_DO_SET_ROI: case MAV_CMD_DO_SET_REVERSE: return true; default: // error message gcs_send_text_fmt(MAV_SEVERITY_WARNING, "Skipping invalid cmd #%i", cmd.id); // return true if we do not recognize the command so that we move on to the next command return true; } }
bool Copter::verify_command(const AP_Mission::Mission_Command& cmd) { switch(cmd.id) { // // navigation commands // case MAV_CMD_NAV_TAKEOFF: return verify_takeoff(); case MAV_CMD_NAV_WAYPOINT: return verify_nav_wp(cmd); case MAV_CMD_NAV_LAND: return verify_land(); case MAV_CMD_NAV_PAYLOAD_PLACE: return verify_payload_place(); case MAV_CMD_NAV_LOITER_UNLIM: return verify_loiter_unlimited(); case MAV_CMD_NAV_LOITER_TURNS: return verify_circle(cmd); case MAV_CMD_NAV_LOITER_TIME: return verify_loiter_time(); case MAV_CMD_NAV_RETURN_TO_LAUNCH: return verify_RTL(); case MAV_CMD_NAV_SPLINE_WAYPOINT: return verify_spline_wp(cmd); #if NAV_GUIDED == ENABLED case MAV_CMD_NAV_GUIDED_ENABLE: return verify_nav_guided_enable(cmd); #endif case MAV_CMD_NAV_DELAY: return verify_nav_delay(cmd); /// /// conditional commands /// case MAV_CMD_CONDITION_DELAY: return verify_wait_delay(); case MAV_CMD_CONDITION_DISTANCE: return verify_within_distance(); case MAV_CMD_CONDITION_YAW: return verify_yaw(); // do commands (always return true) case MAV_CMD_DO_CHANGE_SPEED: case MAV_CMD_DO_SET_HOME: case MAV_CMD_DO_SET_SERVO: case MAV_CMD_DO_SET_RELAY: case MAV_CMD_DO_REPEAT_SERVO: case MAV_CMD_DO_REPEAT_RELAY: case MAV_CMD_DO_SET_ROI: case MAV_CMD_DO_MOUNT_CONTROL: case MAV_CMD_DO_CONTROL_VIDEO: case MAV_CMD_DO_DIGICAM_CONFIGURE: case MAV_CMD_DO_DIGICAM_CONTROL: case MAV_CMD_DO_SET_CAM_TRIGG_DIST: case MAV_CMD_DO_PARACHUTE: // assume parachute was released successfully case MAV_CMD_DO_GRIPPER: case MAV_CMD_DO_GUIDED_LIMITS: return true; default: // error message gcs_send_text_fmt(MAV_SEVERITY_WARNING,"Skipping invalid cmd #%i",cmd.id); // return true if we do not recognize the command so that we move on to the next command return true; } }
// check if current mission command has completed bool Sub::verify_command(const AP_Mission::Mission_Command& cmd) { switch (cmd.id) { // // navigation commands // case MAV_CMD_NAV_WAYPOINT: return verify_nav_wp(cmd); case MAV_CMD_NAV_LAND: return verify_surface(cmd); case MAV_CMD_NAV_RETURN_TO_LAUNCH: return verify_RTL(); case MAV_CMD_NAV_LOITER_UNLIM: return verify_loiter_unlimited(); case MAV_CMD_NAV_LOITER_TURNS: return verify_circle(cmd); case MAV_CMD_NAV_LOITER_TIME: return verify_loiter_time(); case MAV_CMD_NAV_SPLINE_WAYPOINT: return verify_spline_wp(cmd); #if NAV_GUIDED == ENABLED case MAV_CMD_NAV_GUIDED_ENABLE: return verify_nav_guided_enable(cmd); #endif case MAV_CMD_NAV_DELAY: return verify_nav_delay(cmd); /// /// conditional commands /// case MAV_CMD_CONDITION_DELAY: return verify_wait_delay(); case MAV_CMD_CONDITION_DISTANCE: return verify_within_distance(); case MAV_CMD_CONDITION_YAW: return verify_yaw(); // do commands (always return true) case MAV_CMD_DO_CHANGE_SPEED: case MAV_CMD_DO_SET_HOME: case MAV_CMD_DO_SET_ROI: case MAV_CMD_DO_MOUNT_CONTROL: case MAV_CMD_DO_CONTROL_VIDEO: case MAV_CMD_DO_SET_CAM_TRIGG_DIST: case MAV_CMD_DO_GUIDED_LIMITS: return true; default: // error message gcs().send_text(MAV_SEVERITY_WARNING,"Skipping invalid cmd #%i",cmd.id); // return true if we do not recognize the command so that we move on to the next command return true; } }