Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

vtol_att_control: limit excessive scheduling #15383

Merged
merged 1 commit into from
Jul 21, 2020
Merged

Conversation

dagar
Copy link
Member

@dagar dagar commented Jul 20, 2020

This is to prevent vtol_att_control running at absurdly high rates (kilohertz) from every single actuator controls publication from both the multicopter and fixed wing controllers. I don't really like this solution, but it works for now until there are larger VTOL architectural changes in place.

It's not really an issue if IMU_GYRO_RATEMAX is set appropriately for these platforms, but currently it's still possible to slip through with the defaults intended for a small multicopter.

@dagar dagar added the Hybrid VTOL 🛩️🚁 Multirotor + Fixedwing! label Jul 20, 2020
@dagar dagar requested review from RomanBapst and sfuhrer July 20, 2020 15:50
@@ -342,6 +343,19 @@ VtolAttitudeControl::Run()
return;
}

const hrt_abstime now = hrt_absolute_time();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not put it inside?

#if !defined(ENABLE_LOCKSTEP_SCHEDULER)

	const hrt_abstime now = hrt_absolute_time();

	// prevent excessive scheduling (> 500 Hz)
	if (now - _last_run_timestamp < 2_ms) {
		return;
	}

	_last_run_timestamp = now;

#endif // !ENABLE_LOCKSTEP_SCHEDULER

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No real reason, I thought the timestamp might be useful later and didn't want to put more ifdefs in the header.

@dagar
Copy link
Member Author

dagar commented Jul 21, 2020

Merging this as a precaution for now, but I'd like to get rid of it eventually.

@dagar dagar merged commit e4f65f8 into master Jul 21, 2020
@dagar dagar deleted the pr-vtol_att_throttle branch July 21, 2020 15:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Hybrid VTOL 🛩️🚁 Multirotor + Fixedwing!
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants