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

Add the possibility to "put" and "get" predefined panels with ready-to-use plots #151

Open
2 of 3 tasks
Tracked by #156
nunoguedelha opened this issue Oct 17, 2022 · 1 comment
Open
2 of 3 tasks
Tracked by #156
Assignees
Labels
Epic feature Feature request

Comments

@nunoguedelha
Copy link
Collaborator

nunoguedelha commented Oct 17, 2022

The feature can be implemented in two steps. The user actions mentioned below would be performed through the client GUI on the browser.:

  • Allow the user to access, from the visualizer client, exported panels stored in the remote server exchange folder #160
    Provide to the user a folder in the telemetry visualiser app repository where the user could save exported predefined panels (json files). Such panels would then be made available on the client visualiser on the browser, among the other telemetry entries.

    Example of json exported panel
    {
      "openmct": {
        "4edc453c-8535-4912-897c-36c3028e7778": {
          "composition": [{
            "namespace": "",
            "key": "ee9c1e48-9e89-4b87-8fd2-0652919d514f"
          }, {
            "namespace": "",
            "key": "1e30f98b-c3e1-4ea7-8f82-a93c40ac0f4f"
          }, {
            "namespace": "",
            "key": "ec67ddff-b798-4b30-8023-152bd8747f9c"
          }],
          "configuration": {},
          "name": "Right Upper Leg Tracking",
          "type": "telemetry.plot.stacked",
          "location": "mine",
          "modified": 1661529970146,
          "persisted": 1661529955896,
          "id": "4edc453c-8535-4912-897c-36c3028e7778",
          "identifier": {
            "namespace": "",
            "key": "4edc453c-8535-4912-897c-36c3028e7778"
          }
        },
        "ee9c1e48-9e89-4b87-8fd2-0652919d514f": {
          "composition": [{
            "namespace": "yarpopenmct.vectorCollectionsTelemetry",
            "key": "walkingController.logger",
            "index": "0"
          }, {
            "namespace": "yarpopenmct.vectorCollectionsTelemetry",
            "key": "walkingController.logger",
            "index": "1"
          }],
          "configuration": {
            "series": [{
              "identifier": {
                "namespace": "yarpopenmct.vectorCollectionsTelemetry",
                "key": "walkingController.logger",
                "index": "0"
              },
              "yKey": "value.joints_state::positions::desired.26"
            }, {
              "identifier": {
                "namespace": "yarpopenmct.vectorCollectionsTelemetry",
                "key": "walkingController.logger",
                "index": "1"
              },
              "yKey": "value.joints_state::positions::measured.26"
            }],
            "yAxis": {},
            "xAxis": {},
            "filters": {}
          },
          "name": "Right Hip Pitch Tracking",
          "type": "telemetry.plot.overlay",
          "location": "4edc453c-8535-4912-897c-36c3028e7778",
          "modified": 1661529760851,
          "id": "ee9c1e48-9e89-4b87-8fd2-0652919d514f",
          "persisted": 1661529760851,
          "identifier": {
            "namespace": "",
            "key": "ee9c1e48-9e89-4b87-8fd2-0652919d514f"
          }
        },
        "1e30f98b-c3e1-4ea7-8f82-a93c40ac0f4f": {
          "composition": [{
            "namespace": "yarpopenmct.vectorCollectionsTelemetry",
            "key": "walkingController.logger",
            "index": "0"
          }, {
            "namespace": "yarpopenmct.vectorCollectionsTelemetry",
            "key": "walkingController.logger",
            "index": "1"
          }],
          "configuration": {
            "series": [{
              "identifier": {
                "namespace": "yarpopenmct.vectorCollectionsTelemetry",
                "key": "walkingController.logger",
                "index": "0"
              },
              "yKey": "value.joints_state::positions::desired.27"
            }, {
              "identifier": {
                "namespace": "yarpopenmct.vectorCollectionsTelemetry",
                "key": "walkingController.logger",
                "index": "1"
              },
              "yKey": "value.joints_state::positions::measured.27"
            }],
            "yAxis": {},
            "xAxis": {},
            "filters": {}
          },
          "name": "Right Hip Roll Tracking",
          "type": "telemetry.plot.overlay",
          "location": "4edc453c-8535-4912-897c-36c3028e7778",
          "modified": 1661529770660,
          "id": "1e30f98b-c3e1-4ea7-8f82-a93c40ac0f4f",
          "persisted": 1661529770660,
          "identifier": {
            "namespace": "",
            "key": "1e30f98b-c3e1-4ea7-8f82-a93c40ac0f4f"
          }
        },
        "ec67ddff-b798-4b30-8023-152bd8747f9c": {
          "composition": [{
            "namespace": "yarpopenmct.vectorCollectionsTelemetry",
            "key": "walkingController.logger",
            "index": "0"
          }, {
            "namespace": "yarpopenmct.vectorCollectionsTelemetry",
            "key": "walkingController.logger",
            "index": "1"
          }],
          "configuration": {
            "series": [{
              "identifier": {
                "namespace": "yarpopenmct.vectorCollectionsTelemetry",
                "key": "walkingController.logger",
                "index": "0"
              },
              "yKey": "value.joints_state::positions::desired.28"
            }, {
              "identifier": {
                "namespace": "yarpopenmct.vectorCollectionsTelemetry",
                "key": "walkingController.logger",
                "index": "1"
              },
              "yKey": "value.joints_state::positions::measured.28"
            }],
            "yAxis": {},
            "xAxis": {},
            "filters": {}
          },
          "name": "Right Hip Yaw Tracking",
          "type": "telemetry.plot.overlay",
          "location": "4edc453c-8535-4912-897c-36c3028e7778",
          "modified": 1661529781095,
          "id": "ec67ddff-b798-4b30-8023-152bd8747f9c",
          "persisted": 1661529781095,
          "identifier": {
            "namespace": "",
            "key": "ec67ddff-b798-4b30-8023-152bd8747f9c"
          }
        }
      },
      "rootId": "4edc453c-8535-4912-897c-36c3028e7778"
    }
  • Allow the user to save/export a custom panel, just created, to the remote server exchange folder.

  • Import dynamically all panels in exchange folder following its structure #159
    Build dictionary and StaticImportObjectPlugin install instances automatically from exchange contents.

@nunoguedelha
Copy link
Collaborator Author

nunoguedelha commented Nov 18, 2022

Allow the user to access, from the visualizer client, exported panels stored in the remote server exchange folder

The plugin implementing this behaviour could have been implemented within the openmct framework directly, next to the plugin staticRootPlugin, but we implement it in yarp-openmct for now, for not further diverging from the official openmct release, as previous fixes/developments are still to be submitted.

The implementation steps are:

  • copy staticRootPlugin implementation code from Open-MCT module to folder openmctStaticServer/plugins/staticImportObjectPlugin

  • Replace AMD module definition (define function) by ECMA Script Javascript module definition (import primitives) (refer to https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Modules)

    Different module specifications:

    • CommonJS: commonly used on Node.js, characterized by the use of module.exports and require().
    • AMD: commonly used on browser code, characterized by the use of define[]() and import.
    • ECMA Script (ES6): natively supported and commonly used on browser code, characterized by the use of export or export default and import.
  • Define StaticImportObjectPlugin rootIdentifiers in a dictionary

    • Add a joint tracking exported panel .json file (left ankle pitch tracking) to
      the exchange folder.
    • add another call to openmct.install(StaticImportObjectPlugin(...)) for
      importing the new panel .json file. for each imported file, a unique specific
      namespace must be used, as the plugin install call returns to the OpenMCT
      ObjectAPI an object provider with a closure on the imported data and
      rootIdentifier. For each StaticImportObjectPlugin install call, a different
      rootIdentifier is defined, with a specific unique namespace and always the
      key root.
    • The identifiers rootIdentifier shall not be added to the root in the plugin
      anymore. Instead, they shall be defined in a dictionary defining the folder
      structure meant to contain the imported panels. Define and add that dictionary:
      mySavedPanels.
    • The leaf elements in the dictionary define the identifiers rootIdentifier.
      Their specific namespace and key shall be used by the staticImportObjectPlugin
      plugin to overwrite the key and namespace of the root domain object containing
      the imported domain objects (rootIdentifier).
    • Folder objects in the dictionary have to be processed by the ObjectProvider
      defined in the dictionary plugin, while the leaf elements have to be processed
      by the StaticModelProvider object provider defined in the plugin
      StaticImportObjectPlugin.
      For that purpose, In the dictionary plugin, getFolderTelemetryEntryKeys needs
      to return keys and namespaces, as rootIdentifier object namespaces won't be
      the same as their parent folder.
  • Add input rootLocation to StaticImportObjectPlugin plugin.
    It's cleaner to set the original location of the imported objects under the main folder "My Saved Panels".

  • Add JointTracking exported panels.
    This is a fast implementation. Ideally, the dictionary and installation of StaticImportObjectPlugin instances for adding exported panels should be automatic in the future, but for now we hardcode them. Each line installing a StaticImportObjectPlugin instance in openmctStaticServer/index.html, e.g.

    openmct.install(StaticImportObjectPlugin('myPanel100', 'exchange/JointTracking/LeftAnklePitchTracking.json', `${YARPOPENMCT_DICTIONARY_PLUGIN_NAMESPACE}:mySavedPanels`));
    openmct.install(StaticImportObjectPlugin('myPanel101', 'exchange/JointTracking/LeftAnkleRollTracking.json', `${YARPOPENMCT_DICTIONARY_PLUGIN_NAMESPACE}:mySavedPanels`));
    openmct.install(StaticImportObjectPlugin('myPanel102', 'exchange/JointTracking/LeftHipPitchTracking.json', `${YARPOPENMCT_DICTIONARY_PLUGIN_NAMESPACE}:mySavedPanels`));

    ...attaches an exported panel to the respective domain object in the dictionary dictionaryMySavedPanels .json, namely
    {"namespace": "myPanel100", "key": "root"},
    {"namespace": "myPanel101", "key": "root"},
    {"namespace": "myPanel102", "key": "root"},

    For each line, the only thing that changes is the panel number (has to be unique and match the respective one in the dictionary), and the file name.

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

No branches or pull requests

1 participant