示例#1
0
bool VtolLandDetector::update()
{
	updateSubscriptions();
	updateParameterCache(false);

	// this is returned from the mutlicopter land detector
	bool landed = get_landed_state();

	// for vtol we additionally consider airspeed
	if (hrt_elapsed_time(&_airspeed.timestamp) < 500 * 1000) {
		_airspeed_filtered = 0.95f * _airspeed_filtered + 0.05f * _airspeed.true_airspeed_m_s;

	} else {
		// if airspeed does not update, set it to zero and rely on multicopter land detector
		_airspeed_filtered = 0.0f;
	}

	// only consider airspeed if we have been in air before to avoid false
	// detections in the case of wind on the ground
	if (_was_in_air && _airspeed_filtered > _params.maxAirSpeed) {
		landed = false;
	}

	_was_in_air = !landed;

	return landed;
}
bool MulticopterLandDetector::update()
{
	// first poll for new data from our subscriptions
	updateSubscriptions();

	updateParameterCache(false);

	return get_landed_state();
}
LandDetectionResult MulticopterLandDetector::update()
{
	// first poll for new data from our subscriptions
	updateSubscriptions();

	updateParameterCache(false);

	if (get_freefall_state()) {
		_state = LANDDETECTION_RES_FREEFALL;

	} else if (get_landed_state()) {
		_state = LANDDETECTION_RES_LANDED;

	} else {
		_state = LANDDETECTION_RES_FLYING;
	}

	return _state;
}