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

fix: use external precland if available during missions #23625

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

asimopunov
Copy link
Contributor

@asimopunov asimopunov commented Aug 28, 2024

When using a land mission item and enabling precision land, only the internal px4 precision land mode can be triggered. However, we need a way to use an external precision land mode that replaces the internal one within an uploaded mission. Currently, that is impossible, and the user would have to switch out of mission mode into precision land mode on their own.

@asimopunov asimopunov force-pushed the upstream/command-prec-land branch 4 times, most recently from cc7d69c to 68ecafa Compare August 28, 2024 15:46
@asimopunov asimopunov marked this pull request as ready for review August 28, 2024 15:47
@MaEtUgR
Copy link
Member

MaEtUgR commented Aug 28, 2024

Where's the description? What is the problem we're solving?

@asimopunov
Copy link
Contributor Author

added

Copy link
Member

@MaEtUgR MaEtUgR left a comment

Choose a reason for hiding this comment

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

Ah I see, so the issue is that the landing within a mission navigator is doing that internally and not switch the mode. I assume to some extent that's done to support landing and taking off again in the same mission. If you switch mode the mission will not continue anymore.

I'm not generally opposed but I'd check what the solution is for e.g. RTL at the end of a mission or switching to hold at the end of a takeoff. I'd avoid sending a vehicle command to switch mode if there's a nicer solution somewhere else.

Have you tested that the internal precision land still works or we fail in some cases e.g. does it still do precision land in RTL not just mission?

src/modules/navigator/mission.cpp Outdated Show resolved Hide resolved
@@ -1004,12 +1030,16 @@ void MissionBlock::startPrecLand(uint16_t land_precision)
{
if (_mission_item.land_precision == 1) {
_navigator->get_precland()->set_mode(PrecLandMode::Opportunistic);
_navigator->get_precland()->on_activation();
send_vehicle_command(vehicle_command_s::VEHICLE_CMD_DO_SET_MODE, 1, PX4_CUSTOM_MAIN_MODE_AUTO,
Copy link
Member

Choose a reason for hiding this comment

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

So as part of the mission we send a vehicle command to commander such that it switches mode? That's not a nice solution because it basically tells the state machine the user commanded a landing 🤔

Copy link
Contributor Author

@asimopunov asimopunov Aug 28, 2024

Choose a reason for hiding this comment

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

So as part of the mission we send a vehicle command to commander such that it switches mode?

Yes, the assumption is that you're at the end of the mission or RTL so you can just exit the mode.
It also tells the user in QGC that they are now in precision land so that's a small bonus.

That's not a nice solution because it basically tells the state machine the user commanded a landing

yea, it's the quick way.

I think the src id and compid would still be the fmu and dmesg would say from internal command instead of external. I can double check. So we can still know it didn't come from a control station or from any external mavlink command.

Copy link
Contributor Author

@asimopunov asimopunov Aug 28, 2024

Choose a reason for hiding this comment

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

However, it would show up in the ulog the same as a commander precland shell command.

@asimopunov
Copy link
Contributor Author

asimopunov commented Aug 28, 2024

I assume to some extent that's done to support landing and taking off again in the same mission. If you switch mode the mission will not continue anymore.

Good point. That's something I didn't test. Maybe I can find a way to continue the mission if it broke.

Have you tested that the internal precision land still works or we fail in some cases e.g. does it still do precision land in RTL not just mission?

Yes, that's tested. The expectation is that normal land and internal precland will still work for missions and RTL.

Co-authored-by: Matthias Grob <maetugr@gmail.com>
@asimopunov
Copy link
Contributor Author

asimopunov commented Aug 29, 2024

@MaEtUgR

I'd check what the solution is for e.g. RTL at the end of a mission or switching to hold at the end of a takeoff.

I'm not sure I understood that part. What's the issue in those cases if the mode switches from mission to precland?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants