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

Introducing the VeryGenericIndicator #474

Merged

Conversation

rafaellehmkuhl
Copy link
Member

@rafaellehmkuhl rafaellehmkuhl commented Sep 11, 2023

Search and include all variables coming from ArduPilot vehicles on the genericVariables object.
With this change, we allow the usage of the GenericIndicator VeryGenericIndicator mini-widget with any vehicle variable.

I'm also adding two new variable to the indicator configuration:

  • displayName, so the user can select a variable but choose a better name for displaying in the widget
  • fractionalDigits, so the user can specify how many digits he wants to display after the decimal place

Important to notice: we are differentiating messages that specify IDs, as suggested by Eliot. For this, I've tried a generic approach, but it leads to many edge-cases, so I just used a list with known identifier keys.

@ES-Alexander could I suggest that you separate the #449 issue into a new issue that lists the suggested improvements (e.g.: color picking, alerts, etc) for the GenericIndicator mini-widget?

Fix #449

image image

@rafaellehmkuhl rafaellehmkuhl marked this pull request as draft September 11, 2023 15:55
@rafaellehmkuhl rafaellehmkuhl force-pushed the very-generic-indicator branch 3 times, most recently from 07788a1 to a7de368 Compare September 14, 2023 17:56
@rafaellehmkuhl rafaellehmkuhl marked this pull request as ready for review September 14, 2023 18:04
@rafaellehmkuhl rafaellehmkuhl changed the title Very generic indicator Introducing the VeryGenericIndicator Sep 14, 2023
Copy link
Contributor

@ES-Alexander ES-Alexander left a comment

Choose a reason for hiding this comment

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

I haven't tested because I didn't want to build, but from what you've shown and discussed it seems like a decent start on our aims. It's super exciting to be able to support arbitrary messages - that's going to be so powerful! 😀

A couple of suggestions for improvement, but nothing critical :-)

Comment on lines 185 to 198
'id',
'gcs_system_id',
'sensor_id',
'rtk_receiver_id',
'compass_id',
'gps_id',
'storage_id',
'camera_id',
'stream_id',
'gimbal_device_id',
'hw_unique_id',
'uas_id',
Copy link
Contributor

Choose a reason for hiding this comment

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

Can these be sorted lexicographically/alphabetically? Hard to tell what is and isn't included at the moment. I'm assuming you got all the relevant ones from a search - I only checked the first few in a search and it seems like param_id is missing, but perhaps that was intentional?

Also seems worth including idx and cam_idx from the ardupilotmega message set.

Copy link
Member Author

Choose a reason for hiding this comment

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

Will sort alphabetically.

Got them from a search in the MAVLink Common messages page, yes.

param_id was left behind intentionally, as it leads to a lot of garbage variables being registered and (I assume) no valuable data.

Will include idx and cam_idx.

'uas_id',
]

const getDeepVariables = (obj: Record<string, unknown>, acc: Record<string, unknown>, baseKey?: string): void => {
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 there should be a comment here explaining what this method is for. Maybe something like

/**
 * Allows handling messages that are shared by multiple devices, splitting them out by detected device IDs.
 */

It may also be worth noting that NAMED_VALUE_* messages are split out via a different function.

@@ -14,59 +18,79 @@ export interface GenericIndicatorTemplate {
* Symbols representing the unit system of the variable
*/
variableUnit: string
/**
* Number of digits to be displayed after the decimal separator (usually dot)
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there a setting somewhere that allows people to change the decimal separator, or does it automatically use the separator for the locale of the browser device or something? Would be nice if europeans can use their comma decimal separators, even though they hurt my eyeballs 😂

Copy link
Member Author

Choose a reason for hiding this comment

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

🤣

There isn't, and I actually think we shouldn't add it.

We Brazilians also use commas as decimal separators, but this was clearly a big mistake, and softwares like Excel suffer a lot for adding the possibility of changing it, as it causes huge confusions when receiving a spreadsheet.

@ES-Alexander ES-Alexander added the docs-needed Change needs to be documented label Sep 15, 2023
@rafaellehmkuhl
Copy link
Member Author

Docs PR here.

…bject

This allows for generic access of any Ardupilot variable from Cockpit users, for example on the `GenericIndicator` widget
With it the user can have a name displayed on the widget that is different from the variable name (which can be cryptic).
There's a lot of situations where the same MAVLink message will bring data from different sources, usually different sensors.

We want to separate those as different variables, so the user can choose to display a variable from an specific source, instead of scrambling the data from many.

To do so, we look for specific identifier keys in the messages, and use it's values (IDs) to name their variables.
@rafaellehmkuhl
Copy link
Member Author

I haven't tested because I didn't want to build, but from what you've shown and discussed it seems like a decent start on our aims. It's super exciting to be able to support arbitrary messages - that's going to be so powerful! 😀

A couple of suggestions for improvement, but nothing critical :-)

Agree. This opens a lot of doors.

Maybe the next cool thing would be to actually store these variables in time, so we can graph them. We should only take care not to blow up memory.

@rafaellehmkuhl rafaellehmkuhl merged commit b78f93d into bluerobotics:master Sep 15, 2023
5 checks passed
@rafaellehmkuhl rafaellehmkuhl deleted the very-generic-indicator branch September 15, 2023 17:12
ES-Alexander added a commit to ES-Alexander/ardusub-zola that referenced this pull request Nov 23, 2023
ES-Alexander added a commit to ES-Alexander/ardusub-zola that referenced this pull request Nov 23, 2023
ES-Alexander added a commit to ES-Alexander/ardusub-zola that referenced this pull request Nov 23, 2023
ES-Alexander added a commit to ES-Alexander/ardusub-zola that referenced this pull request Nov 23, 2023
ES-Alexander added a commit to ES-Alexander/ardusub-zola that referenced this pull request Nov 24, 2023
ES-Alexander added a commit to ES-Alexander/ardusub-zola that referenced this pull request Nov 24, 2023
ES-Alexander added a commit to ES-Alexander/ardusub-zola that referenced this pull request Nov 24, 2023
ES-Alexander added a commit to ES-Alexander/ardusub-zola that referenced this pull request Nov 24, 2023
ES-Alexander added a commit to ES-Alexander/ardusub-zola that referenced this pull request Nov 24, 2023
ES-Alexander added a commit to bluerobotics/ardusub-zola that referenced this pull request Nov 24, 2023
ES-Alexander added a commit to bluerobotics/ardusub-zola that referenced this pull request Nov 24, 2023
ES-Alexander added a commit to bluerobotics/ardusub-zola that referenced this pull request Nov 24, 2023
@ES-Alexander ES-Alexander added docs-complete Change documentation has been completed and removed docs-needed Change needs to be documented labels Nov 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs-complete Change documentation has been completed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add generic MAVLink message mini-widget
3 participants