cockpit icon indicating copy to clipboard operation
cockpit copied to clipboard

mavlink: Allow setting the frequency requested for individual messages

Open rafaellehmkuhl opened this issue 7 months ago • 4 comments

https://github.com/user-attachments/assets/fb9d7951-5511-40cf-8099-c8572ace2a4d

Fix #1857

rafaellehmkuhl avatar Apr 30 '25 14:04 rafaellehmkuhl

Cool feature to have!

Some concerns:

  1. This adds an additional page for MAVLink stuff
    • Could it instead be a second expandable section within the existing MAVLink inspector? That way you configure data requests in the same place where you can directly see that it's coming in
  2. From a quick look through the code, this doesn't seem to account for stream groups
    • I'm not sure how best to reconcile the interface for group vs individual requests, although I suppose a minimal viable solution would be to read the group rates and display those as defaults for the relevant messages, but then allow overriding those with individual requests (assuming that's how the autopilot firmware handles that - should probably be checked)
    • It would be nice if there can be some interface component showing that a message rate is currently being governed by a group request, and possibly having another section to configure groups (or even listing the messages by group, with an "ungrouped" group to handle the extras), and then having a group slider with the name, plus individual sliders for overrides, e.g. image (light red showing inactive features that are part of a group, grey showing messages using the relevant group rate, and dark blue showing messages with manual rate requests overriding the group rate (if there even is one))

ES-Alexander avatar May 01 '25 03:05 ES-Alexander

I tried to test this by setting the "BlueOS Version" page's "Remote Versions" to "rafaellehmkuhl/cockpit-public" but that didn't work for some reason. The error message was, "Failed to communicate with backend: Request failed with status code 404". The issue is surely that I don't yet know BlueOS well enough.

rmackay9 avatar May 01 '25 12:05 rmackay9

I tried to test this by setting the "BlueOS Version" page's "Remote Versions" to "rafaellehmkuhl/cockpit-public" but that didn't work for some reason.

@rmackay9 The BlueOS Version page is for managing your version of BlueOS. To install Extensions you'll want to use the Extensions manager. In the installed tab you can click the plus circle in the bottom right corner, then fill out the relevant details for the custom extension you want to install :-)

In this case my setup is:

Field Value Notes
Extension Identifier rafaellehmkuhl.cockpit user choice, just pick something reasonable and unique - I usually go for the image name with a dot instead of the slash
Extension Name Cockpit Rafael user choice, just pick something descriptive enough
Docker image rafaellehmkuhl/cockpit this needs to be correct, and can be checked in Docker Hub if necessary
Docker tag allow-individual-message-interval branch name - I usually copy from the GitHub PR header, and just delete the username part.
Original Settings ...^1 copy from an existing install of the extension, or get them from the permissions field in the repo Dockerfile, removing the string-escaping backslashes

Once you've got it set up you can disable any other installs of the same extension (to avoid confusion in the sidebar), and then to review future pull requests from the same author you can Edit the extension (requires Pirate Mode) and just update the Docker tag field :-)

{ "ExposedPorts": { "8000/tcp": {} }, "HostConfig": { "PortBindings": { "8000/tcp": [ { "HostPort": "" } ] } } } ```

ES-Alexander avatar May 01 '25 16:05 ES-Alexander

Hi @rafaellehmkuhl,

Another small thing I noticed, it would probably be best if the mavlink messages appeared in alphabetical order

rmackay9 avatar May 06 '25 07:05 rmackay9

@ES-Alexander @rmackay9 @patrickelectric I have refactored the functionality, as can be seen below.

The four options now are:

  • Disable (don't send that message)
  • Don't touch (Cockpit don't try to define the interval, even if its on its defaults)
  • Vehicle default (whatever the vehicle decided)
  • Custom (set a specific frequency)

The user options are stored in sync with the vehicle and automatically aplied on Cockpit's boot or when the option is changed.

I've also added a forms under the table so the user can specify the interval for any option that is not there (the table is populated with Cockpit's defaults).

This MAVLink configuration menu only appears if the user has pirate-mode activated (in the general menu), which is added on #1912.

https://github.com/user-attachments/assets/97c34e0e-6d44-4910-bd58-60550eaf7f72

rafaellehmkuhl avatar May 29 '25 00:05 rafaellehmkuhl

thanks very much for this, sorry for taking a while to test, I hope to get to this tomorrow but 100% by (my) monday

rmackay9 avatar May 30 '25 12:05 rmackay9

thanks very much for this, sorry for taking a while to test, I hope to get to this tomorrow but 100% by (my) monday

No problem randy, I also had to set this aside for a while because of other tasks. I believe the current implementation will fulfil most needs. I'm using it myself already.

rafaellehmkuhl avatar May 30 '25 13:05 rafaellehmkuhl

@rafaellehmkuhl,

I installed this (I think) but for some reason I don't see the new MAVlink interval feature. I think it should appear in Cockpit under Settings and then just below "Actions" image

I completely uninstalled the default Cockpit and installed the new one and below we can see it is running and then settings I applied. I'm also using Pirate mode image

Any idea what I might be doing incorrectly?

By the way, I wonder if it might be better to somehow put this under the existing Telemetry setting? .. or maybe "Telemetry" is really "Telemetry OSD" so it's not the same?

rmackay9 avatar May 31 '25 02:05 rmackay9

@rafaellehmkuhl,

I installed this (I think) but for some reason I don't see the new MAVlink interval feature. I think it should appear in Cockpit under Settings and then just below "Actions"

I completely uninstalled the default Cockpit and installed the new one and below we can see it is running and then settings I applied. I'm also using Pirate mode

Any idea what I might be doing incorrectly?

By the way, I wonder if it might be better to somehow put this under the existing Telemetry setting? .. or maybe "Telemetry" is really "Telemetry OSD" so it's not the same?

I forgot to mention @rmackay9! You have to go to the general settings and click to enable pirate mode!

rafaellehmkuhl avatar May 31 '25 02:05 rafaellehmkuhl

Hi @rafaellehmkuhl,

Excuse my ignorance but I guess this is a cockpit specific pirate mode? I've already put BlueOS into Pirate mode.

I've gone into Cockpit, Settings, General, "Manage Cockpit Settings" and I don't see any setting containing "pirate". Maybe this is because https://github.com/bluerobotics/cockpit/pull/1912 is not included in the extension yet?

Thanks again for all your efforts on this!

rmackay9 avatar May 31 '25 03:05 rmackay9

Hi @rafaellehmkuhl,

Excuse my ignorance but I guess this is a cockpit specific pirate mode? I've already put BlueOS into Pirate mode.

I've gone into Cockpit, Settings, General, "Manage Cockpit Settings" and I don't see any setting containing "pirate". Maybe this is because #1912 is not included in the extension yet?

Thanks again for all your efforts on this!

Don't worry Randy haha

The changes on #1912 are included in this PR now. They were not before, but were included in the last update.

This is how you enable it:

https://github.com/user-attachments/assets/bcdccc05-2d52-43e1-86d1-050b293b905f

rafaellehmkuhl avatar May 31 '25 19:05 rafaellehmkuhl

Hi @rafaellehmkuhl,

I re-installed the extension but sadly the pirate mode does not appear image

Maybe something isn't correct about how I added the extension? image

rmackay9 avatar Jun 02 '25 11:06 rmackay9

Hi @rafaellehmkuhl, I re-installed the extension but sadly the pirate mode does not appear Maybe something isn't correct about how I added the extension?

Hey @rmackay9,

I'm talking to my colleagues that take care of this extension part in BlueOS to see what could be happening. My suspect is that the docker pull is always downloading the first version of this tag available.

As a workaround, I pushed the same branch, updated, to the allow-individual-message-interval2 tag. Can you change it on your extension to force the re-download?

rafaellehmkuhl avatar Jun 02 '25 13:06 rafaellehmkuhl

I'm not qualified to review the code but I've tested the new feature and it seems to work, thanks very much!

Thank you for the feedback Randy! I will try to include it in the next Beta release.

rafaellehmkuhl avatar Jun 03 '25 01:06 rafaellehmkuhl

@ArturoManzoli could you take a look at the code for that one? You can skip the pirate-mode part, as it's being added on the other PR.

rafaellehmkuhl avatar Jun 05 '25 14:06 rafaellehmkuhl

Code looks fine to me;

My only change would be to redistribute the elements horizontally on the table, so no void space would be on the right part of the screen

image

ArturoManzoli avatar Jun 05 '25 15:06 ArturoManzoli

Code looks fine to me;

My only change would be to redistribute the elements horizontally on the table, so no void space would be on the right part of the screen

Thanks for the tip! I ended up changing it a lot. It's now a lot more compact and can fit even when in half-screen:

image

rafaellehmkuhl avatar Jun 06 '25 12:06 rafaellehmkuhl

@ArturoManzoli I have just rebased that over master, which now contains the Pirate Mode implementation, so it's ready to go.

rafaellehmkuhl avatar Jun 06 '25 18:06 rafaellehmkuhl

Yay! thanks for this!!

rmackay9 avatar Jun 07 '25 00:06 rmackay9

Yay! thanks for this!!

No problem Randy! It was included in beta4, released today. Thanks again for the idea and feedback.

rafaellehmkuhl avatar Jun 07 '25 00:06 rafaellehmkuhl