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

Flight modes dev guide updates #3577

Draft
wants to merge 8 commits into
base: main
Choose a base branch
from
Draft

Conversation

hamishwillee
Copy link
Collaborator

This updates the flight mode "dev" guide - https://docs.px4.io/main/en/concept/flight_modes.html

  • Removes the diagram
  • Removes info about specific modes - links to other docs.
  • Adds info about Standard modes and mavlink integration

Lots still to do. This is draft.

Fixes #3564

Comment on lines 63 to 68
## PX Flight Modes (FC)

The specific control behaviour of a flight mode at any time is determined by a [Flight Task](../concept/flight_tasks.md).
A flight mode might define one or more tasks that define variations of the mode behavior.
The actual behaviour that is used is normally defined in a parameter, and selected in [src/modules/flight_mode_manager/FlightModeManager.cpp](https://github.com/PX4/PX4-Autopilot/blob/main/src/modules/flight_mode_manager/FlightModeManager.cpp#L266-L285)

Copy link
Collaborator Author

@hamishwillee hamishwillee Feb 13, 2025

Choose a reason for hiding this comment

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

@MaEtUgR Can I get some hints for flight modes. It looks like the bit of the code that does something is the Flight Task, and that a mode might have a few of these all that do a particular variant of the mode behaviour - e.g. different types of position control.

I also understand the mode restrictions, which is in the next section (I think).

But not clear

  • how I declare an entirely new mode "HamishMode".
  • Where do I have to add the code for that.
  • Do I have to add that to the list of modes exported to MAVLink or that happens magically
  • If there are any base classes - i.e. What is a mode.
  • How are their characteristics set?
  • How do I notify when the set of modes changes? Do I need to do anything when I create a new mode?

Any chance of some bullet points of the key concepts?

At time of writing there are no PX4 ROS 2 flight modes that are considered "supported as an integral part of the PX4 open source offering".
:::

## PX4 FC Modes vs PX4 ROS2 Flight Modes
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

FYI, this section put me in contortions - how do I refer to a flight mode that runs in the FC?

It was the reason I wrote this #3565 (comment)

Copy link
Contributor

Choose a reason for hiding this comment

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

Should we label them with "internal" (vs. "external"=running on ROS2)

Copy link
Contributor

Choose a reason for hiding this comment

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

I like Internal vs External @sfuhrer

Copy link
Collaborator Author

@hamishwillee hamishwillee Feb 19, 2025

Choose a reason for hiding this comment

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

@mrpollo @sfuhrer I "like" Internal vs External too, but I'm not certain it is future proof terminology.

Assuming you read #3565 (comment), are you suggesting that if in future we have a flight stack that spans FC and Companion, then we will refer to the parts as PX4 Internal (runs on FC) and PX4 External (runs on companion)?

It's a little clunky in that it will make any code look a little like second class citizen - i.e. "Internal" implies "you've got to be on the flight stack to really be part of PX4".

I proposed PX4 RTOS modes / PX4 GTOS modes which is unambiguous about where the code runs. Internal/External fits better with what we have now. I don't feel too strongly as long as we are all agreed on our terminology.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

For now I will try Internal vs External, but I would like you to think about ^^^^

Copy link
Contributor

@sfuhrer sfuhrer Feb 19, 2025

Choose a reason for hiding this comment

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

"Internal" implies "you've got to be on the flight stack to really be part of PX4".

But that's how it is - we (PX4 community) do not maintain the ROS flight modes, so the user is on it's own when they use them.
EDIT: now that I read through the whole other issue I start to see the whole complexity. The fundamental question is what we consider PX4 to be. I so far considered it to be only the RTOS part. What would it mean if we also consider the GTOS part as part of PX4 - can we consider that as PX4 even though we don't have a place to share RTOS flight modes, or do we intent to change that in the future?

I btw fully support you in spending the time now to think this through - it will be very hard to change in the future once people get used to the naming.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes, that is exactly the problem.

If I knew we'd have "full stack" PX4 in a year or so I'd push for PX4 RTOS modes and PX4 GCOS modes (or replacing RTOS/GCOS with RT, NuttX, GC, Linux).

Copy link
Contributor

@sfuhrer sfuhrer left a comment

Choose a reason for hiding this comment

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

Looks concise. I unfortunately don't have enough exposure to external flight modes yet to highlight common pitfalls that we should cover with the docs.
One thing I find a bit unfortunate with the new structure (and with the Standard Modes) is that it's hard to distinguish "auto" from "manual" modes.

At time of writing there are no PX4 ROS 2 flight modes that are considered "supported as an integral part of the PX4 open source offering".
:::

## PX4 FC Modes vs PX4 ROS2 Flight Modes
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we label them with "internal" (vs. "external"=running on ROS2)

Copy link
Contributor

@mrpollo mrpollo left a comment

Choose a reason for hiding this comment

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

I hope this helps

At time of writing there are no PX4 ROS 2 flight modes that are considered "supported as an integral part of the PX4 open source offering".
:::

## PX4 FC Modes vs PX4 ROS2 Flight Modes
Copy link
Contributor

Choose a reason for hiding this comment

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

I like Internal vs External @sfuhrer

- High-level functionality is available, including a better-feature programming environment, and many useful Linux and ROS libraries.
- More available compute to do more advanced processing (e.g. computer vision).

Note that there are some negatives to keep in mind:
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we should open an issue where we track these three bullet points and link to this instead of listing them here where they will likely get stale over time

Copy link
Collaborator Author

@hamishwillee hamishwillee Feb 19, 2025

Choose a reason for hiding this comment

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

EDIT I have modified this to:

Note that the PX4 ROS 2 Control Interface used to create external modes first appeared in PX4 v1.15 and is still considered experimental.
There are still some limitations, but expect changes and ongoing enhancement.

The limitations are in the header of the linked interface.

@mrpollo I did create this issue just for the CI:

It would be good if you could decide how you want to handle things like "defining what it means to be PX4 External"

Copy link

No flaws found

@hamishwillee
Copy link
Collaborator Author

hamishwillee commented Feb 19, 2025

@mrpollo @sfuhrer OK, updated to use external/internal. I explained above the potential issue with this, but I think we can live with it for now. Also removed the bits that were worrying you @mrpollo.

What worries me about this is that you still couldn't create an internal flight mode with this information - i.e. we need an answer to #3577 (comment)

IF we're not going to have that we should merge this. But I'm disappointed.

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.

Update Flight Modes Diagram
3 participants