/** * @brief execute land */ void plan_run_land() { PathDesiredEndData pathDesiredEnd; PathDesiredEndGet(&pathDesiredEnd); PositionStateDownGet(&pathDesiredEnd.Down); pathDesiredEnd.Down += 5; PathDesiredEndSet(&pathDesiredEnd); }
/** * @brief execute land */ void plan_run_land() { float downPos, descendspeed; PathDesiredEndData pathDesiredEnd; PositionStateDownGet(&downPos); // current down position PathDesiredEndGet(&pathDesiredEnd); // desired position PathDesiredEndingVelocityGet(&descendspeed); // desired position is updated to match the desired descend speed but don't run ahead // too far if the current position can't keep up. This normaly means we have landed. if (pathDesiredEnd.Down - downPos < 10) { pathDesiredEnd.Down += descendspeed * PIOS_DELTATIME_GetAverageSeconds(&landdT); } PathDesiredEndSet(&pathDesiredEnd); }