Question about how Cockpit handles ArduSub flight modes

Hi @rafael.lehmkuhl and @EliotBR ,

I have a question about how Cockpit handles available flight modes from ArduSub.

From what I can currently see, it looks like the flight modes available in Cockpit are hardcoded on the Cockpit side. So if we rename an existing flight mode or add a new flight mode in a modded ArduSub version, Cockpit does not automatically detect or display that change.

Because of that, it seems like the only current options are either:

  1. overwrite or reuse an existing flight mode, or
  2. modify Cockpit itself so it recognizes the renamed or newly added flight mode.

Do I understand this correctly, or is there already another way for Cockpit to detect custom or newly added ArduSub flight modes?

If this is currently hardcoded, would it be possible to make this more dynamic in the future? Ideally, Cockpit would read the available flight modes directly from ArduSub instead of relying on a fixed list inside Cockpit.

Thanks!

Hey @sietse!

Yes, as you noticed Cockpit has hardcoded modes for each type of vehicle. We went that path because the AVAILABLE_MODES message had just been added to the MAVLink protocol when we first implemented that part of the code, and the support on ArduPilot actually only started on Copter at 2024. I’ve just talked to @williangalvani and he confirmed to have just added support for this message on ArduSub. It’s in the latest beta and will be available on the next stable (ArduSub 4.7).

I will make sure we add support for it in the next weeks before the ArduSub stable is released.